Fwd: Partial function application 'from the right'
Begin forwarded message:
From: Ludvig Ericson <ludvig@lericson.se> Date: January 31, 2009 16:43:50 GMT+01:00 To: Alexander Belopolsky <alexander.belopolsky@gmail.com> Subject: Re: [Python-Dev] Partial function application 'from the right'
On Jan 31, 2009, at 04:02, Alexander Belopolsky wrote:
On Fri, Jan 30, 2009 at 7:42 PM, Antoine Pitrou <solipsis@pitrou.net> wrote: ..
If one writes X = partial.skip, it looks quite nice:
split_one = partial(str.split, X, 1)
Or even
_ = partial.skip split_one = partial(str.split, _, 1)
Or even
… = partial.skip split_one = partial(str.split, …, 1)
Ludvig Ericson wrote:
Begin forwarded message:
From: Ludvig Ericson <ludvig@lericson.se> Or even
… = partial.skip split_one = partial(str.split, …, 1)
That won't work:
... = 1 File "<stdin>", line 1 SyntaxError: can't assign to Ellipsis
Like None/True/False, "..." is a constant that can't be modified (you can assign to the *name* Ellipsis, but the "..." syntax will always refer to the specific object). Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia ---------------------------------------------------------------
Nick Coghlan wrote:
That won't work:
... = 1 File "<stdin>", line 1 SyntaxError: can't assign to Ellipsis
Well, I was trying to be funny and was under the impression that Python 3.0 had Unicode identifiers, but apparently it doesn't. (I used …, not ...) - Ludvig
Ludvig Ericson wrote:
Well, I was trying to be funny and was under the impression that Python 3.0 had Unicode identifiers, but apparently it doesn't. (I used …, not ...)
It does, but they may not contain characters of the category "Punctuation, other":
import unicodedata unicodedata.category("…") 'Po'
- Hagen
participants (3)
-
Hagen Fürstenau
-
Ludvig Ericson
-
Nick Coghlan