Paul LaFollette paul.lafolle...@gmail.com writes:
So, what I would like is some sort of object that is a kind of
everything but contains nothing, a unique minimal element of the
partial ordering imposed on the set of classes by the inheritance
heierarchy. Whilst I am not naive mathematically,
John Yeung a écrit :
On Jun 13, 2:29 am, Steven D'Aprano
st...@removethis.cybersource.com.au wrote:
Paul LaFollette wrote:
3) (this is purely philosophical but I am curious)
Would it not be more intuitive if
isinstance(None, anything at all) returned true?
Good grief no!!!
None is an object.
On Jun 17, 5:47 am, Bruno Desthuilliers bruno.
42.desthuilli...@websiteburo.invalid wrote:
John Yeung a écrit :
But mathematically speaking, it's intuitive that nothing would match
any type.
IOW, what's the OP is after is not the None type, but some yet
unexisting Anything type !-)
The
On Jun 14, 9:50 pm, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Sun, 14 Jun 2009 19:14:10 -0400, Terry Reedy wrote:
Steven D'Aprano wrote:
So-called vacuous truth. It's often useful to have all([]) return
true, but it's not *always* useful -- there are reasonable cases
Steven D'Aprano wrote:
On Sun, 14 Jun 2009 19:14:10 -0400, Terry Reedy wrote:
Steven D'Aprano wrote:
So-called vacuous truth. It's often useful to have all([]) return
true, but it's not *always* useful -- there are reasonable cases where
the opposite behaviour would be useful:
[...]
It
John Yeung wrote:
Paul LaFollette is probably thinking along the lines of formal logic
or set theory. It's a little bit confused because programming isn't
quite the same as math, and so it's a common question when designing
and implementing programming languages how far to take certain
Steven D'Aprano wrote:
... or {1}∩0. (If that character between the set and zero ends up missing,
it's meant to be INTERSECTION u'\u2229'.)
Note that you can write this in a quite readable way in ASCII:
it's meant to be the character u'\N{INTERSECTION}'.
--Scott David Daniels
John Yeung wrote:
And I accept your answer, as well as Steven's and Paul's for that
matter. I still think it is understandable (and people may choose to
understand in a condescending way, if they wish) that someone might
not get the difference between what you are saying and the statement
John Yeung gallium.arsen...@gmail.com (JY) wrote:
JY I've never heard a mathematician use the term bottom. It certainly
JY could be that I just haven't talked to the right types of
JY mathematicians.
Bottom is a term from lattice theory, which is a branch of mathematics.
--
Piet van Oostrum
On Sat, Jun 13, 2009 at 7:23 PM, John Yeunggallium.arsen...@gmail.com wrote:
Paul LaFollette is probably thinking along the lines of formal logic
or set theory. It's a little bit confused because programming isn't
quite the same as math, and so it's a common question when designing
and
Thank you all for your thoughtful and useful comments. Since this has
largely morphed into a discussion of my 3rd question, perhaps it would
interest you to hear my reason for asking it.
John is just about spot on. Part of my research involves the
enumeration and generation of various
Steven D'Aprano st...@removethis.cybersource.com.au writes:
So-called vacuous truth. It's often useful to have all([]) return true,
but it's not *always* useful -- there are reasonable cases where the
opposite behaviour would be useful:
if all(the evidence points to the Defendant's guilt)
On Sun, Jun 14, 2009 at 6:49 PM, Paul
LaFollettepaul.lafolle...@gmail.com wrote:
Now, suppose that I want to generate, say, the set of all ordered
trees with N nodes. I need to be able to represent the empty ordered
tree, i.e. the tree with with zero nodes. There are a lot of ways I
could
Andre Engels wrote:
On Sun, Jun 14, 2009 at 6:49 PM, Paul
LaFollettepaul.lafolle...@gmail.com wrote:
Now, suppose that I want to generate, say, the set of all ordered
trees with N nodes. I need to be able to represent the empty ordered
tree, i.e. the tree with with zero nodes. There are a
On Jun 14, 10:02 am, Arnaud Delobelle arno...@googlemail.com wrote:
snip
guilt, it doesn't mean they will be convicted. There needs to be enough
evidence to convince the jury. So it would be something like:
if sum(guilt_weight(e) for e in evidence) GUILT_THRESHOLD:
the defendant is
Andre Engels andreeng...@gmail.com writes:
I don't see why that would be the case. Something of the type thingy
is ONE thingy. Nothing is ZERO thingies, so it is not something of the
type thingy. A car is a single car. Nothing is zero cars, which is
not a car, just like two cars is not a car.
On Sun, Jun 14, 2009 at 9:37 PM, Paul Rubinhttp://phr...@nospam.invalid wrote:
Andre Engels andreeng...@gmail.com writes:
I don't see why that would be the case. Something of the type thingy
is ONE thingy. Nothing is ZERO thingies, so it is not something of the
type thingy. A car is a single
Andre Engels andreeng...@gmail.com writes:
That seems to confuse values with collections of them. Â A car is not
the same as a one-element list of cars. Â Nothing is not the same as a
zero-element list of cars.
So you are of the opinion that nothing _is_ a car?
Eh? No of course not. a
On Sun, Jun 14, 2009 at 10:21 PM, Paul
Rubinhttp://phr...@nospam.invalid wrote:
Andre Engels andreeng...@gmail.com writes:
That seems to confuse values with collections of them. Â A car is not
the same as a one-element list of cars. Â Nothing is not the same as a
zero-element list of cars.
Steven D'Aprano wrote:
So-called vacuous truth. It's often useful to have all([]) return
true, but it's not *always* useful -- there are reasonable cases
where the opposite behaviour would be useful:
if all(the evidence points to the Defendant's guilt) then: the
Defendant is guilty execute(the
Mel wrote:
John Yeung wrote:
And I accept your answer, as well as Steven's and Paul's for that
matter. I still think it is understandable (and people may choose to
understand in a condescending way, if they wish) that someone might
not get the difference between what you are saying and the
Paul LaFollette wrote:
Thank you all for your thoughtful and useful comments. Since this has
largely morphed into a discussion of my 3rd question, perhaps it would
interest you to hear my reason for asking it.
John is just about spot on. Part of my research involves the
enumeration and
On Jun 14, 12:37 pm, Paul Rubin http://phr...@nospam.invalid wrote:
Andre Engels andreeng...@gmail.com writes:
snip
type thingy. A car is a single car. Nothing is zero cars, which is
not a car, just like two cars is not a car.
That seems to confuse values with collections of them. A car is
On Sun, 14 Jun 2009 18:02:54 +0100, Arnaud Delobelle wrote:
Steven D'Aprano st...@removethis.cybersource.com.au writes:
So-called vacuous truth. It's often useful to have all([]) return
true, but it's not *always* useful -- there are reasonable cases where
the opposite behaviour would be
On Sun, 14 Jun 2009 19:14:10 -0400, Terry Reedy wrote:
Steven D'Aprano wrote:
So-called vacuous truth. It's often useful to have all([]) return
true, but it's not *always* useful -- there are reasonable cases where
the opposite behaviour would be useful:
[...]
It seems to me that the
Paul LaFollette wrote:
3) (this is purely philosophical but I am curious) Would it not be
more intuitive if
isinstance(None, anything at all) returned true?
Good grief no!!!
None is an object. It has a type, NoneType. It's *not* a string, or a float,
or an int, or a list, so why would you
Jean-Michel Pichavant wrote:
def setNext(nxt):
assert nxt==None or isinstance(nxt, Node), next must be a Node
self.next = nxt
works ok, but it's uglier than it ought to be.
I don't find it that ugly. It's accurate, easy to read and understand.
Actually, it's inaccurate.
Steven D'Aprano wrote:
[ snip excellent discussion of proper use of assert]
The third bug (the nitpick) is a bug in the API: you name the argument nxt
with no e, but in the error message, you call it next with an e. The fact
that any intelligent person should be able to guess what parameter the
On Jun 13, 2:29 am, Steven D'Aprano
st...@removethis.cybersource.com.au wrote:
Paul LaFollette wrote:
3) (this is purely philosophical but I am curious)
Would it not be more intuitive if
isinstance(None, anything at all) returned true?
Good grief no!!!
None is an object. It has a type,
John Yeung gallium.arsen...@gmail.com writes:
Because you might want None to behave as though it were nothing at all.
Sure, you might also want strings to behave as if they were ints, but
wishing doesn't make it so.
But mathematically speaking, it's intuitive that nothing would match
any
Paul Rubin http://phr...@nospam.invalid writes:
crash, or something like that. None is a value which in Haskell has a
I got ahead of myself, of course I meant Python (the *next* sentence
was going to mention Haskell). The corresponding concept in Haskell
is called Nothing, which lives in a
On Jun 13, 1:49 pm, Paul Rubin http://phr...@nospam.invalid wrote:
John Yeung gallium.arsen...@gmail.com writes:
Because you might want None to behave as though it were
nothing at all.
Sure, you might also want strings to behave as if they
were ints, but wishing doesn't make it so.
I'm
On Sat, 13 Jun 2009 21:25:28 +0100, John Yeung
gallium.arsen...@gmail.com wrote:
But mathematically speaking, it's intuitive that
nothing would match any type.
Completely wrong. The concept you're thinking of in
denotational semantics is called bottom, but bottom
is not a value that
On Jun 13, 5:22 pm, Rhodri James rho...@wildebst.demon.co.uk
wrote:
Such an understanding would be clearly wrong in the context
in which we were talking (and denotational semantics is a
branch of category theory, which is not specific to computer
science if you don't mind). If None is
Paul Rubin http://phr...@nospam.invalid (PR) wrote:
PR Paul Rubin http://phr...@nospam.invalid writes:
crash, or something like that. None is a value which in Haskell has a
PR I got ahead of myself, of course I meant Python (the *next* sentence
PR was going to mention Haskell). The
On Sat, 13 Jun 2009, John Yeung wrote:
On Jun 13, 5:22 pm, Rhodri James rho...@wildebst.demon.co.uk
wrote:
Such an understanding would be clearly wrong in the context
in which we were talking (and denotational semantics is a
branch of category theory, which is not specific to computer
Kind people,
Using Python 3.0 on a Gatesware machine (XP).
I am building a class in which I want to constrain the types that can
be stored in various instance variables. For instance, I want to be
certain that self.loc contains an int. This is straightforward (as
long as I maintain the
Hello,
This should work for you:
In [1]: import types
In [2]: isinstance(None, types.NoneType)
Out[2]: True
Best regards,
Javier
2009/6/12 Paul LaFollette paul.lafolle...@gmail.com:
Kind people,
Using Python 3.0 on a Gatesware machine (XP).
I am building a class in which I want to
Paul LaFollette schrieb:
Kind people,
Using Python 3.0 on a Gatesware machine (XP).
I am building a class in which I want to constrain the types that can
be stored in various instance variables. For instance, I want to be
certain that self.loc contains an int. This is straightforward (as
Paul LaFollette a écrit :
Kind people,
Using Python 3.0 on a Gatesware machine (XP).
I am building a class in which I want to constrain the types that can
be stored in various instance variables.
This somehow goes against the whole philosophy of dynamic typing Python
is based upon... But
On Jun 12, 10:05 am, Paul LaFollette paul.lafolle...@gmail.com
wrote:
Kind people,
Using Python 3.0 on a Gatesware machine (XP).
I am building a class in which I want to constrain the types that can
be stored in various instance variables. For instance, I want to be
certain that self.loc
Hello,
You're right, types.NoneType is not available in python 3.0, I wasn't
aware of that change. Thanks for pointing it out.
Best regards,
Javier
2009/6/12 Jeff McNeil j...@jmcneil.net:
On Jun 12, 10:05 am, Paul LaFollette paul.lafolle...@gmail.com
wrote:
Kind people,
Using Python
def setNext(nxt):
assert nxt==None or isinstance(nxt, Node), next must be a Node
self.next = nxt
works ok, but it's uglier than it ought to be.
I don't find it that ugly. It's accurate, easy to read and understand.
What else ? would say a famous coffee representative.
If you
Paul LaFollette wrote:
since type(Node) responds with class, 'NoneType' but the assertion
above gives name 'NoneType' is not defined suggesting that NoneType
is some sort of quasi-class.
add NoneType = type(None) before using Nonetype
--
http://mail.python.org/mailman/listinfo/python-list
On 2009-06-12 09:05, Paul LaFollette wrote:
Kind people,
Using Python 3.0 on a Gatesware machine (XP).
I am building a class in which I want to constrain the types that can
be stored in various instance variables. For instance, I want to be
certain that self.loc contains an int. This is
Ok thanks. I'll avoid to do that.
--- Giampaolo
http://code.google.com/p/pyftpdlib/
--
http://mail.python.org/mailman/listinfo/python-list
Sorry for the title but I didn't find anything more appropriate.
To have a less verbose code would it be ok doing:
if a b:
...instead of:
if a is not None and a b:
...?
Is there any hidden complication behind that?
Thanks in advance
--- Giampaolo
code.google.com/p/pyftpdlib/
--
On Nov 24, 7:52 pm, Giampaolo Rodola' [EMAIL PROTECTED] wrote:
Sorry for the title but I didn't find anything more appropriate.
To have a less verbose code would it be ok doing:
if a b:
...instead of:
if a is not None and a b:
...?
Is there any hidden complication behind that?
Thanks
On Mon, Nov 24, 2008 at 5:52 PM, Giampaolo Rodola' [EMAIL PROTECTED] wrote:
Sorry for the title but I didn't find anything more appropriate.
To have a less verbose code would it be ok doing:
if a b:
...instead of:
if a is not None and a b:
...?
Is there any hidden complication behind
flamesrock [EMAIL PROTECTED] wrote:
...
(The reason I ask is sortof unrelated. I wanted to use None as a
variable for which any integer, including negative ones have a greater
value so that I wouldn't need to implement any tests or initializations
for a loop that finds the maximum of a
Francis Girard wrote:
What was the goal behind this rule ?
If you have a list which contains integers, strings, tuples, lists and
dicts and you sort it and print it, it will be easier to detect what
you're looking for:)
G.
--
http://mail.python.org/mailman/listinfo/python-list
Le vendredi 28 Janvier 2005 22:54, jfj a écrit :
Francis Girard wrote:
What was the goal behind this rule ?
If you have a list which contains integers, strings, tuples, lists and
dicts and you sort it and print it, it will be easier to detect what
you're looking for:)
G.
Mmm. Certainly
Well, after playing with python for a bit I came across something
weird:
The statement (1 None) is false (or any other value above 0). Why is
this?
(The reason I ask is sortof unrelated. I wanted to use None as a
variable for which any integer, including negative ones have a greater
value so
flamesrock [EMAIL PROTECTED] wrote:
The statement (1 None) is false (or any other value above 0). Why is
this?
http://docs.python.org/ref/comparisons.html
The operators , , ==, =, =, and != compare the values of
two objects. The objects need not have the same type. If both
are
flamesrock wrote:
The statement (1 None) is false (or any other value above 0). Why is
this?
What code are you executing? I don't get this behavior at all:
py 100 None
True
py 1 None
True
py 0 None
True
py -1 None
True
py -100 None
True
(The reason I ask is sortof unrelated. I wanted to use
Le jeudi 27 Janvier 2005 20:16, Steven Bethard a écrit :
flamesrock wrote:
The statement (1 None) is false (or any other value above 0). Why is
this?
What code are you executing? I don't get this behavior at all:
py 100 None
True
py 1 None
True
py 0 None
True
py -1 None
True
Francis Girard wrote:
Wow ! What is it that are compared ? I think it's the references (i.e. the
adresses) that are compared. The None reference may map to the physical 0x0
adress whereas 100 is internally interpreted as an object for which the
reference (i.e. address) exists and therefore
Steven Bethard wrote:
So None being smaller than anything (except itself) is hard-coded into
Python's compare routine.
My suspicion is that even if/when objects of different types are no longer
comparable by default
(as has been suggested for Python 3.0), None will still compare as
Francis Girard wrote:
Wow ! What is it that are compared ? I think it's the references (i.e. the
adresses) that are compared. The None reference may map to the physical 0x0
adress whereas 100 is internally interpreted as an object for which the
reference (i.e. address) exists and therefore
Oops, I misunderstood what you said. I understood that it was now the case
that objects of different types are not comparable by default whereas you
meant it as a planned feature for version 3.
I really hope that it will indeed be the case for version 3.
Francis Girard
Le jeudi 27 Janvier
Le jeudi 27 Janvier 2005 22:07, Steven Bethard a écrit :
Francis Girard wrote:
Le jeudi 27 Janvier 2005 21:29, Steven Bethard a écrit :
So None being smaller than anything (except itself) is hard-coded into
Python's compare routine. My suspicion is that even if/when objects of
different
Francis Girard wrote:
I see. There is some rule stating that all the strings are greater than ints
and smaller than lists, etc.
Yes, that rule being to compare objects of different types by their type
names (falling back to the address of the type object if the type names
are the same, I
Very complete explanation.
Thank you
Francis Girard
Le jeudi 27 Janvier 2005 22:15, Steven Bethard a écrit :
Francis Girard wrote:
I see. There is some rule stating that all the strings are greater than
ints and smaller than lists, etc.
Yes, that rule being to compare objects of different
Francis Girard wrote:
a = 10
b = 10
a b
True
b a
False
id(a)
1077467584
id(b)
134536516
Just to thoroughly explain this example, the current CPython
implementation says that numbers are smaller than everything but None.
The reason you get such a small id for 'b' is that there is only one 10
Wow! Thanks for all the replies. I'll have to reread everything to
absorb it.
The test code is pretty simple:
if 2 None:
print 'true'
else:
print 'false'
It prints false every time. I should also mention that I'm using
version 2.0.1 (schools retro solaris machines :( )
At home (version 2.3.4)
flamesrock wrote:
I should also mention that I'm using
version 2.0.1 (schools retro solaris machines :( )
At home (version 2.3.4) it prints out 'True' for the above code block.
That would explain it -- as /F mentioned previously, the special case
for None was added in 2.1.
Jeff Shannon
66 matches
Mail list logo