On Sun, Jun 16, 2013 at 7:52 AM, Jim Mooney wrote:
> On 15 June 2013 22:32, Steven D'Aprano wrote:
>> http://mail.python.org/pipermail/python-list/2013-June/649710.html
>
> A succinct list - worth putting in my Keep file ;')
>
> -
> Jim
> After indictment the bacon smuggler was put on the no-fry
On Sat, Jun 15, 2013 at 11:15 PM, Jim Mooney wrote:
>
> ## Comparing different types for equality always fails:
>
> if '5' != 5:
> print('oops')
It depends on the __eq__ and __ne__ methods defined by the types. int
and str have their own implementations of "rich comparisons". But
that's a sub
On Sat, Jun 15, 2013 at 11:53 PM, Jim Mooney wrote:
>
> class NobodyHome: pass
> x = NobodyHome()
> print(not x) # Result is False when I thought this would be True.
Quote:
>> If neither __bool__ nor __len__ is defined, the object defaults to being
>> truthy:
>>
>> >>> not not object()
>>
On 15 June 2013 22:32, Steven D'Aprano wrote:
> http://mail.python.org/pipermail/python-list/2013-June/649710.html
A succinct list - worth putting in my Keep file ;')
-
Jim
After indictment the bacon smuggler was put on the no-fry list
___
Tutor mailli
On 16/06/13 12:31, Joel Goldstick wrote:
On Sat, Jun 15, 2013 at 10:21 PM, Jim Mooney wrote:
On 15 June 2013 19:03, Dave Angel wrote:
Why such a convoluted way of expressing yourself?
I was demonstrating the parallelism, but let's just take one so I can
unbefuddle meself ;')
*** Python 3.3
On 16/06/13 13:15, Jim Mooney wrote:
## Comparing different types for equality always fails:
if '5' != 5:
print('oops')
Not always. Counter-examples are most obvious when it comes to numbers:
py> from decimal import Decimal
py> from fractions import Fraction
py> Fraction(1, 2) == Decima
On 16/06/13 11:30, Jim Mooney wrote:
##This is puzzling me. If I check the equality of 0, None, empty
string, and empty list with False,
##only zero satisfies the equality. But if I use them in a not
statement, they all turn out False.
##What gives?
That's because the tests do different things
On 15 June 2013 21:41, Dave Angel wrote:
class NobodyHome:
> ... def __bool__(self):
> ... return False #normally, you'd be testing some attribute to
> decide this
>
> ...
x = NobodyHome()
not x
> True
>
That's a breath of fresh air - talk about freedom ;') Makes me
On 06/15/2013 11:53 PM, Jim Mooney wrote:
On 15 June 2013 20:48, Joel Goldstick wrote:
One and zero for True and False may seem not quite right today,
I still think they should be taken out and shot ;')
But my simplification plan failed. Equality always fails for different
types, and 'not i
On 15 June 2013 20:48, Joel Goldstick wrote:
>
> One and zero for True and False may seem not quite right today, but digital
> computers are based on the fact that circuits can be built that have two
> states -- on/off or true/false, or 1/0.
But then, if we're going down to the gate level, why no
On 15 June 2013 20:48, Joel Goldstick wrote:
> One and zero for True and False may seem not quite right today,
I still think they should be taken out and shot ;')
But my simplification plan failed. Equality always fails for different
types, and 'not in front of None or any empty object such as
On Sat, Jun 15, 2013 at 11:15 PM, Jim Mooney wrote:
> On 15 June 2013 19:45, eryksun wrote:
> > On Sat, Jun 15, 2013 at 10:23 PM, eryksun wrote:
> >> This function is hard coded for the singletons True,
> >> False, and None -- and otherwise uses either __bool__
> >> (tp_as_number->nb_bool) or __
On 15 June 2013 19:45, eryksun wrote:
> On Sat, Jun 15, 2013 at 10:23 PM, eryksun wrote:
>> This function is hard coded for the singletons True,
>> False, and None -- and otherwise uses either __bool__
>> (tp_as_number->nb_bool) or __len__ (tp_as_mapping->mp_length or
>> tp_as_sequence->sq_length
On Sat, Jun 15, 2013 at 10:23 PM, eryksun wrote:
> This function is hard coded for the singletons True,
> False, and None -- and otherwise uses either __bool__
> (tp_as_number->nb_bool) or __len__ (tp_as_mapping->mp_length or
> tp_as_sequence->sq_length). A length of 0 is falsey.
I forgot to add
On 15 June 2013 19:28, Dave Angel wrote:
> If you want to compare a non-boolean to False or True, expect it'll always
> be false. They are different types. (except for the int historical
> nonsense I mentioned earlier).
Ah, that clarifies it - type differences - something I can look out
for -
On Sat, Jun 15, 2013 at 10:21 PM, Jim Mooney wrote:
> On 15 June 2013 19:03, Dave Angel wrote:
> > Why such a convoluted way of expressing yourself?
>
> I was demonstrating the parallelism, but let's just take one so I can
> unbefuddle meself ;')
>
> *** Python 3.3.2 32 bit (Intel)] on win32. ***
On 06/15/2013 10:21 PM, Jim Mooney wrote:
On 15 June 2013 19:03, Dave Angel wrote:
Why such a convoluted way of expressing yourself?
I was demonstrating the parallelism, but let's just take one so I can
unbefuddle meself ;')
*** Python 3.3.2 32 bit (Intel)] on win32. ***
'' == False
False
On Sat, Jun 15, 2013 at 9:30 PM, Jim Mooney wrote:
> This is puzzling me. If I check the equality of 0, None, empty
> string, and empty list with False, only zero satisfies the equality.
> But if I use them in a not statement, they all turn out False.
> What gives?
>
> #Using C:\Python33\python.ex
On 15 June 2013 19:03, Dave Angel wrote:
> Why such a convoluted way of expressing yourself?
I was demonstrating the parallelism, but let's just take one so I can
unbefuddle meself ;')
*** Python 3.3.2 32 bit (Intel)] on win32. ***
>>> '' == False
False
>>> not ''
True
>>>
Why the difference he
On 06/15/2013 09:30 PM, Jim Mooney wrote:
##This is puzzling me. If I check the equality of 0, None, empty
string, and empty list with False,
##only zero satisfies the equality. But if I use them in a not
statement, they all turn out False.
##What gives?
#Using C:\Python33\python.exe on Win 7 in
##This is puzzling me. If I check the equality of 0, None, empty
string, and empty list with False,
##only zero satisfies the equality. But if I use them in a not
statement, they all turn out False.
##What gives?
#Using C:\Python33\python.exe on Win 7 in c:\python33\jimprogs
print('Zero is equal
>I was wondering if anyone could tell me why threading was depreciated; and
>give me a use case for the >multiprocessing : Queue function in python 2.7.
Threading was *not* deprecated Python 2.x or 3.x
http://docs.python.org/dev/py3k/library/threading.html?highlight=threading#threading
http://
I was wondering if anyone could tell me why threading was depreciated; and
give me a use case for the multiprocessing : Queue function in python 2.7.
Thanks,
-earnest
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options
Warning: this is going to look *a lot* better if you view it in a
fixed-width font so things line up properly.
Both functions apply a function to a list of values, but they do so in
different ways.
filter() applies a function to each element of a list in turn, returning
a new list containing
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
"Tiger12506" <[EMAIL PROTECTED]> wrote
>>> I can not see the difference but the second one acts differently
>>> in
>>> my code.
>>
>> The first has no else clause so the second assignment always
>> happens.
>>
>> Alan G.
>
> No it doesn't. The return statement does not allow the second
> assig
> "johnf" <[EMAIL PROTECTED]> wrote
>
>> if self._inFlush:
>> return
>> self._inFlush = True
>>
>>
>> AND
>>
>> if not self._inFlush:
>> ...
>> self._inFlush = True
>> else:
>> return
>>
>> I can not see the difference but the second one acts differently in
>> my code.
>
> T
"johnf" <[EMAIL PROTECTED]> wrote
> if self._inFlush:
> return
> self._inFlush = True
>
>
> AND
>
> if not self._inFlush:
> ...
> self._inFlush = True
> else:
> return
>
> I can not see the difference but the second one acts differently in
> my code.
The first has no els
Hi John,
It depends upon whether the "..." code fragment is affected in any way
by the value of self._inFlush. The first code sample you offer should
be identical to the following.
if not self._inFlush:
self._inFlush = True# reset this before the ...
...
else:
if self._inFlush:
return
self._inFlush = True
AND
if not self._inFlush:
...
self._inFlush = True
else:
return
I can not see the difference but the second one acts differently in my code.
--
John Fabiani
___
Tutor m
30 matches
Mail list logo