[Tutor] Tutor FAQ

Mike Hansen mahansen at adelphia.net
Thu May 18 02:39:51 CEST 2006


Here's a small batch of questions/answers for the tutor FAQ.

Let me know if you have any corrections or clarifications. I'll post 
them to the web site in a couple of days.

Mike

---------------------------------------------------------------------
How much code should I post?

Post as much relevent code as you can. However, the consensus seems to 
be that the more code you post, the less likely you'll get someone to 
review it. A max of 100 lines is suggested. If you have more code, you 
might post your code at
http://www.rafb.net/paste or a similar site.

---------------------------------------------------------------------
How do I dynamically name my objects? How do I name my objects based on 
user input?

Rather than performing voodoo by dynamically creating variables, your 
best bet is to use a dictionary with the keys being the name of the 
object or user input and the values being the objects.

---------------------------------------------------------------------
Why doesn't my special method add, init, or cmp.. work?

Remember to use two underscores before and after the method name 
__add__, __init__, __cmp__.



More information about the Tutor mailing list