• Welcome to Valhalla Legends Archive.
 

Multiple questions concerning Python

Started by topaz, May 15, 2006, 04:31 AM

Previous topic - Next topic

Kp

No, Windows does not do it.  Even on Windows, it's traditional, but not mandatory for argv[0] to be the program's name.  My Windows programs routinely pass junk in argv[0] (a dash, a letter, an underscore - something easy to hardcode).
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

topaz

#16
6. What is the equivalent of the switch/select case statement in Python?

(Python is great so far, but I've been needing to read a lot of documentation as well as code so I know how to use so-so function :))
RLY...?

dxoigmn

#17
Quote from: rabbit on May 18, 2006, 07:48 PM
Windows does it, and based on what's been said, that's the primary platform, so that's what I went with.

http://blogs.msdn.com/oldnewthing/archive/2004/01/14/58579.aspx

Quote from: Topaz on May 19, 2006, 01:23 AM
6. What is the equivalent of the switch/select case statement in Python?

(Python is great so far, but I've been needing to read a lot of documentation as well as code so I know how to use so-so function :))

http://www.google.com/search?hl=en&q=python+switch&btnG=Google+Search

Yegg

Quote from: Topaz on May 19, 2006, 01:23 AM
6. What is the equivalent of the switch/select case statement in Python?

The equivalent is a lot of elif's :).

topaz

Quote from: Yegg on May 19, 2006, 01:34 PM
Quote from: Topaz on May 19, 2006, 01:23 AM
6. What is the equivalent of the switch/select case statement in Python?

The equivalent is a lot of elif's :).

Thanks.


7. What is the equivalent of the 'SendMessageByString' API? It's not available in the win32gui or win32api libraries - it merely posts text to a specified handle.
RLY...?

K

SendMessageByString is a just a declaration (used in Visual Basic) of SendMessage with either the LPARAM or WPARAM defined as a string.  You can just use SendMessage and pass a pointer of the appropriate type.

warz

#21
Python has no switch statements? Eww?

Edit: After looking into this furthur, I guess that map method (thats what its called? dictionary map or something?) isn't that bad.

topaz

AFAIK, if/elif does essentially the same thing as a switch statement, in terms of operation.
RLY...?

topaz

8. How would I go about making my code look like this

insertString 'string'

instead of the present

insertString('string')
RLY...?

Banana fanna fo fanna

Quote from: Topaz on May 24, 2006, 09:50 PM
8. How would I go about making my code look like this

insertString 'string'

instead of the present

insertString('string')

You wouldn't.

EDIT: though you can use operator overloading to achieve similar results:


mybuffer << "string"


Play around with adding a __lshift__ method to your code.