[Python-ideas] anonymous object support

Herman Sheremetyev herman at swebpage.com
Sun Jul 24 17:35:30 CEST 2011


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 ;)

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.

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.

-Herman



More information about the Python-ideas mailing list