Re: From D



On Wed, 25 Jul 2007 10:22:46 -0700, mensanator@xxxxxxx wrote:

On Jul 24, 6:08 pm, Steven D'Aprano
<st...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
On Tue, 24 Jul 2007 20:09:00 +0200, Bjoern Schliessmann wrote:
Stargaming wrote:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:

While in a syntax like:
for i in xrange(1_000_000):
my eyes help me group them at once.

Sounds like a good thing to be but the arbitrary positioning
doesnt make any sense.

Checking underscore positions would only add complexity. Why not
just ignore them, no matter where they are?

Underscores in numerics are UGLY. Why not take a leaf out of implicit
string concatenation and allow numeric literals to implicitly concatenate?

Python already does:
"hello-" "world" => "hello-world"

Propose:
123 456 789 => 123456789
123.456 789 => 123.456789

So, spaces will no longer be delimiters? Won't that cause
much wailing and gnashing of teeth?


Did you miss the bit where Python ALREADY does this for strings?

Yes, whitespace will still delimit tokens. No, it won't be a problem,
because two int tokens can be "concatenated" to make a single int token,
exactly as happens for strings.

(I say "no problem", but of course I don't know how much _actual_ coding
effort will be needed to Make This Work. It might be a little, it might be
a lot.)

Currently, 234 567 is a syntax error in Python, so there are no problems
with backward compatibility or breaking code that relies on the meaning of
whitespace between two ints.


--
Steven

.



Relevant Pages

  • Re: Unexpected string behaviour: txt = this works
    ... So in Python it saves you to use + at the cost of possible bugs. ... I've used this feature in C and Python when I want to wrap strings ... with a set of parenthesis to make the concatenation explicit. ... It does do a minor optimization in Python and most C compilers. ...
    (comp.lang.python)
  • Re: Why tuple with one item is no tuple
    ... > Antoon> for concatenation, even if only on strings. ... Suppose python would have used '#" to express ...
    (comp.lang.python)
  • Re: UTF-8 / German, Scandinavian letters - is it really this difficult?? Linux & Windows XP
    ... For string literals, with the "coding" declaration, Python will accept ... "coding" declaration to produce a Unicode object which unambiguously ... represents the sequence of characters - ie. something that can be ... > strings and/or gibberished characters in Tk GUI title? ...
    (comp.lang.python)
  • Re: A Python newbie ask a simple question
    ... the first character in the user supplied response as strings support ... What is the good book to learn Python? ... and having checked out some of the tutorials so you know ... using the Help Index again with "sequence" (since you will probably ...
    (comp.lang.python)
  • Re: string concatenation optimizations [from python-dev Summary]
    ... Essentially what I have in mind is a type that's a list of byte ... The value is defined as the concatenation of these arrays. ... > way to concatenate a bunch of strings. ...
    (comp.lang.python)