TK program problem

Terry Reedy tjreedy at udel.edu
Sun May 22 17:17:37 EDT 2011


On 5/21/2011 10:20 PM, bvdp wrote:
>
>> One of the purposes and advantages of Python 3 is having only one class
>> system. Best to always use new-style classes in Python 2.2+ unless you
>> understand and need old-style classes (and need should be never for most
>> people).
>>
>
> Thanks for this. I'll keep it in mind!
>
> One thing I really don't understand ... is there a difference between
> the old/new forms:
>
>     class foo:
>     class foo():
>
> In cases where I've played with them, they _appear_ to work the same?

I believe they are. Same is true in 3.x except that the result in a 
new-style class.

> Also, where does one find the magic that says that for a tkinter class
> you should use:
>
>     class foo(object):

Perhaps nowhere. It may have been an unintended side-effect of the 
change in callable check, or intentional but not documented.

> Not really sure where "object" comes from.

It is the base class of all (new-style) classes.
 >>> object()
<object object at 0x00EB6668>

-- 
Terry Jan Reedy




More information about the Python-list mailing list