On Saturday, 15 June 2013 02:09:20 UTC+10, Steven D'Aprano wrote:
To everyone else... I know that Nikos' posts are draining. Sometimes he
brings me to the brink of despair too. But if you aren't part of the
solution, you are part of the problem: writing short-tempered, insulting
posts
On 15/6/2013 9:50 πμ, alex23 wrote:
Please keep the snarky comments offlist.
Tried that. He posts them back here.
Alternatively, I'd ask that if you're so willing to deal with him, that the
*two of you* take this show offlist instead? I'm genuinely curious as to
whether he'd agree to this:
On Sat, 15 Jun 2013 10:04:41 +0300, Nick the Gr33k wrote:
I called my self 'Ferrous Cranus'(this is what a guy from a forum
initially called me for being hard-headed :-) ) because i'm indeed
hardheaded and if i believe that 1 thing should have worked in some way
i cant change my mind easily
On 14/6/2013 7:42 μμ, Nobody wrote:
Python implements these operators by returning the actual value which
determined the result of the expression rather than simply True or False.
which in turn the actual value being returned is a truthy or a falsey.
That cleared the mystery in my head
On 15/6/2013 10:49 πμ, Denis McMahon wrote:
On Sat, 15 Jun 2013 10:04:41 +0300, Nick the Gr33k wrote:
I called my self 'Ferrous Cranus'(this is what a guy from a forum
initially called me for being hard-headed :-) ) because i'm indeed
hardheaded and if i believe that 1 thing should have worked
On 15/6/2013 3:14 πμ, Cameron Simpson wrote:
On 14Jun2013 12:50, Nikos as SuperHost Support supp...@superhost.gr wrote:
| I started another thread because the last one was !@#$'ed up by
| irrelevant replies and was difficult to jeep track.
|
| name=abcd
| month=efgh
| year=ijkl
|
|
Nick the Gr33k supp...@superhost.gr writes:
On 15/6/2013 3:14 πμ, Cameron Simpson wrote:
But for what you are doing, and and or are not good operations.
Something like:
k in (name+month+year)
or
k in name or k in month or k in year
Used to wrote it myself like the latter but
On 15/6/2013 12:48 μμ, Lele Gaifax wrote:
Nick the Gr33k supp...@superhost.gr writes:
but those 2 gives the same results back
k in (name+month+year) == k in (name and month and year)
True
so both seem to work as expected.
That happens only by chance: it seems you now understand the
On 15/6/2013 12:48 μμ, Lele Gaifax wrote:
but those 2 gives the same results back
k in (name+month+year) == k in (name and month and year)
True
so both seem to work as expected.
That happens only by chance: it seems you now understand the evaluation
of boolean expressions in Python, so the
I started another thread because the last one was !@#$'ed up by
irrelevant replies and was difficult to jeep track.
name=abcd
month=efgh
year=ijkl
print(name or month or year)
abcd
Can understand that, it takes the first string out of the 3 strings that
has a truthy value.
print(k in
On 14 Jun 2013 10:59, Nick the Gr33k supp...@superhost.gr wrote:
I started another thread because the last one was !@#$'ed up by
irrelevant replies and was difficult to jeep track.
name=abcd
month=efgh
year=ijkl
print(name or month or year)
abcd
Can understand that, it takes the
On 2013-06-14 10:50, Nick the Gr33k wrote:
I started another thread because the last one was !@#$'ed up by irrelevant
replies and was difficult to jeep track.
name=abcd
month=efgh
year=ijkl
print(name or month or year)
abcd
Can understand that, it takes the first string out of the 3
On 2013-06-14, Nick the Gr33k supp...@superhost.gr wrote:
I started another thread
no kidding.
because the last one was !@#$'ed up by irrelevant replies and was
difficult to jeep track.
name=abcd
month=efgh
year=ijkl
print(name or month or year)
abcd
Can understand that, it
On 14/6/2013 5:49 μμ, Grant Edwards wrote:
On 2013-06-14, Nick the Gr33k supp...@superhost.gr wrote:
I started another thread
no kidding.
because the last one was !@#$'ed up by irrelevant replies and was
difficult to jeep track.
name=abcd
month=efgh
year=ijkl
print(name or month or
On Fri, 14 Jun 2013 11:14:16 +0100, Robert Kern wrote:
On 2013-06-14 10:50, Nick the Gr33k wrote:
[snip question]
This is all iw ant to know.
This is all you need to read:
http://docs.python.org/2/reference/expressions.html#boolean-
operations
Thank you Robert for contributing a
On Jun 14, 9:09 pm, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
On Fri, 14 Jun 2013 11:14:16 +0100, Robert Kern wrote:
On 2013-06-14 10:50, Nick the Gr33k wrote:
[snip question]
This is all iw ant to know.
This is all you need to read:
On 06/14/2013 03:50 AM, Nick the Gr33k wrote:
print(name or month or year)
abcd
print(name and month and year)
ijkl
Interesting. I'd have thought a boolean expression would return True or
False, not a string. Learn something new every day.
--
On Fri, 14 Jun 2013 18:16:05 +0300, Nick the Gr33k wrote:
My question is why the expr (name and month and year) result in the
value of the last variable whic is variable year?
For much the same reason that an OR expression returns the first true
value.
or and and only evaluate as many
On Jun 14, 2013 9:34 AM, Michael Torrie torr...@gmail.com wrote:
On 06/14/2013 03:50 AM, Nick the Gr33k wrote:
print(name or month or year)
abcd
print(name and month and year)
ijkl
Interesting. I'd have thought a boolean expression would return True or
False, not a string. Learn
On Fri, 14 Jun 2013 10:29:25 -0600, Michael Torrie wrote:
On 06/14/2013 03:50 AM, Nick the Gr33k wrote:
print(name or month or year)
abcd
print(name and month and year)
ijkl
Interesting. I'd have thought a boolean expression would return True or
False, not a string. Learn something
On 14/6/2013 7:47 μμ, Benjamin Kaplan wrote:
In an and clause,
python returns the first false value or the last value, because that
will evaluate to the correct Boolean value. In an or clause, python
returns the first true value or the last value. When Python finally got
a Boolean type, no one
On 2013-06-14 18:01, Nick the Gr33k wrote:
On 14/6/2013 7:47 μμ, Benjamin Kaplan wrote:
In an and clause,
python returns the first false value or the last value, because that
will evaluate to the correct Boolean value. In an or clause, python
returns the first true value or the last value.
On 06/14/2013 10:49 AM, Steven D'Aprano wrote:
Correct. In Python, all boolean expressions are duck-typed: they aren't
restricted to True and False, but to any true-ish and false-ish
value, or as the Javascript people call them, truthy and falsey values.
snip
There are a couple of anomalies
On 14/06/2013 18:28, Michael Torrie wrote:
On 06/14/2013 10:49 AM, Steven D'Aprano wrote:
Correct. In Python, all boolean expressions are duck-typed: they aren't
restricted to True and False, but to any true-ish and false-ish
value, or as the Javascript people call them, truthy and falsey
On Sat, Jun 15, 2013 at 3:49 AM, MRAB pyt...@mrabarnett.plus.com wrote:
The general rule is that an object is true-ish unless it's false-ish
(there are fewer false-ish objects than true-ish objects, e.g. zero vs
non-zero int).
With a few random oddities:
bool(float(nan))
True
I somehow
Op 14-06-13 18:09, Steven D'Aprano schreef:
On Fri, 14 Jun 2013 11:14:16 +0100, Robert Kern wrote:
On 2013-06-14 10:50, Nick the Gr33k wrote:
[snip question]
This is all iw ant to know.
This is all you need to read:
http://docs.python.org/2/reference/expressions.html#boolean-
On Jun 14, 11:03 pm, Antoon Pardon antoon.par...@rece.vub.ac.be
wrote:
Op 14-06-13 18:09, Steven D'Aprano schreef:
On Fri, 14 Jun 2013 11:14:16 +0100, Robert Kern wrote:
On 2013-06-14 10:50, Nick the Gr33k wrote:
[snip question]
This is all iw ant to know.
This is all you
On 14 June 2013 19:37, rusi rustompm...@gmail.com wrote:
2. The recent responses from Robert Kern are in my view the ideal. In
summary it runs thus:
Stupid question no. 6457 from Nikos: ...
Robert : Look this up link
Nikos: I dont understand
Robert: Link explains
Nikos: I DONTU NDERSTND
Nick the Gr33k writes:
Why return first or last value?
because that will evaluate to the correct Boolean value
That value will either behave exactly the same as the Boolean value
you call correct, or else it will be more useful. That is, most of the
time it doesn't matter, and when it
On 2013-06-14, Nobody nob...@nowhere.com wrote:
On Fri, 14 Jun 2013 18:16:05 +0300, Nick the Gr33k wrote:
My question is why the expr (name and month and year) result in the
value of the last variable whic is variable year?
For much the same reason that an OR expression returns the first
On 2013-06-14, Chris Angelico ros...@gmail.com wrote:
On Sat, Jun 15, 2013 at 3:49 AM, MRAB pyt...@mrabarnett.plus.com wrote:
The general rule is that an object is true-ish unless it's false-ish
(there are fewer false-ish objects than true-ish objects, e.g. zero vs
non-zero int).
With a few
On 2013-06-14, Nick the Gr33k supp...@superhost.gr wrote:
On 14/6/2013 7:47 , Benjamin Kaplan wrote:
In an and clause,
python returns the first false value or the last value, because that
will evaluate to the correct Boolean value. In an or clause, python
returns the first true value or
On Fri, 14 Jun 2013 19:30:27 +, Grant Edwards wrote:
2. Returning one the objects that result from the evaluation of the
operands instead of returning True or False.
This is what seems to be confusing him. This is much less common
than short-circuit evaluation.
FWIW, Lisp
On Fri, 14 Jun 2013 16:49:11 +, Steven D'Aprano wrote:
Unlike Javascript though, Python's idea of truthy and falsey is actually
quite consistent:
Beyond that, if a user-defined type implements a __nonzero__() method then
it determines whether an instance is true or false. If it implements
On Sat, 15 Jun 2013 03:56:28 +1000, Chris Angelico wrote:
With a few random oddities:
bool(float(nan))
True
I somehow expected NaN to be false. Maybe that's just my expectations
that are wrong, though.
In general, you should expect the behaviour of NaN to be the opposite of
what you
On Sat, Jun 15, 2013 at 5:33 AM, Grant Edwards invalid@invalid.invalid wrote:
On 2013-06-14, Chris Angelico ros...@gmail.com wrote:
On Sat, Jun 15, 2013 at 3:49 AM, MRAB pyt...@mrabarnett.plus.com wrote:
The general rule is that an object is true-ish unless it's false-ish
(there are fewer
On 15/06/2013 00:06, Nobody wrote:
On Fri, 14 Jun 2013 16:49:11 +, Steven D'Aprano wrote:
Unlike Javascript though, Python's idea of truthy and falsey is actually
quite consistent:
Beyond that, if a user-defined type implements a __nonzero__() method then
it determines whether an
On 14Jun2013 12:50, Nikos as SuperHost Support supp...@superhost.gr wrote:
| I started another thread because the last one was !@#$'ed up by
| irrelevant replies and was difficult to jeep track.
|
| name=abcd
| month=efgh
| year=ijkl
|
| print(name or month or year)
| abcd
|
| Can
On Sat, 15 Jun 2013 00:09:31 +0100, Nobody wrote:
On Sat, 15 Jun 2013 03:56:28 +1000, Chris Angelico wrote:
With a few random oddities:
bool(float(nan))
True
I somehow expected NaN to be false. Maybe that's just my expectations
that are wrong, though.
In general, you should expect
On 15Jun2013 01:34, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info
wrote:
| On Sat, 15 Jun 2013 00:09:31 +0100, Nobody wrote:
|
| On Sat, 15 Jun 2013 03:56:28 +1000, Chris Angelico wrote:
| With a few random oddities:
| bool(float(nan))
| True
| I somehow expected NaN to be false.
On Sat, Jun 15, 2013 at 12:03 PM, Cameron Simpson c...@zip.com.au wrote:
On 15Jun2013 01:34, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info
wrote:
| Everyone is aware that there is more than one NAN, right?
I was not. Interesting.
| If my
| calculations are correct, there are
On Sat, 15 Jun 2013 12:03:08 +1000, Cameron Simpson wrote:
| ... even taking that into account! *wink* |
| Everyone is aware that there is more than one NAN, right?
I was not. Interesting.
| If my
| calculations are correct, there are 9007199254740992 distinct float
| NANs in Python
42 matches
Mail list logo