On 2008-12-14, Peter Otten <__pete...@web.de> wrote:
> Grant Edwards wrote:
>
>> Short circuit evaluation of booleans is very common (and has
>> been for decades), so I don't know why people would expect
>> something else.
>
> Visual Basic ;)
I should have known...
--
Grant Edwards
Unfortunately,
bool('Ruby totally pwn3s Python!')
> True
Using Python is not total protection against buggy programs ;-)
--
Tim Rowe
--
http://mail.python.org/mailman/listinfo/python-list
Grant Edwards a écrit :
On 2008-12-14, Daniel Fetchinson wrote:
Let me just point out that unsuspecting people (like me) might rely on
the whole expression to be evaluated and rely on exceptions being
raised if needed.
Short circuit evaluation of booleans is very common (and has
been for dec
On Sun, Dec 14, 2008 at 2:38 AM, Gabriel Genellina
wrote:
> En Sun, 14 Dec 2008 02:40:10 -0200, Benjamin Kaplan
> escribió:
>
> On Sat, Dec 13, 2008 at 10:49 PM, Daniel Fetchinson <
>> fetchin...@googlemail.com> wrote:
>>
>> >> Is it a feature that
>>> >>
>>> >> 1 or 1/0
>>> >>
>>> >> returns 1
Grant Edwards wrote:
> Short circuit evaluation of booleans is very common (and has
> been for decades), so I don't know why people would expect
> something else.
Visual Basic ;)
--
http://mail.python.org/mailman/listinfo/python-list
Daniel Fetchinson wrote:
[ ... ]
> Let me just point out that unsuspecting people (like me) might rely on
> the whole expression to be evaluated and rely on exceptions being
> raised if needed.
There are a lot of threads on comp.lang.python that mention beginners'
possible reactions to language fe
Rohannes wrote:
'Dive into Python' has a very memorable and interesting section on the
exact behaviour of 'and' and 'or' in Python:
http://diveintopython.org/power_of_introspection/and_or.html
No: &, | (and ^, too) perform bitwise operations in Python, C and Java:
"In complete evaluation ...
On 2008-12-14, Daniel Fetchinson wrote:
> Let me just point out that unsuspecting people (like me) might rely on
> the whole expression to be evaluated and rely on exceptions being
> raised if needed.
Short circuit evaluation of booleans is very common (and has
been for decades), so I don't know
Hi.
r wrote:
> These are just the kind of things that make Python so beautiful ;)
> Thanks Guido!
You shouldn't forget to thank K&R ;-)
Shortcutting logical operation shortcuts existed already in C and has
been adopted by quite a lot of programming languages.
bye
N
--
http://mail.python.org/
'Dive into Python' has a very memorable and interesting section on the
exact behaviour of 'and' and 'or' in Python:
http://diveintopython.org/power_of_introspection/and_or.html
> No: &, | (and ^, too) perform bitwise operations in Python, C and Java:
"In complete evaluation ... both expressions
En Sun, 14 Dec 2008 02:40:10 -0200, Benjamin Kaplan
escribió:
On Sat, Dec 13, 2008 at 10:49 PM, Daniel Fetchinson <
fetchin...@googlemail.com> wrote:
>> Is it a feature that
>>
>> 1 or 1/0
>>
>> returns 1 and doesn't raise a ZeroDivisionError? If so, what's the
>> rationale?
>
> http://en.wik
> Let me just point out that unsuspecting people (like me) might rely on
> the whole expression to be evaluated and rely on exceptions being
> raised if needed.
This happens when people assume something ;)
Use a different construct if you want to catch error's, I don't
understand how you could not
On Sat, Dec 13, 2008 at 10:49 PM, Daniel Fetchinson <
fetchin...@googlemail.com> wrote:
> >> Is it a feature that
> >>
> >> 1 or 1/0
> >>
> >> returns 1 and doesn't raise a ZeroDivisionError? If so, what's the
> >> rationale?
> >
> > Yes, it's a feature:
> >
> > http://en.wikipedia.org/wiki/Short-
>> Is it a feature that
>>
>> 1 or 1/0
>>
>> returns 1 and doesn't raise a ZeroDivisionError? If so, what's the
>> rationale?
>
> Yes, it's a feature:
>
> http://en.wikipedia.org/wiki/Short-circuit_evaluation
>
> When you have "True or False", you know it's true by the time
> you've got the first p
Not that I'm against promoting Python, but most languages have support for
short circuit evaluation. That's why you usually use && and || in C, C++, C#
and Java- & and | will always evaluate both sides. Short circuit evaluation
is what allows you to write things like "if foo is not None and
foo.isT
These are just the kind of things that make Python so beautiful ;)
Thanks Guido!
--
http://mail.python.org/mailman/listinfo/python-list
Is it a feature that
1 or 1/0
returns 1 and doesn't raise a ZeroDivisionError? If so, what's the rationale?
Yes, it's a feature:
http://en.wikipedia.org/wiki/Short-circuit_evaluation
When you have "True or False", you know it's true by the time
you've got the first piece, so there's no need
"Daniel Fetchinson" wrote:
> Is it a feature that
>
> 1 or 1/0
>
> returns 1 and doesn't raise a ZeroDivisionError? If so, what's the rationale?
See: http://en.wikipedia.org/wiki/Short-circuit_evaluation
--
http://mail.python.org/mailman/listinfo/python-list
Is it a feature that
1 or 1/0
returns 1 and doesn't raise a ZeroDivisionError? If so, what's the rationale?
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
--
http://mail.python.org/mailman/listinfo/python-list
19 matches
Mail list logo