A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-July/005762.html below:

[Python-Dev] Re: [I18n-sig] Unicode experience

[Python-Dev] Re: [I18n-sig] Unicode experienceKa-Ping Yee pingster@ilm.com
Fri, 7 Jul 2000 13:50:32 -0700 (PDT)
On Fri, 7 Jul 2000, Tim Peters wrote:
> > Are you sure?  This is the kind of error where you immediately see
> > what's wrong and move on to the next bug.
>
> It's certainly caught errors for me, and especially when introducing Perl
> programmers to Python, where "they expect" string+number to convert the
> string to a number, apparently the opposite of the arbitrary choice Paul
> prefers.

It's not arbitrary -- the decision is made according to the
type of the *operator* rather than the type of the operands.

    anything + anything returns a number
    anything . anything returns a string

So "34"+0 converts to a number and 34."" converts to a string
(i've seen both idioms fairly often).

Anyway, i still agree that it's best to avoid automatic coercion
between numbers and strings -- since it's now very easy to say
int("3") as opposed to import string; string.atoi("3"), there's
really no excuse for not being explicit.


-- ?!ng

"Things are more like they are now than they ever were before."
    -- Dwight D. Eisenhower




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4