[Python-Dev] PEP 3000 and new style classes

Michael Chermside mcherm at mcherm.com
Fri Sep 9 23:12:20 CEST 2005


Lisandro Dalcín proposes:
> Any possibility to add something like
>
> from __future__ import new_style_classes

Tristan Seligmann writes:
> Why does it matter if the single statement you insert is spelled
> "  metaclass   = type" instead of "from   future   import whatever"?

Russell Owen responds:
> It matters because "metaclass = type" is completely obscure. How would
> any non-expert have a clue what it means?

Holger asks:
> How would this non-expert have a clue what
> "from __future__ import new_style_classes" means?

Mon-expert users can safely assume that any "from __future__ import"
statements are there to future-proof a program or make use of advanced
features early. Non-expert users cannot safely assume anything about
assignments to __metaclass__ and, in fact, may well break into a cold
sweat any time they hear the word "metaclass".

I'm not saying that it's necessary, but if it were my call (and it isn't)
I'd probably not bother to code "from __future__ import new_style_classes"
but I'd probably accept a patch if someone wrote one. I think it would
provide a REALLY nice migration path if it were possible to write
Python 3.0 code in Python 2.x (for large values of x) so long as you
included an appropriate preamble of "from __future__ import" statements.
I don't believe we'll ever get it perfect because there would be a few
minor incompatibilities no matter how hard we try, but just imagine how
the Perl5 users today would feel if they were told that they could use
Perl6 code in the Perl5 interpreter by using the "@ .fture. <<" command.

I love making Perl users jealous, so I certainly wouldn't vote less than
-0 ("I don't care so why bother") on a proposal like this one.

-- Michael Chermside



More information about the Python-Dev mailing list