[Python-ideas] A different kind of context manager

Guido van Rossum guido at python.org
Thu Oct 24 17:26:15 CEST 2013


On Thu, Oct 24, 2013 at 3:36 AM, Kristján Valur Jónsson <
kristjan at ccpgames.com> wrote:

>
>
> > -----Original Message-----
> > From: Python-ideas [mailto:python-ideas-
> > bounces+kristjan=ccpgames.com at python.org] On Behalf Of Masklinn
> > Sent: 23. október 2013 15:17
> > To: python-ideas ideas
> > Subject: Re: [Python-ideas] A different kind of context manager
> > > (CS buffs out there will likely point out to me that this was not an
> original
> > Matz invention).
> >
> > You don't need CS buffs to point it out, it was an implementation detail
> > leaking into semantic incompatibility between types implemented in C and
> > classes implemented in Python:
> > http://python-history.blogspot.be/2010/06/new-style-classes.html
> >
> > Python was fairly unique in having this dichotomy between built-in and
> user-
> > defined types[0].
> >
> > [0] but not anymore, Go has repeated this mistake, amongst others.
>
> That's not what I was referring to, rather the class model that blew my
> mind when learing Ruby back in 2000.  I'm not a CS, so this was new to me
> (knowing OOP only from C++):
> - Classes, metaclasses, methor resolution order.
> - All classes are subclasses of "object"
> - object itself is an instance of "type",  type being a "metaclass".
> - type, too, is a subclass of object.  Type is its own metaclass, so
> "type" is an instance of "type".
>
> Ruby was designed with this model in mind, it only arrived later into
> Python.
>

 Are you sure? I wrote about metaclasses in Python in 1998:
http://www.python.org/doc/essays/metaclasses/

New-style classes were just the second or third iteration of the idea.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131024/e35cce24/attachment.html>


More information about the Python-ideas mailing list