On 27/08/2019 18:07, Andrew Barnert via Python-ideas wrote:
On Aug 27, 2019, at 08:52, Steven D'Aprano<st...@pearwood.info>  wrote:
On Tue, Aug 27, 2019 at 05:24:19AM -0700, Andrew Barnert via Python-ideas wrote:

There is a possibility in between the two extremes of “useless” and
“complete monster”: the prefix accepts exactly one token, but can
parse that token however it wants.
How is that different from passing a string argument to a function or
class constructor that can parse that token however it wants?

    x'...'

    x('...')

Unless there is some significant difference between the two, what does
this proposal give us?
Before I get into this, let me ask you a question. What does the j suffix give 
us? You can write complex numbers without it just fine:

     c = complex
     c(1, 2)

And you can even write a j function trivially:

     def j(x): return complex(0, x)
     1 + j(2)

But would anyone ever write that when they can write it like this:

     1 + 2j

I don’t think so. What does the j suffix give us? The two extra keystrokes are 
trivial. The visual noise of the parens is a bigger deal. The real issue is 
that this matches the way we conceptually think of complex numbers, and the way 
we write them in other contexts. (Well, the way electrical engineers write 
them; most of the rest of us use i rather than j… but still, having to use j 
instead of i is less of an impediment to reading 1+2j than having to use 
function syntax like 1+i(2).

You make the point yourself: this is something we already understand from dealing with complex numbers in other circumstances. That is not true of generic single-character string prefixes.

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/BHSES2YDLYFFUYOSW753G3IC2C5OGVC2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to