Terry Reedy wrote:
What immutability has to do with identity is that 'two' immutable
objects with the same value *may* actually be the same object,
*depending on the particular version of a particular implementation*.
t1 = (1,2,3) # an immutable object
t2 = (1,2,3) # another immutable objec
Paul Rudin writes:
> Falcolas writes:
>
> > [s.strip() for s in hosts if s.strip()]
>
> There's something in me that rebels against seeing the same call
> twice.
Agreed. I'd probably use:
>>> lines = ["foo", " ", " bar ", "", "baz"]
>>> [s for s in (s.strip() for s in lines) if s]
Falcolas writes:
> [s.strip() for s in hosts if s.strip()]
There's something in me that rebels against seeing the same call
twice. I'd probably write:
filter(None, (s.strip() for s in hosts))
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Nov 2, 2009 at 10:11 PM, Aahz wrote:
> In article
> <7589e0a1-98b2-4df4-bc76-5d4c10194...@f20g2000prn.googlegroups.com>,
> Falcolas wrote:
>>
>>I'd also recommend trying the following filter, since it is identical
>>to what you're trying to do, and will probably catch some additional
>>
In article <7589e0a1-98b2-4df4-bc76-5d4c10194...@f20g2000prn.googlegroups.com>,
Falcolas wrote:
>
>I'd also recommend trying the following filter, since it is identical
>to what you're trying to do, and will probably catch some additional
>edge cases without any additional effort from you.
>
>[s.
Steven D'Aprano wrote:
> (6) Metaphoric equivalence:
> Kali is death.
> Life is like a box of chocolates.
OK to here, but this one switches between metaphor and simile, and arguably,
between identity and equality.
Mel.
--
http://mail.python.org/mailman/listinfo/python-list
>
> There are an infinite number of empty sets
> that differ according to their construction:
>
> The set of all fire-breathing mammals.
>
Apparently, you have never been a witness
to someone who recently ingested one of
Cousin Chuy's Super-Burritos .. :-)
--
Stan
Steven D'Aprano wrote:
> On Sun, 01 Nov 2009 21:32:15 +0100, Mick Krippendorf wrote:
>>
>> (Ax)(x is a fire-breathing animal <-> x is a real number equal to
>> sqrt(-1)).
>>
>> And since there are neither such things, it follows that s1 = s2.
>
> That assumes that all({}) is defined as true. That
On Sun, 01 Nov 2009 21:32:15 +0100, Mick Krippendorf wrote:
> When we want find out if two sets s1 and s2 are the same we only need to
> look at their extensions, so given:
>
> (i s1)(Ay)(y e s1 <-> y is a fire-breathing animal) (i s2)(Ay)(y e s2
> <-> y is a real number equal to sqrt(-1))
>
Steven D'Aprano wrote:
> There are an infinite number of empty sets that differ according to their
> construction:
>
> The set of all American Presidents called Boris Nogoodnik.
> The set of all human languages with exactly one noun and one verb.
> The set of all fire-breathing mammals.
> The set
On Sat, 31 Oct 2009 14:12:40 -0400, Terry Reedy wrote:
> alex23 wrote:
>> Terry Reedy wrote:
>>> alex23 wrote:
You're completely wrong. Immutability has nothing to do with
identity,
> ...
> > I'm honestly not getting your point here.
>
> Let me try again, a bit differently.
>
> I cla
alex23 wrote:
Terry Reedy wrote:
alex23 wrote:
You're completely wrong. Immutability has nothing to do with identity,
...
> I'm honestly not getting your point here.
Let me try again, a bit differently.
I claim that the second statement, and therefor the first, can be seen
as wrong. I also
Terry Reedy wrote:
> alex23 wrote:
> > You're completely wrong. Immutability has nothing to do with identity,
> > which is what 'is' is testing for:
>
> What immutability has to do with identity is that 'two' immutable
> objects with the same value *may* actually be the same object,
> *depending o
(Please preserve attribution lines when you quote someone, so we can
keep track of who said what in the developing discussion.)
Nick Stinemates writes:
> > Some objects are singletons, ie there's only ever one of them. The
> > most common singleton is None. In virtually every other case you
> >
alex23 wrote:
On Oct 30, 1:10 pm, Nick Stinemates wrote:
Some objects are singletons, ie there's only ever one of them. The most
common singleton is None. In virtually every other case you should be
using "==" and "!=".
Please correct me if I am wrong, but I believe you meant to say some
objec
On Thu, 29 Oct 2009 23:10:39 -0400, Nick Stinemates wrote:
>> Some objects are singletons, ie there's only ever one of them. The most
>> common singleton is None. In virtually every other case you should be
>> using "==" and "!=".
>
> Please correct me if I am wrong, but I believe you meant to sa
On Oct 30, 1:10 pm, Nick Stinemates wrote:
> > Some objects are singletons, ie there's only ever one of them. The most
> > common singleton is None. In virtually every other case you should be
> > using "==" and "!=".
>
> Please correct me if I am wrong, but I believe you meant to say some
> objec
> Some objects are singletons, ie there's only ever one of them. The most
> common singleton is None. In virtually every other case you should be
> using "==" and "!=".
Please correct me if I am wrong, but I believe you meant to say some
objects are immutable, in which case you would be correct.
mk a écrit :
Hello everyone,
print hosts
['9.156.44.227\n', '9.156.46.34 \n', '\n']
Just for the record, where did you get this "hosts" list from ? (hint :
depending on the answer, there might be a way to avoid having to filter
out the list)
--
http://mail.python.org/mailman/listinfo/py
Falcolas a écrit :
(snip)
>
I'd also recommend trying the following filter, since it is identical
to what you're trying to do, and will probably catch some additional
edge cases without any additional effort from you.
[s.strip() for s in hosts if s.strip()]
The problem with this expression is
On Oct 29, 9:31 am, "Diez B. Roggisch" wrote:
> mk wrote:
> > Hello everyone,
>
> > print hosts
> > hosts = [ s.strip() for s in hosts if s is not '' and s is not None and
> > s is not '\n' ]
> > print hosts
>
> > ['9.156.44.227\n', '9.156.46.34 \n', '\n']
> > ['9.156.44.227', '9.156.46.34', '']
>
Diez B. Roggisch wrote:
mk wrote:
Hello everyone,
print hosts
hosts = [ s.strip() for s in hosts if s is not '' and s is not None and
s is not '\n' ]
print hosts
['9.156.44.227\n', '9.156.46.34 \n', '\n']
['9.156.44.227', '9.156.46.34', '']
Why does the hosts list after list comprehension st
mk wrote:
> Hello everyone,
>
> print hosts
> hosts = [ s.strip() for s in hosts if s is not '' and s is not None and
> s is not '\n' ]
> print hosts
>
> ['9.156.44.227\n', '9.156.46.34 \n', '\n']
> ['9.156.44.227', '9.156.46.34', '']
>
> Why does the hosts list after list comprehension still c
mk wrote:
Hello everyone,
print hosts
hosts = [ s.strip() for s in hosts if s is not '' and s is not None
and s is not '\n' ]
print hosts
['9.156.44.227\n', '9.156.46.34 \n', '\n']
['9.156.44.227', '9.156.46.34', '']
Why does the hosts list after list comprehension still contain '' in
last
Hello everyone,
print hosts
hosts = [ s.strip() for s in hosts if s is not '' and s is not None and
s is not '\n' ]
print hosts
['9.156.44.227\n', '9.156.46.34 \n', '\n']
['9.156.44.227', '9.156.46.34', '']
Why does the hosts list after list comprehension still contain '' in
last position?
25 matches
Mail list logo