[Python-Dev] PEP for adding an sq_index slot so that any object, a or b, can be used in X[a:b] notation (original) (raw)

Jim Jewett jimjjewett at gmail.com
Mon Feb 13 21:55:14 CET 2006


Is there a reason integer would be rejected?

Guido van Rossum answered:

Given the number of folks who misappreciate the difference between getattr and getattribute, I'm not sure I'd want to encourage using abbreviated and full forms of the same term in the same context. When confronted with the existence of int and integer I can see plenty of confusion ahead.

I see this case as slightly different.

getattr and getattribute are both things you might reasonably want to do. int is something you probably shouldn't be doing very often anymore; it is being kept for backwards compatibility.

Switching getattr and getattribute will cause bugs, which may be hard to diagnose, even for people who might reasonably be using the hooks. Switching int and (newname) won't matter, unless int was already doing something unexpected. Since backwards compatibility means we can't prevent int from doing the unexpected, a similar name might be good -- at least it would tip people off that int might not be what they want.

I can't think of any way to associate getattr vs getattribute with timing or precedence. I already associate int with a specific C datatype and integer with something more abstract. (I'm not sure the new method is a better match for my integer concept, and it probably isn't a better match for java.lang.Integer, but ... the separation is there.)

-jJ



More information about the Python-Dev mailing list