Code basics
David Arnold
arnold at dstc.edu.au
Fri Mar 17 10:28:27 EST 2000
More information about the Python-list mailing list
Fri Mar 17 10:28:27 EST 2000
- Previous message (by thread): Code basics
- Next message (by thread): Code basics
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
-->"JJ" == JJ <joacim at home.se> writes: JJ> I'm a C/C++/Java programmer and wonder how to make "code blocks" JJ> in Python. Please translate this to Python: you use indentation. i'll assume that you want this in a method, but it could easily be a simple function if you'd rather. class Foo: """A sample class.""" def Method(self): """A sample method.""" while notDone: chip = self.getNumberOfSomthing() if chip == 10: print "Tjohoo" else: print "Oh no!" def getNumberOfSomething(self): """The undefined method.""" return 10 note that this will die at runtime because notDone is not defined.
- Previous message (by thread): Code basics
- Next message (by thread): Code basics
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list