We noticed recently that:
None in 'foo'
raises (at least in Python 2.7)
TypeError: 'in string' requires string as left operand, not NoneType
This is surprising. The description of the 'in' operatator is, 'True if an
item of s is equal to x, else False '. From that, I would assume it
On Mon, Jun 9, 2014 at 10:34 AM, Roy Smith r...@panix.com wrote:
We noticed recently that:
None in 'foo'
raises (at least in Python 2.7)
TypeError: 'in string' requires string as left operand, not NoneType
This is surprising.
It's the same in 3.4, and I agree that it's surprising, at
On Mon, Jun 9, 2014 at 9:34 AM, Roy Smith r...@panix.com wrote:
We noticed recently that:
None in 'foo'
raises (at least in Python 2.7)
TypeError: 'in string' requires string as left operand, not NoneType
This is surprising. The description of the 'in' operatator is, 'True if an
item
Hello,
On Mon, 9 Jun 2014 08:34:42 -0700 (PDT)
Roy Smith r...@panix.com wrote:
We noticed recently that:
None in 'foo'
raises (at least in Python 2.7)
TypeError: 'in string' requires string as left operand, not NoneType
This is surprising. The description of the 'in' operatator
On 2014-06-09 16:34, Roy Smith wrote:
We noticed recently that:
None in 'foo'
raises (at least in Python 2.7)
TypeError: 'in string' requires string as left operand, not NoneType
This is surprising. The description of the 'in' operatator is, 'True if an
item of s is equal to x, else
On Mon, 09 Jun 2014 08:34:42 -0700, Roy Smith wrote:
We noticed recently that:
None in 'foo'
raises (at least in Python 2.7)
That goes back to at least Python 1.5, when member tests only accepted a
single character, not a substring:
None in abc
Traceback (innermost last):
File
2014-06-09 23:34 GMT+08:00 Roy Smith r...@panix.com:
We noticed recently that:
None in 'foo'
raises (at least in Python 2.7)
TypeError: 'in string' requires string as left operand, not NoneType
This is surprising. The description of the 'in' operatator is, 'True if
an item of s is
On Mon, 09 Jun 2014 18:57:28 +0300, Paul Sokolovsky wrote:
Hello,
On Mon, 9 Jun 2014 08:34:42 -0700 (PDT) Roy Smith r...@panix.com wrote:
We noticed recently that:
None in 'foo'
raises (at least in Python 2.7)
TypeError: 'in string' requires string as left operand, not NoneType
On Tue, Jun 10, 2014 at 2:14 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
This is very Pythonic, Python is strictly typed language. There's no way
None could possibly be inside a string,
Then `None in some_string` could immediately return False, instead of
raising an
On Jun 9, 2014, at 11:57 AM, Paul Sokolovsky wrote:
This is very Pythonic, Python is strictly typed language. There's no
way None could possibly be inside a string, so if you're trying to
look for it there, you're doing something wrong, and told so.
Well, the code we've got is:
On Tue, Jun 10, 2014 at 2:53 AM, Roy Smith r...@panix.com wrote:
In retrospect, I suspect:
hourly_data = [(t if status in set('CSRP') else None) for (t,
status) in hours]
is a little cleaner.
I'd go with this. It's clearer that a status of 'SR' should result in
False, not True.
On Mon, Jun 9, 2014 at 10:59 AM, Chris Angelico ros...@gmail.com wrote:
On Tue, Jun 10, 2014 at 2:53 AM, Roy Smith r...@panix.com wrote:
In retrospect, I suspect:
hourly_data = [(t if status in set('CSRP') else None) for (t,
status) in hours]
is a little cleaner.
I'd go with
On Tue, Jun 10, 2014 at 3:22 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Jun 9, 2014 at 10:59 AM, Chris Angelico ros...@gmail.com wrote:
On Tue, Jun 10, 2014 at 2:53 AM, Roy Smith r...@panix.com wrote:
In retrospect, I suspect:
hourly_data = [(t if status in set('CSRP') else
On Mon, Jun 9, 2014 at 11:40 AM, Chris Angelico ros...@gmail.com wrote:
Also, this is the first time I've seen None as a constant other than
the first. Usually co_consts[0] is None, but this time co_consts[4] is
None.
Functions always seem to have None as the first constant, but modules
and
On Tue, Jun 10, 2014 at 3:58 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Jun 9, 2014 at 11:40 AM, Chris Angelico ros...@gmail.com wrote:
Also, this is the first time I've seen None as a constant other than
the first. Usually co_consts[0] is None, but this time co_consts[4] is
None.
15 matches
Mail list logo