Diez B. Roggisch [EMAIL PROTECTED] (DBR) wrote:
DBR So you can also do
DBR + some_object
DBR However,
DBR some_object +
DBR or
DBR 1 +
DBR don't work - the operator is only overloaded on the left argument.
There is no problem with 1+ neither with new Integer(1)+ in Java. Nor
any other
[EMAIL PROTECTED] schrieb:
Paddy:
Not really, it seems to me to be going the exact opposite way with
languages with automatic type conversions being seen as not suited for
larger programs.
In Java you can add the number 1 to a string, and have it
automatically converted to string before
[EMAIL PROTECTED] wrote:
In Java you can add the number 1 to a string, and have it
automatically converted to string before the string join... What do
you think of that feature?
-%s % 1
--
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
Frankly I have no feelings towards penguins
-Original Message-
From: [EMAIL PROTECTED] [mailto:python-
[EMAIL PROTECTED] On Behalf Of Steven D'Aprano
Sent: Saturday, January 05, 2008 7:01 PM
To: python-list@python.org
Subject: Re: dictionary/hash and '1' versus 1
The problem with automatic conversions between strings
On Jan 7, 5:09 pm, Reedick, Andrew [EMAIL PROTECTED] wrote:
Bingo. Perl has specific operators to establish intent:
Perl -e '1' + 1
2
Perl -e '1' . 1
11
'+' is the operator for addition
'.' is the operator for string concatenation
int and string
-Original Message-
From: [EMAIL PROTECTED] [mailto:python-
[EMAIL PROTECTED] On Behalf Of Paddy
Sent: Monday, January 07, 2008 12:52 PM
To: python-list@python.org
Subject: Re: dictionary/hash and '1' versus 1
Or how using different operators for similar operations on different
On Jan 7, 7:26 pm, Reedick, Andrew [EMAIL PROTECTED] wrote:
-Original Message-
From: [EMAIL PROTECTED] [mailto:python-
[EMAIL PROTECTED] On Behalf Of Paddy
Sent: Monday, January 07, 2008 12:52 PM
To: [EMAIL PROTECTED]
Subject: Re: dictionary/hash and '1' versus 1
Or how
On Jan 5, 11:07 pm, [EMAIL PROTECTED] wrote:
Paddy:
Not really, it seems to me to be going the exact opposite way with
languages with automatic type conversions being seen as not suited for
larger programs.
In Java you can add the number 1 to a string, and have it
automatically
On Jan 4, 3:50 pm, Reedick, Andrew [EMAIL PROTECTED] wrote:
From: Stephen Hansen [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 03, 2008 7:39 PM
To: Reedick, Andrew
Cc: [EMAIL PROTECTED]
Subject: Re: dictionary/hash and '1' versus 1
Well one important thing to learn while learning
Paddy:
Not really, it seems to me to be going the exact opposite way with
languages with automatic type conversions being seen as not suited for
larger programs.
In Java you can add the number 1 to a string, and have it
automatically converted to string before the string join... What do
you
On Sat, 05 Jan 2008 15:07:10 -0800, bearophileHUGS wrote:
Paddy:
Not really, it seems to me to be going the exact opposite way with
languages with automatic type conversions being seen as not suited for
larger programs.
In Java you can add the number 1 to a string, and have it
Reedick, Andrew wrote:
As a Perl monkey in the process of learning Python, I just stepped on
the '1' (string) is not the same as 1 (integer) in regards to keys for
dictionaries/hashes landmine.
This isn't a landmine; this is a _good_ thing. Python is strongly typed.
Is there a good way to
From: Stephen Hansen [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 03, 2008 7:39 PM
To: Reedick, Andrew
Cc: python-list@python.org
Subject: Re: dictionary/hash and '1' versus 1
Well one important thing to learn while learning Python is that while the
language is dynamically typed
A single integer is distinctly different from a sequence of characters
in
some encoding that may just happen to contain representations of a
number so they'll hash differently :)
Depends on the context. The machine encoding may be different, but
in human terms they should be
As a Perl monkey in the process of learning Python, I just stepped on
the '1' (string) is not the same as 1 (integer) in regards to keys for
dictionaries/hashes landmine. Is there a good way to ensure that
numbers represented as strings or ints do not get mixed up as keys?
Example of the
On Jan 4, 9:56 am, Reedick, Andrew [EMAIL PROTECTED] wrote:
As a Perl monkey in the process of learning Python, I just stepped on
the '1' (string) is not the same as 1 (integer) in regards to keys for
dictionaries/hashes landmine.
Congratulations. You have just stepped off the '1' (string) is
As a Perl monkey in the process of learning Python, I just stepped on
the '1' (string) is not the same as 1 (integer) in regards to keys for
dictionaries/hashes landmine. Is there a good way to ensure that
numbers represented as strings or ints do not get mixed up as keys?
Well one
On Thu, 03 Jan 2008 16:56:00 -0600, Reedick, Andrew wrote:
The problem occurred because a method used to generate keys was
returning a string instead of a number without an explicit conversion
taking place. And since I was using hash.get(i, default_value) to avoid
having to pair every key
18 matches
Mail list logo