On 10/10/2010 6:46 PM, Lawrence D'Oliveiro wrote:
Languages that insisted on being able to do proper compiler-level cross
checks between separately-compiled modules (e.g. Modula-2, Ada) never really
became that popular. This saddened me.
It's an sad consequence of a UNIX mindset that you
On Oct 11, 11:46 am, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
Nowadays we take it for granted that the core language should be a strong
and compact basis to build on, rather than providing lots of built-in
features, and all the rest should come from run-time libraries.
True == 1
True
False == 0
True
int(True)
1
int(False)
0
bool(1)
True
bool(0)
False
But:
str(fill==True)+','
is simpler than:
(False,, True,)[fill==True]
--
http://mail.python.org/mailman/listinfo/python-list
In message
45368e8d-3b4f-4380-974d-bf9cd5d68...@w9g2000prc.googlegroups.com,
NevilleDNZ wrote:
I do ponder why (given that linked lists can easily be created in Algol68)
useful types like LIST and DICT were left out of the standard prelude.
I guess a list type wasn’t seen as primitive enough.
Antoon Pardon antoon.par...@rece.vub.ac.be writes:
Personaly I don't see a reason to declare in advance that someone
who wants to treat True differently from non-zero numbers or
non-empty sequences and does so by a test like:
if var == Trueorif var is True
to have written
On Oct 10, 6:02 pm, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
As for DICT, I think table lookups were still a sufficiently novel concept
for people to disagree on how they should best be implemented.
I then stumbled over this paper:
Title: List processing in Algol 68 - V. J.
In message
e8a79f5b-a16b-4b33-a116-93cbd07a7...@u5g2000prn.googlegroups.com,
NevilleDNZ wrote:
Not having LIST and DICT as part of the base language would make sense
if user contributions were encouraged.
Unfortunately, they neglected to include any kind of module/package system
to make this
In message i8o1ij$ro...@news.eternal-september.org, BartC wrote:
NevilleDNZ neville...@gmail.com wrote in message
news:ad9841df-49a1-4c1b-95d0-e76b72df6...@w9g2000prc.googlegroups.com...
In Algol68 this would be:
x:=(i|One,Two,Three|None Of The Above)
The point is, the construction works
On Oct 9, 6:55 pm, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
In message i8o1ij$ro...@news.eternal-september.org, BartC wrote:
NevilleDNZ neville...@gmail.com wrote in message
news:ad9841df-49a1-4c1b-95d0-e76b72df6...@w9g2000prc.googlegroups.com...
In Algol68 this would
On Oct 7, 9:23 am, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
x = {1 : One, 2 : Two, 3 : Three}.get(i, None Of The Above)
More like:
x = {1:lambda:One, 2:lambda:Two, 3:lambda:Three}.get(i,
lambda:None Of The Above)()
i.e. deferred evaluation of selected case.
In Algol68 this
On Oct 7, 10:36 am, BartC b...@freeuk.com wrote:
i=16
x = {1 : fna(), 2 : fnb(), 3 : fnc()}.get(i, None Of The Above)
print x
Other than efficiency concerns, sometimes you don't want the extra
side-effects.
Probably there are workarounds here too, but I suspect the syntax won't be
quite
NevilleDNZ neville...@gmail.com wrote in message
news:ad9841df-49a1-4c1b-95d0-e76b72df6...@w9g2000prc.googlegroups.com...
On Oct 7, 9:23 am, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
x = {1 : One, 2 : Two, 3 : Three}.get(i, None Of The Above)
More like:
x =
On Thu, 07 Oct 2010 01:36:33 +0100, BartC wrote:
However, as I mentioned, one problem here is having to evaluate all the
items in the list before selecting one:
...
x = {1 : fna(), 2 : fnb(), 3 : fnc()}.get(i, None Of The Above)
Mel mwil...@the-wire.com wrote in message
On Wed, Oct 06, 2010 at 01:45:51PM +1300, Lawrence D'Oliveiro wrote:
In message mailman.1339.1286268545.29448.python-l...@python.org, Antoon
Pardon wrote:
On Tue, Oct 05, 2010 at 06:55:33PM +1300, Lawrence D'Oliveiro wrote:
In message
In message mailman.1384.1286348190.29448.python-l...@python.org, Antoon
Pardon wrote:
A lot of times someone comes with code like the following:
if len(lst) != 0:
...
and than gets the advise to write it as follows:
if lst:
...
Do you mean that this second piece of
On 5 Oct, 06:52, Lawrence D'Oliveiro l...@geek-
central.gen.new_zealand wrote:
In message
e8b46ea8-8d1e-4db9-91ba-501fd1a44...@g18g2000yqk.googlegroups.com, James
Harris wrote:
On 29 Sep, 18:20, Seebs usenet-nos...@seebs.net wrote:
On 2010-09-29, Tracubik affdfsdfds...@b.com wrote:
On Wed, Oct 06, 2010 at 09:31:48PM +1300, Lawrence D'Oliveiro wrote:
In message mailman.1384.1286348190.29448.python-l...@python.org, Antoon
Pardon wrote:
A lot of times someone comes with code like the following:
if len(lst) != 0:
...
and than gets the advise to write
James Harris james.harri...@googlemail.com wrote in message
news:e8b46ea8-8d1e-4db9-91ba-501fd1a44...@g18g2000yqk.googlegroups.com...
On 29 Sep, 18:20, Seebs usenet-nos...@seebs.net wrote:
On 2010-09-29, Tracubik affdfsdfds...@b.com wrote:
Hi all,
I'm studying PyGTK tutorial and i've found
In message i8i1h8$dc...@news.eternal-september.org, BartC wrote:
I use this syntax where there are two possibilities chosen according to
condition 'a':
(a | b | c)
Algol 68!
x = (One,Two,Three) [i-1]
While this works for i = 1,2,3, it goes funny for i=0,-1,-2, and generates
an error
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote in message
news:i8j0dg$lh...@lust.ihug.co.nz...
In message i8i1h8$dc...@news.eternal-september.org, BartC wrote:
x = (One,Two,Three) [i-1]
While this works for i = 1,2,3, it goes funny for i=0,-1,-2, and
generates
an error for
BartC wrote:
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote in message
news:i8j0dg$lh...@lust.ihug.co.nz...
In message i8i1h8$dc...@news.eternal-september.org, BartC wrote:
x = (One,Two,Three) [i-1]
While this works for i = 1,2,3, it goes funny for i=0,-1,-2, and
On Thu, 07 Oct 2010 01:36:33 +0100, BartC wrote:
However, as I mentioned, one problem here is having to evaluate all the
items in the list before selecting one:
def fna():
print FNA CALLED
return One
def fnb():
print FNB CALLED
return Two
def fnc():
In message
e8b46ea8-8d1e-4db9-91ba-501fd1a44...@g18g2000yqk.googlegroups.com, James
Harris wrote:
On 29 Sep, 18:20, Seebs usenet-nos...@seebs.net wrote:
On 2010-09-29, Tracubik affdfsdfds...@b.com wrote:
button = gtk.Button((False,, True,)[fill==True])
Oh, what a nasty idiom.
I'm
In message mailman.1166.1285774349.29448.python-l...@python.org, Philip
Semanchuk wrote:
Does Python make any guarantee that int(True) == 1 and int(False) == 0
will always hold, or are their values an implementation detail?
There has never been a rationally-designed language where this was
In message 877hi44w53@xemacs.org, Hrvoje Niksic wrote:
BTW adding ==True to a boolean value is redundant and can even break
for logically true values that don't compare equal to True (such as the
number 10 or the string foo).
I wonder if there’s a name for this sort of thing: “boolnoob”,
In message mailman.1232.1285927634.29448.python-l...@python.org, Antoon
Pardon wrote:
On Wed, Sep 29, 2010 at 01:38:48PM +0200, Hrvoje Niksic wrote:
BTW adding ==True to a boolean value is redundant and can even break
for logically true values that don't compare equal to True (such as the
In message 4ca96440$0$1674$742ec...@news.sonic.net, John Nagle wrote:
Yes, bool is a subtype of int in Python. This was
because the original design of Python didn't have bool
(a rather strange mistake for a language designed this late)
and the retrofit had to have some backwards
On Tue, Oct 05, 2010 at 06:55:33PM +1300, Lawrence D'Oliveiro wrote:
In message mailman.1232.1285927634.29448.python-l...@python.org, Antoon
Pardon wrote:
On Wed, Sep 29, 2010 at 01:38:48PM +0200, Hrvoje Niksic wrote:
BTW adding ==True to a boolean value is redundant and can even break
In message mailman.1339.1286268545.29448.python-l...@python.org, Antoon
Pardon wrote:
On Tue, Oct 05, 2010 at 06:55:33PM +1300, Lawrence D'Oliveiro wrote:
In message mailman.1232.1285927634.29448.python-l...@python.org, Antoon
Pardon wrote:
On Wed, Sep 29, 2010 at 01:38:48PM +0200,
On Tue, 05 Oct 2010 18:54:42 +1300 Lawrence D'Oliveiro
l...@geek-central.gen.new_zealand wrote:
“boolnoob”
Bwahahahah! Nice!
I'd love to say that I'll add this to my active vocabulary, but I don't
think there will be enough opportunities to use it. :-/
/W
--
INVALID? DE!
--
In message 20101005223520.3f5d9...@geekmail.invalid, Andreas Waldenburger
wrote:
On Tue, 05 Oct 2010 18:54:42 +1300 Lawrence D'Oliveiro
l...@geek-central.gen.new_zealand wrote:
“boolnoob”
Bwahahahah! Nice!
And of course, an instance of such boolnoobery can be referred to as a
On 10/1/2010 10:19 PM, Paul Rubin wrote:
Steven D'Apranost...@remove-this-cybersource.com.au writes:
Incorrect. bools *are* ints in Python, beyond any doubt.
Python 2.6.2 (r262:71600, Jun 4 2010, 18:28:58)
type(3)==type(True)
False
Yes, bool is a subtype of int in
On 29 Sep, 18:20, Seebs usenet-nos...@seebs.net wrote:
On 2010-09-29, Tracubik affdfsdfds...@b.com wrote:
Hi all,
I'm studying PyGTK tutorial and i've found this strange form:
button = gtk.Button((False,, True,)[fill==True])
the label of button is True if fill==True, is False
On Fri, 1 Oct 2010 00:42:34 -0700 (PDT) bruno.desthuilli...@gmail.com
bruno.desthuilli...@gmail.com wrote:
On 30 sep, 19:22, Andreas Waldenburger use...@geekmail.invalid
wrote:
On Thu, 30 Sep 2010 03:42:29 -0700 (PDT)
bruno.desthuilli...@gmail.com bruno.desthuilli...@gmail.com
wrote:
On Fri, 01 Oct 2010 22:19:14 -0700, Paul Rubin wrote:
Steven D'Aprano st...@remove-this-cybersource.com.au writes:
Incorrect. bools *are* ints in Python, beyond any doubt.
Python 2.6.2 (r262:71600, Jun 4 2010, 18:28:58)
type(3)==type(True)
False
So? Instances of a subclasses
Paul Rubin no.em...@nospam.invalid writes:
Steven D'Aprano st...@remove-this-cybersource.com.au writes:
Incorrect. bools *are* ints in Python, beyond any doubt.
Python 2.6.2 (r262:71600, Jun 4 2010, 18:28:58)
type(3)==type(True)
False
Of course, but it's the wrong thing to
On Oct 1, 11:19 pm, Paul Rubin no.em...@nospam.invalid wrote:
Steven D'Aprano st...@remove-this-cybersource.com.au writes:
Incorrect. bools *are* ints in Python, beyond any doubt.
Python 2.6.2 (r262:71600, Jun 4 2010, 18:28:58)
type(3)==type(True)
False
-1 False True 2
On 30 sep, 19:22, Andreas Waldenburger use...@geekmail.invalid
wrote:
On Thu, 30 Sep 2010 03:42:29 -0700 (PDT)
bruno.desthuilli...@gmail.com bruno.desthuilli...@gmail.com wrote:
On 29 sep, 19:20, Seebs usenet-nos...@seebs.net wrote:
On 2010-09-29, Tracubik affdfsdfds...@b.com wrote:
On Wed, Sep 29, 2010 at 01:38:48PM +0200, Hrvoje Niksic wrote:
Tracubik affdfsdfds...@b.com writes:
Hi all,
I'm studying PyGTK tutorial and i've found this strange form:
button = gtk.Button((False,, True,)[fill==True])
the label of button is True if fill==True, is False otherwise.
On Wed, Sep 29, 2010 at 05:58:16AM -0700, bruno.desthuilli...@gmail.com wrote:
On 29 sep, 13:38, Hrvoje Niksic hnik...@xemacs.org wrote:
Tracubik affdfsdfds...@b.com writes:
button = gtk.Button((False,, True,)[fill==True])
(snip)
BTW adding ==True to a boolean value is redundant and
On 10/1/2010 12:42 AM, bruno.desthuilli...@gmail.com wrote:
On 30 sep, 19:22, Andreas Waldenburgeruse...@geekmail.invalid
wrote:
On Thu, 30 Sep 2010 03:42:29 -0700 (PDT)
bruno.desthuilli...@gmail.combruno.desthuilli...@gmail.com wrote:
On 29 sep, 19:20, Seebsusenet-nos...@seebs.net wrote:
John Nagle wrote:
On 10/1/2010 12:42 AM, bruno.desthuilli...@gmail.com wrote:
On 30 sep, 19:22, Andreas Waldenburgeruse...@geekmail.invalid
wrote:
But it does violate the explicit is better than implicit tenet, don't
you think?
Why so ? The doc clearly states that booleans are integers
On Fri, 01 Oct 2010 11:23:25 -0700, John Nagle wrote:
Why so ? The doc clearly states that booleans are integers with True ==
1 and False == 0, so there's nothing implicit here.
Python bool values are NOT integers. They can be coerced to
integers for historical reasons.
Incorrect.
Steven D'Aprano st...@remove-this-cybersource.com.au writes:
Incorrect. bools *are* ints in Python, beyond any doubt.
Python 2.6.2 (r262:71600, Jun 4 2010, 18:28:58)
type(3)==type(True)
False
--
http://mail.python.org/mailman/listinfo/python-list
Andreas Waldenburger use...@geekmail.invalid wrote:
http://docs.python.org/release/3.1/reference/datamodel.html#the-standard-type-hierarchy
[ ... ]
Boolean values behave like the values 0 and 1, respectively, in
almost all contexts, the exception being that when converted to a
On 29 sep, 19:20, Seebs usenet-nos...@seebs.net wrote:
On 2010-09-29, Tracubik affdfsdfds...@b.com wrote:
button = gtk.Button((False,, True,)[fill==True])
Oh, what a nasty idiom.
Well, it's not very different from dict-based dispatch , which is the
core of OO polymorphic dispatch in quite a
On 9/30/2010 3:21 AM Sion Arrowsmith said...
Andreas Waldenburgeruse...@geekmail.invalid wrote:
http://docs.python.org/release/3.1/reference/datamodel.html#the-standard-type-hierarchy
[ ... ]
Boolean values behave like the values 0 and 1, respectively, in
almost all contexts, the
On Thu, 30 Sep 2010 03:42:29 -0700 (PDT)
bruno.desthuilli...@gmail.com bruno.desthuilli...@gmail.com wrote:
On 29 sep, 19:20, Seebs usenet-nos...@seebs.net wrote:
On 2010-09-29, Tracubik affdfsdfds...@b.com wrote:
button = gtk.Button((False,, True,)[fill==True])
Oh, what a nasty idiom.
Hi all,
I'm studying PyGTK tutorial and i've found this strange form:
button = gtk.Button((False,, True,)[fill==True])
the label of button is True if fill==True, is False otherwise.
i have googled for this form but i haven't found nothing, so can any of
you pass me any reference/link to this
Hi Nico, it's converting fill==True to an int, thereby choosing the
string False, or True, by indexing into the tuple.
Try this in an interpreter:
['a','b'][False]
'a'
['a','b'][True]
'b'
int(False)
0
int(True)
1
Joost
On 29 September 2010 12:42, Tracubik affdfsdfds...@b.com wrote:
Hi
This is just a sneaky shorthand, which is fine if that's what you want, but
it makes it harder to read. The reason it works is that 'fill==True' is a
boolean expression, which evaluates to True or False, but if you force a
True into being an integer, it will be 1, and a False will become 0. Try
Tracubik affdfsdfds...@b.com writes:
Hi all,
I'm studying PyGTK tutorial and i've found this strange form:
button = gtk.Button((False,, True,)[fill==True])
the label of button is True if fill==True, is False otherwise.
The tutorial likely predates if/else expression syntax introduced in
On 29/09/10 9:20 PM, python-list-requ...@python.org wrote:
Subject:
if the else short form
From:
Tracubik affdfsdfds...@b.com
Date:
29 Sep 2010 10:42:37 GMT
To:
python-list@python.org
Hi all,
I'm studying PyGTK tutorial and i've found this strange form:
button = gtk.Button((False
On 29 sep, 13:38, Hrvoje Niksic hnik...@xemacs.org wrote:
Tracubik affdfsdfds...@b.com writes:
button = gtk.Button((False,, True,)[fill==True])
(snip)
BTW adding ==True to a boolean value is redundant and can even break
for logically true values that don't compare equal to True (such as
On Sep 29, 12:38 pm, Hrvoje Niksic hnik...@xemacs.org wrote:
Tracubik affdfsdfds...@b.com writes:
Hi all,
I'm studying PyGTK tutorial and i've found this strange form:
button = gtk.Button((False,, True,)[fill==True])
the label of button is True if fill==True, is False otherwise.
The
On Sep 29, 2010, at 7:19 AM, Tom Potts wrote:
This is just a sneaky shorthand, which is fine if that's what you want, but
it makes it harder to read. The reason it works is that 'fill==True' is a
boolean expression, which evaluates to True or False, but if you force a
True into being an
On 9/29/2010 5:53 AM Philip Semanchuk said...
Does Python make any guarantee that int(True) == 1 and int(False) == 0 will
always hold, or are their values an implementation detail?
I had exactly this same question occur to me yesterday, and yes, I
believe it does. From
On Wed, 29 Sep 2010 08:53:17 -0400 Philip Semanchuk
phi...@semanchuk.com wrote:
Does Python make any guarantee that int(True) == 1 and int(False) ==
0 will always hold, or are their values an implementation detail?
On 2010-09-29, Tracubik affdfsdfds...@b.com wrote:
Hi all,
I'm studying PyGTK tutorial and i've found this strange form:
button = gtk.Button((False,, True,)[fill==True])
the label of button is True if fill==True, is False otherwise.
i have googled for this form but i haven't found nothing,
59 matches
Mail list logo