Python should not expect characters that are hard for most people to
type.
Python should not expect characters that are still hard to
display on many common platforms.
I think you'll find strong opposition to adding any non-ASCII
characters or characters that don't occur on almost all keyboards as
part of the language.
Mike
Is anything gained from this addition?
> _______________________________________________
> Python-ideas mailing list
> Python...@python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
2012/10/12 Ram Rachum <ram.r...@gmail.com>:What do you think?It's maybe time to implement http://python.org/dev/peps/pep-3117/
25 or so years ago, I used to do some programming in Apple's Hypertalk
language, which accepted ÷ in place of / for division. The use of two
symbols for the same operation didn't cause any problem for users. But then
Apple had the advantage that there was a single, system-wide, highly
discoverable way of typing non-ASCII characters at the keyboard, and Apple
users tended to pride themselves for using them.
I'm not entirely sure about MIDDLE DOT though: especially in small font sizes,
it falls foul of the design principle:
"syntax should not look like a speck of dust on Tim's monitor"
(paraphrasing... can anyone locate the original quote?)
and may be too easily confused with FULL STOP. Another problem is that MIDDLE
DOT is currently valid in identifiers, so that a·b would count as a single
name. Fixing this would require some fairly heavy lifting (a period of
deprecation and warnings for any identifier using MIDDLE DOT) before
introducing it as an operator. So that's a lot of effort for very little gain.
If I were designing a language from scratch today, with full Unicode support
from the beginning, I would support a rich set of operators possibly even
including MIDDLE DOT and × MULTIPLICATION SIGN, and leave it up to the user
to use them wisely or not at all. But I don't think it would be appropriate
for Python to add them, at least not before Python 4: too much effort for too
little gain. Maybe in another ten years people will be less resistant to
Unicode operators.
[...]
> ·. People on Linux can type Alt-. .
For what it is worth, I'm using Linux and that does not work for me. I am
yet to find a decent method of entering non-ASCII characters.
--
Steven
On 13/10/12 07:27, Ram Rachum wrote:
Hi everybody,
Today a funny thought occurred to me. Ever since I've learned to program
when I was a child, I've taken for granted that when programming, the sign
used for multiplication is *. But now that I think about it, why? Now that
we have Unicode, why not use · ?
t
Python has cleverly left the $ symbol unused.
We can use it as a quasiquote to embed executable TeX.
for x in xrange($b \cdot \sum_{i=1}^n \frac{x^n}{n!}$):
...
No need to wait for that new language, we can have a rich set of math
operators today!
-- Devin
On Oct 13, 2012 6:45 AM, "Devin Jeanpierre" <jeanpi...@gmail.com> wrote:
>
> On Fri, Oct 12, 2012 at 10:41 PM, Steven D'Aprano <st...@pearwood.info> wrote:
> > If I were designing a language from scratch today, with full Unicode support
> > from the beginning, I would support a rich set of operators possibly even
> > including MIDDLE DOT and × MULTIPLICATION SIGN, and leave it up to the user
> > to use them wisely or not at all. But I don't think it would be appropriate
> > for Python to add them, at least not before Python 4: too much effort for
> > too
> > little gain. Maybe in another ten years people will be less resistant to
> > Unicode operators.
>
> Python has cleverly left the $ symbol unused.
>
> We can use it as a quasiquote to embed executable TeX.
>
> for x in xrange($b \cdot \sum_{i=1}^n \frac{x^n}{n!}$):
> ...
>
I hope this was in jest because that line of TeX for general programming made my eyes bleed.
A PEP for defining operators sounds interesting for 4.0 indeed. Though it might be messy to allow a module to meddle with the python syntax.
Perhaps instead I would like it if all operators were objects with e.g. special __infix__ methods.
Yuval
But they are a different operators.
(1, 2, 3)·(6, 5, 4) = 28
(1, 2, 3)×(6, 5, 4) = (-7, 14, -7)
but I think that puts the emphasis on the wrong thing. If (and that's a big
if) we did something like this, it should be a pair of methods __op__ and
the right-hand version __rop__ which get called on the *operands*, not the
operator/function object:
def __op__(self, other, symbol)
Because it looks astonishingly like ".". Reason enough to avoid it
altogether, for any purpose, in a language that uses "." quite a like,
as Python does.
A big -100 from me.
Besides, "*" works well and has a long history as multiplication in many
languages. This isn't broken.
As a child, I was taught "x" (that's intened as a small cross diagonally
oriented, not the letter I've used here) for multiplication. Let's
support that too! It also looks like another character (specifically, a
lot like the letter "x").
Seriously, I think this is a bad idea on a readability/usability basis,
and an unnecessary idea from a functional point of view - it adds noting
not already there and mucks with the "one obvious way to do it" notion
into the bargain.
Cheers,
--
Cameron Simpson <c...@zip.com.au>
Climber: "I don't know, I can't see the next bolt."
Belayer: "Remember X, when in doubt, run it out."
This should be read with a good Birmingham accent, something like "Remember
'oids, win in dowt, roon it owt"
>>> (2 *dot* "__mul__" |mappedover| 10-to-25) >> tolist
[20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48]
>>> list(map((2).__mul__, range(10, 25)))
[20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48]
>>> map((2).__mul__, 10-to-25) >> tolist
[20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48]
>>> @Inline
... def multiply(x, y): return x*y
...
>>> 3 ^multiply^ 3
9
>>> 1 |div| 3 |div| 3
0.1111111111111111
>>> 1 |div| 3 *div* 3
1.0
>>> 2 |(div|3)
0.6666666666666666
>>> (div|3)(2)
0.6666666666666666
>>> (div|(div|3))(3) # Go on, guess why!
1.0
>>> 2 + (div|3) # 'Cause you can, yo
0.6666666666666666
Den 13. okt. 2012 kl. 06:44 skrev Devin Jeanpierre <jeanpi...@gmail.com>:
LOL :D
>
> Python has cleverly left the $ symbol unused.
>
> We can use it as a quasiquote to embed executable TeX.
>
> for x in xrange($b \cdot \sum_{i=1}^n \frac{x^n}{n!}$):
> ...
>
> No need to wait for that new language, we can have a rich set of math
> operators today!
>
But hey, this is valid Python :D :D
for x in texrange(r"$b \cdot \sum_{i=1}^n \frac{x^n}{n!}$"): pass
import texcode
texcode.texecute("""
\eq{y}{\range{1}{10}}
\for{x}{y}{
\print{x}
}
""") # Alas, the joy has to end
I am glad someone else shares the same progressive attitude. I, personally, wrap my whole code like so:import texcodetexcode.texecute("""
\eq{y}{\range{1}{10}}
\for{x}{y}{
\print{x}
}
""") # Alas, the joy has to endWhich has tremendously improved the quality of my output.Recently, rendering my code, too, has sped up to a remarkable 3 pages-per-minute!
On related news: The source code of the APL complier (interpreter?) was released.
http://www.osnews.com/story/26464/The_APL_programming_language_source_code
I'm still baffled that this programming language was ever in production use.
> Seriously: learning that * means multiplication is a very small thing. You also need to learn what
> /, // and % do, and the difference between 'and' and &, and between =, ==, != and /=.
>
> --- Bruce
>
>
>
> On Fri, Oct 12, 2012 at 7:41 PM, Steven D'Aprano <st...@pearwood.info <mailto:st...@pearwood.info>>
> _________________________________________________
> Python-ideas mailing list
> Python...@python.org <mailto:Python...@python.org>
> http://mail.python.org/__mailman/listinfo/python-ideas
> <http://mail.python.org/mailman/listinfo/python-ideas>
On 10/12/2012 10:27 PM, Ram Rachum wrote:I use Linux (KDE4). When I press Alt-. in kwrite I simply get . in gvim I get ® and here in Thunderbird I get nothing. So I don't think this is very practical.
Hi everybody,
Today a funny thought occurred to me. Ever since I've learned to program when I was a child, I've
taken for granted that when programming, the sign used for multiplication is *. But now that I think
about it, why? Now that we have Unicode, why not use · ?
Do you think that we can make Python support · in addition to *?
I can think of a couple of problems, but none of them seem like deal-breakers:
- Backward compatibility: Python already uses *, but I don't see a backward compatibility problem
with supporting · additionally. Let people use whichever they want, like spaces and tabs.
- Input methods: I personally use an IDE that could be easily set to automatically convert * to ·
where appropriate and to allow manual input of ·. People on Linux can type Alt-. .
With Alt Gr I always get …
Ah, Alt Gr-, produces · (German keyboard here, of course.)
If it's more than one codepoint, we could prefix with the length of the
codepoint's name:
def __12CIRCLED_PLUS__(x, y):
...
Yes, but we're defining an operator for instances of the class, so itOn Sun, 14 Oct 2012 07:40:57 +0200
Yuval Greenfield <ubers...@gmail.com> wrote:
> On Sun, Oct 14, 2012 at 2:04 AM, MRAB <pyt...@mrabarnett.plus.com> wrote:
>
> > If it's more than one codepoint, we could prefix with the length of the
> > codepoint's name:
> >
> > def __12CIRCLED_PLUS__(x, y):
> > ...
> >
> >
> That's a bit impractical, and why reinvent the wheel? I'd much rather:
>
> def \u2295(x, y):
> ....
>
> So readable I want to read it twice. And that's not legal python today so
> we don't break backwards compatibility!
needs the 'special' method marking:
def __\u2295__(self, other):
Now *that's* pretty!
<mike
Consider what would happen if you wanted to write "\\u0190". It would
convert that into "\Ɛ".
IIRC, Java can suffer from that kind of problem because \uXXXX is
treated as that codepoint wherever it occurs.
On 2012-10-14 22:06, Joshua Landau wrote:
On 14 October 2012 20:57, Mike Meyer <m...@mired.org<mailto:m...@mired.org>> wrote:
On Sun, 14 Oct 2012 07:40:57 +0200
Yuval Greenfield <ubers...@gmail.com<mailto:ubers...@gmail.com>> wrote:
> On Sun, Oct 14, 2012 at 2:04 AM, MRAB <pyt...@mrabarnett.plus.com
OK, but what about raw string literals? Currently, "\\u0190" ==
r"\u0190", but "\\u0190" != r"Ɛ".
On 2012-10-15 01:12, Joshua Landau wrote:
On 15 October 2012 00:46, MRAB <pyt...@mrabarnett.plus.com
<mailto:python@mrabarnett.plus.com>> wrote:
OK, but what about raw string literals? Currently, "\\u0190" ==
r"\u0190", but "\\u0190" != r"Ɛ".
The “r"” prefix escapes all escapes, so will escape this escape too.
Hence, this behaviour is un...escaped ;).
If "\u0190" becomes "Ɛ", what happens to "\u000A"? Currently it's
legal. :-)