On 23/07/18 19:21, David Mertz wrote:
On Mon, Jul 23, 2018 at 2:12 PM Rhodri James <rho...@kynesim.co.uk> wrote:

How are you supposed to do method calling, the equivalent of
"foo?.bar()" ?  "NoneAware(foo).bar.unbox()()" looks downright weird.
Is there more magic in NoneAware to cover this case?  (Not that I think
we should be encouraging people to do this, but...)


Is there more magic? I don't know, and I don't really care that much.
That's the point.  This is just a plain old Python class that will work
back to probably Python 1.4 or so.  If you want to write a version that has
just the right amount of magic, you are free to.

I care only in as much as you were proposing an incomplete solution (in my eyes at least). I'm pretty convinced by now I would never use it.

In my opinion, the need at issue is worthwhile, but niche.  Using a special
class to deal with such a case is absolutely the right level of
abstraction.  Syntax is not! So sure, figure out how to tweak the API to be
most useful, find a better name for the class, etc.

I think part of my point was that a special class is not as readable or trap-free as writing the conditions out explicitly, given the unexpected "boxed" results, which makes me question whether the issue *is* worthwhile.

I wouldn't think it terrible if a class like this (but better) found a home
in the standard library, but it doesn't deserve more prominence than that.
Not even builtins, and *definitely* not syntax.

I think I might find it terrible.

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to