[Python-ideas] Match statement brainstorm

Michael Selik michael.selik at gmail.com
Mon May 30 05:07:37 EDT 2016


On Sun, May 29, 2016 at 7:00 PM Greg Ewing <greg.ewing at canterbury.ac.nz>
wrote:

> Franklin? Lee wrote:
> > On May 28, 2016 4:48 AM, "Greg Ewing" <greg.ewing at canterbury.ac.nz
> > <mailto:greg.ewing at canterbury.ac.nz>> wrote:
> >  >
> >  > No, keyword pattern args should probably match either
> >  > keyword constructor args or attributes.
> >
> > That would make things ambiguous and tricky, wouldn't it?
>
> My feeling is that for any well-designed object they
> should be compatible. If an object has a constructor
> keyword arg and an attribute with the same name but
> they mean different things, that object is confusing
> to begin with.
>

What about Fraction -- it has ``numerator`` and ``denominator`` for keyword
arguments, but also has an extra stuff like ``real`` and ``imag`` inherited
from Complex?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160530/27365479/attachment.html>


More information about the Python-ideas mailing list