Class Chaos

Tristan Seligmann mithrandi at mithrandi.za.net
Mon Jun 28 13:59:22 EDT 2004


On Mon, Jun 28, 2004 at 12:45:37 -0400, Leif K-Brooks wrote:
> Paul McGuire wrote:
> >You will also find that you avoid some funny Python behavior if you
> >avoid
> >using built-in type names (such as list, dict, and str) for variable
> >names.
>
> What sort of funny behavior?

Code that uses the names without expecting them to be masked by other
objects:

str = "Blah blah"
... later ...
str(5)

Produces the slightly mysterious:
    TypeError: 'str' object is not callable

Correct behavior, to be sure, but potentially confusing.
--
mithrandi, i Ainil en-Balandor, a faer Ambar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20040628/eef350f4/attachment.sig>


More information about the Python-list mailing list