![]() |
|
#1
|
|||
|
|||
PrintingOk, I'm trying to do a code just to get used to OOP, i'm kinda a newbie, but ... here's the code:
Python Code:
I know that the problem is where I say print correspond[self.space], but I DON'T know how to get it to work, any suggestions? :-D Last edited by admin : 02-Oct-2006 at 03:40.
Reason: Please insert your PYTHON code between [py] & [/py] tags
|
|||
|
#2
|
||||
|
||||
Re: PrintingCould you repost again using the python code tags ([py][/py]) around your code? I can't tell how your indents are supposed to be, especially for the correspond dictionary.
Offhand, type is a Python keyword, so you might want to change the name for that variable. __________________
Start Programming with Python-A beginner's guide to programming and the Python language. ------------- Common Sense v2.0-Striving to make the world a little bit smarter. |
|
#4
|
||||
|
||||
Re: PrintingWhen I tried writing the above program in IDLE, the default Python editor (which isn't the one I normally use but I was lazy), type came up color coded. I've never used it as a variable name by itself, so I didn't think anything about it. I was simply going on what IDLE gave me.
I double-checked it in SPE and it didn't color code it. Could just be a fluke in the IDLE markup code. Sorry about the confusion. So danielfolsom, the answer to your problem is in the error code the Python interpreter spits out when you run the code. Quote:
__________________
Start Programming with Python-A beginner's guide to programming and the Python language. ------------- Common Sense v2.0-Striving to make the world a little bit smarter. |
|
#5
|
|||
|
|||
Re: PrintingIn Python type is not a keyword but a builtin function. Don't use it as a variable name or the following will happen:
Python Code:
This will give you a list of all builtins: Python Code:
|
|
#6
|
||||
|
||||
Re: PrintingSo that would explain the disparity between the IDEs; IDLE, being the default IDE created by Guido himself, will show you the reserved words. SPE and others probably won't show you these words.
Good to know. __________________
Start Programming with Python-A beginner's guide to programming and the Python language. ------------- Common Sense v2.0-Striving to make the world a little bit smarter. |
Recent GIDBlog
Not selected for officer school by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Printing posters... | blumagic | Graphics Forum | 0 | 03-Apr-2006 08:11 |
| C++ printing contents of txt files etc | Venom | C++ Forum | 3 | 18-Mar-2005 22:12 |
| Printing problem | Frandy | MS Visual C++ / MFC Forum | 1 | 16-Feb-2005 13:47 |
| printing nos in vc++ | kumaran | MS Visual C++ / MFC Forum | 3 | 09-Jan-2005 23:28 |
| I cant believe this doesnt work: - basic printing of integers to screen | davo | C Programming Language | 2 | 24-Jul-2004 21:50 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The