object as a reserved keyword
Ian Bicking
ianb at colorstudy.com
Sun Jul 20 06:01:44 EDT 2003
On Sun, 2003-07-20 at 04:29, Lawrence Oluyede wrote:
> Does it worth to make "object" keyword a reserved one?
> I'd like to avoid oddities like this:
>
> Python 2.3c1 (#44, Jul 18 2003, 14:32:36) [MSC v.1200 32 bit (Intel)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> class c(object): pass
> ...
> >>> object = 4
> >>> class c(object): pass
> ...
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: int() takes at most 2 arguments (3 given)
> >>>
That's not odd or even bad... so you get an exception. That can happen
all the time when you do silly things. Now...
class object: pass
*That* would be bad, cause later on you'll do...
class Whatever(object):
...
x = property(get_x, set_x)
I can totally imagine going nuts trying to figure out what went wrong
with that...
Ian
More information about the Python-list
mailing list