[Python-ideas] anonymous object support

Guido van Rossum guido at python.org
Sun Jul 24 18:03:37 CEST 2011


On Sun, Jul 24, 2011 at 8:35 AM, Herman Sheremetyev <herman at swebpage.com> wrote:
> On Mon, Jul 25, 2011 at 12:06 AM, Guido van Rossum <guido at python.org> wrote:
>> On Sun, Jul 24, 2011 at 7:04 AM, Herman Sheremetyev <herman at swebpage.com> wrote:
>>> It is currently somewhat difficult/awkward to create arbitrary
>>> "anonymous" objects in Python.
>>
>> It looks like you are trying to duplicate Java's anonymous classes.
>> Please don't try to emulate Java's work-arounds for Java's
>> deficiencies.
>
> Ouch, and I don't even know Java well enough to deserve that ;)

Ah, sorry.

> I think a more accurate characterization would be that I'm trying to
> emulate Javascript's object literal notation, but I was trying to
> avoid parallels with other languages in my proposal.

Still, IMO Javascript's objects suffer from a fatal confusion between
being dicts and objects, so I still "object" to the idea. :-)

> FWIW, I think it would be fine if this was a convenience function in
> the standard library as suggested above. But it seems so basic that
> having it supported in in the object() constructor would be the most
> natural place rather than tucking it away in a library.

Python's object is supposed to have only the minimal functionality.
Its instances don't even have a __dict__.

Also, every one believes there own favorite feature to be so important
that it's worth changing the language, but they don't want to grant
that to anybody else's favorite feature... :-)

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list