[Numpy-discussion] except expression discussion on python-ideas
Benjamin Root
ben.root at ou.edu
Wed Feb 19 09:25:18 EST 2014
So, this is kind of like Perl's "unless"?
On Tue, Feb 18, 2014 at 10:18 PM, Alexander Belopolsky <ndarray at mac.com>wrote:
> I would like to invite numpy community to weigh in on the idea that is
> getting momentum at
>
> https://mail.python.org/pipermail/python-ideas/2014-February/025437.html
>
> The main motivation is to provide syntactic alternative to proliferation
> of default value options, so that
>
> x = getattr(u, 'answer', 42)
>
> can be written as
>
> x = y.answer except ... 42
>
> For a dictionary d,
>
> x = d.get('answer', 42)
>
> can be written as
>
> x = d['answer'] except ... 42
>
> For a list L,
>
> try:
> x = L[i]
> except IndexError:
> x= 42
>
> can be written as
>
> x = L[i] except ... 42
>
>
> The ellipsis in the above stands for syntax being debated.
>
> Effectively, Python is about to gain support for a new operator and
> operators are very precious for numpy. So, I think numpy community has a
> horse in that race.
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140219/a0e30320/attachment.html>
More information about the NumPy-Discussion
mailing list