object as a reserved keyword

L

Lawrence Oluyede

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.....
Traceback (most recent call last):

Lawrence
 
L

Lawrence Oluyede

I'd like to avoid oddities like this:

I just noticed that it's the same thing with other builtin types such
as list, dict and so on... Hope anyone exlpain me the reason to that.
Maybe is beyond my views...

Lawrence
 
E

Erik Max Francis

Lawrence said:
Does it worth to make "object" keyword a reserved one?
I'd like to avoid oddities like this:

It's no different from overriding any of the builtins with a
non-standard value:

If someone wants to be abusive, he can. The idea behind Python is that
everyone will behave like adults, so there's little need to worry about
these kinds of things.
 
I

Ian Bicking

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....
Traceback (most recent call last):

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
 
L

Lawrence Oluyede

If someone wants to be abusive, he can. The idea behind Python is that
everyone will behave like adults, so there's little need to worry about
these kinds of things.

Yeah, thanks. Is this kind of idea that I'm not used to
 
A

Aahz

Does it worth to make "object" keyword a reserved one?

Maybe. Python strives for a minimal syntax. Many identifiers that
would be keywords in other languages are simply names in the builtin
namespace.
 
D

Dan Bishop

Lawrence Oluyede said:
I'd like to avoid oddities like this:

I just noticed that it's the same thing with other builtin types such
as list, dict and so on... Hope anyone ex[pl]ain me the reason to that.
Maybe is beyond my views...

I understand his problem.

When I write in other languages and need a meaningless variable name,
I tend to use an abbreviation for the variable's type.

public void foo(String str) {/* ... */}
public void foo(List list) {/* ... */}

As you can see, this convention doesn't carry over very well to
Python.
 
S

Steven Taschuk

Quoth Mel Wilson:
[...]
Plus it's not impossible that somebody could export a
name in the set of standard names from a module or a
class and accomplish something useful. I'm having trouble
finding a convincing example, [...]

re.compile()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top