On 3 Aug 2009, at 18:57 , John Nagle wrote:
Dave Angel wrote:
sturlamolden wrote:
On 20 Jul, 18:27, Phillip B Oldham phillip.old...@gmail.com wrote:
Tuples are used for passing arguments to and from a function. Common
use of tuples include multiple return values and optional arguments
(*args).
Dave Angel wrote:
sturlamolden wrote:
On 20 Jul, 18:27, Phillip B Oldham phillip.old...@gmail.com wrote:
Tuples are used for passing arguments to and from a function. Common
use of tuples include multiple return values and optional arguments
(*args).
That's from Mesa, the Xerox PARC
John Nagle na...@animats.com wrote:
Every function returned a tuple as an argument. This had a nice
symmetry; function outputs and function inputs had the same form.
Mesa was the first language to break through the single return
value syntax problem.
Python doesn't go that far.
I
John Nagle wrote:
Mesa used tuples for subroutine arguments in a very straightforward
way. Every function took one tuple as an argument
Python doesn't go that far.
I believe that a very early version of Python did do
something like that, but it was found to be a bad idea,
because there
sturlamolden wrote:
On 20 Jul, 18:27, Phillip B Oldham phillip.old...@gmail.com wrote:
We're not looking to start any arguments or religious wars and we're
not asking that python be changed into something its not. We'd simply
like to understand the decision behind the lists and tuple
On 8/1/2009 9:31 PM, sturlamolden wrote:
- Python and C programmers use lists and arrays similarly.
I'm guessing that's because of the brackets...
Marcus
--
http://mail.python.org/mailman/listinfo/python-list
On 20 Jul, 18:27, Phillip B Oldham phillip.old...@gmail.com wrote:
We're not looking to start any arguments or religious wars and we're
not asking that python be changed into something its not. We'd simply
like to understand the decision behind the lists and tuple structures.
We feel that in
On 31 Jul, 23:43, Raymond Hettinger pyt...@rcn.com wrote:
More than one person here has
observed that the time to learn to program Pythonically is inversely
proportional to their experience in Java.
I believe it is opposite. The longer the Java experience, the longer
it takes to program
On Sat, 01 Aug 2009 19:19:43 -0700, sturlamolden wrote:
More than one person here has
observed that the time to learn to program Pythonically is inversely
proportional to their experience in Java.
I believe it is opposite. The longer the Java experience, the longer
it takes to program
On 2 Aug, 04:47, Nobody nob...@nowhere.com wrote:
OTOH, using a for loop when you could use a generator means less work
when you need to make a minor change and a generator is no longer
sufficient.
It's not just that. It is e.g. using a for loop and indexes instead of
a slice. E.g.
for i in
On 31 Jul, 21:31, Masklinn maskl...@masklinn.net wrote:
It's intuitive if you come to Python knowing other languages with
tuples (which are mostly functional, and in which tuples are *never*
sequences/iterables). At the end of the day, and if Guido's intention
truly was what Raymond
On Jul 22, 7:55 am, Duncan Booth duncan.bo...@invalid.invalid wrote:
I find it interesting that the heapq functions tell you in the
documentation that they aren't suitable for use where n==1 or where n is
near the total size of the sequence whereas random.sample() chooses what it
thinks is the
On Jul 22, 4:55 am, Duncan Booth duncan.bo...@invalid.invalid wrote:
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote:
But that's the wrong solution to the problem. The OP wants the largest
(or smallest) item, which he expects to get by sorting, then grabbing
the first element:
On Jul 20, 9:27 am, Phillip B Oldham phillip.old...@gmail.com wrote:
Specifically the differences between lists and tuples have us
confused and have caused many discussions in the office. We
understand that lists are mutable and tuples are not, but we're a
little lost as to why the two were
On Friday 31 July 2009 19:49:04 Raymond Hettinger wrote:
On Jul 20, 9:27 am, Phillip B Oldham phillip.old...@gmail.com wrote:
Specifically the differences between lists and tuples have us
confused and have caused many discussions in the office. We
understand that lists are mutable and
On 31 Jul 2009, at 20:48 , Emmanuel Surleau wrote:
On Friday 31 July 2009 19:49:04 Raymond Hettinger wrote:
On Jul 20, 9:27 am, Phillip B Oldham phillip.old...@gmail.com
wrote:
Specifically the differences between lists and tuples have us
confused and have caused many discussions in the
Emmanuel Surleau wrote:
Beyond the mutable/hashable distinction, there is an important
philosophical distinction articulated by Guido. He deems tuples to
be useful for struct like groupings of non-homogenous fields and
lists to be useful for sequences of homogenous data suitable for
looping.
On Friday 31 July 2009 21:55:11 Terry Reedy wrote:
Emmanuel Surleau wrote:
Beyond the mutable/hashable distinction, there is an important
philosophical distinction articulated by Guido. He deems tuples to
be useful for struct like groupings of non-homogenous fields and
lists to be useful
While nothing in the list/tuple code requires you to make that
distinction,
it is important because that philosophy pervades the language. If you
follow Guido's direction, you'll find that the various parts of the
language fit together better. Do otherwise and you'll be going
against
On Jul 26, 11:24 am, John Nagle na...@animats.com wrote:
A tuple is really a frozen list. Arguably, frozen objects
should have been a general concept. Conceptually, they're
simple - once __init__ has run, there can be no more changes
to fields of the object.
I would argue that freezing and
En Fri, 31 Jul 2009 17:26:58 -0300, Emmanuel Surleau
emmanuel.surl...@gmail.com escribió:
On Friday 31 July 2009 21:55:11 Terry Reedy wrote:
The word tuple comes from relational databases as a generalization of
single, double, triple, quadruple, quintuple, sextuple, sestuple,
octuple, etc. A
On Friday 24 July 2009 11:07:30 am Inky 788 wrote:
On Jul 23, 3:42 am, Hendrik van Rooyen hend...@microcorp.co.za
if you think it is contrived, then please consider how you would
keep track of say the colour of a pixel on a screen at position
(x,y) - this is about the simplest natural tuple
Steven D'Aprano wrote:
On Sun, 26 Jul 2009 11:24:48 -0700, John Nagle wrote:
An interesting issue is Python objects, which are always mutable.
A dict of Python objects is allowed, but doesn't consider the contents
of the objects, just their identity (address). Only built-in types are
On Sun, Jul 26, 2009 at 2:24 PM, John Naglena...@animats.com wrote:
Beni Cherniavsky wrote:
On Jul 22, 9:36 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
On Tuesday 21 July 2009 15:49:59 Inky 788 wrote:
My guess is that it was probably for optimization reasons long ago.
I've never
Benjamin Kaplan wrote:
On Sun, Jul 26, 2009 at 2:24 PM, John Naglena...@animats.com wrote:
Beni Cherniavsky wrote:
On Jul 22, 9:36 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
On Tuesday 21 July 2009 15:49:59 Inky 788 wrote:
snip
problem.
An interesting
Beni Cherniavsky wrote:
On Jul 22, 9:36 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
On Tuesday 21 July 2009 15:49:59 Inky 788 wrote:
My guess is that it was probably for optimization reasons long ago.
I've never heard a *good* reason why Python needs both.
The good reason is the
On Sun, 26 Jul 2009 11:24:48 -0700, John Nagle wrote:
An interesting issue is Python objects, which are always mutable.
A dict of Python objects is allowed, but doesn't consider the contents
of the objects, just their identity (address). Only built-in types are
immutable; one cannot
On Friday 24 July 2009 17:07:30 Inky 788 wrote:
On Jul 23, 3:42 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
8
Steven showed why you cannot have a mutable thing
as a key in a dict.
if you think it is contrived, then please consider how you would
keep
On Jul 22, 9:36 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
On Tuesday 21 July 2009 15:49:59 Inky 788 wrote:
My guess is that it was probably for optimization reasons long ago.
I've never heard a *good* reason why Python needs both.
The good reason is the immutability, which lets
On Jul 23, 3:42 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
On Wednesday 22 July 2009 16:36:51 Inky 788 wrote:
On Jul 22, 2:36 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
The good reason is the immutability, which lets you use
a tuple as a dict key.
Thanks for
On Jul 20, 12:27 pm, Phillip B Oldham phillip.old...@gmail.com
wrote:
My colleagues and I have been working with python for around 6 months
now, and while we love a lot of what python has done for us and what
it enables us to do some of the decisions behind such certain
data-types and their
En Wed, 22 Jul 2009 11:36:51 -0300, Inky 788 inky...@gmail.com escribió:
On Jul 22, 2:36 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
The good reason is the immutability, which lets you use
a tuple as a dict key.
Thanks for the reply Hendrik (and Steven (other reply)). Perhaps
On Wednesday 22 July 2009 16:36:51 Inky 788 wrote:
On Jul 22, 2:36 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
The good reason is the immutability, which lets you use
a tuple as a dict key.
Thanks for the reply Hendrik (and Steven (other reply)). Perhaps I'm
just not
2009/7/22 Inky 788 inky...@gmail.com:
Thanks for the reply Hendrik (and Steven (other reply)). Perhaps I'm
just not sophisticated enough, but I've never wanted to use a list/
tuple as a dict key. This sounds like obscure usage, and a bit
contrived as a reason for having *both* lists and
Phillip B Oldham wrote:
My colleagues and I have been working with python for around 6 months
now, and while we love a lot of what python has done for us and what
it enables us to do some of the decisions behind such certain
data-types and their related methods baffle us slightly (when compared
In article mailman.3616.1248369685.8015.python-l...@python.org,
Mark Lawrence breamore...@yahoo.co.uk wrote:
Sorry if this has been discussed and I've missed it, but how about
memory allocation. An immutable tuple has a fixed memory allocation
whereas that for the mutable list must be liable
On Tuesday 21 July 2009 15:49:59 Inky 788 wrote:
On Jul 20, 12:27 pm, Phillip B Oldham phillip.old...@gmail.com
wrote:
[snip] We
understand that lists are mutable and tuples are not, but we're a
little lost as to why the two were kept separate from the start. They
both perform a very
On Tue, 21 Jul 2009 00:39:24 +0200, Niels L. Ellegaard wrote:
Phillip B Oldham phillip.old...@gmail.com writes:
We often find we need to do manipulations like the above without
changing the order of the original list, and languages like JS allow
this. We can't work out how to do this in
On Tue, 21 Jul 2009 06:49:59 -0700, Inky 788 wrote:
On Jul 20, 12:27 pm, Phillip B Oldham phillip.old...@gmail.com wrote:
[snip] We
understand that lists are mutable and tuples are not, but we're a
little lost as to why the two were kept separate from the start. They
both perform a very
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote:
But that's the wrong solution to the problem. The OP wants the largest
(or smallest) item, which he expects to get by sorting, then grabbing
the first element:
sorted(alist)[0]
That requires sorting the entire list, only to
On Jul 22, 2:36 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
On Tuesday 21 July 2009 15:49:59 Inky 788 wrote:
On Jul 20, 12:27 pm, Phillip B Oldham phillip.old...@gmail.com
wrote:
[snip] We
understand that lists are mutable and tuples are not, but we're a
little lost as to
Quoting Inky 788 inky...@gmail.com:
The good reason is the immutability, which lets you use
a tuple as a dict key.
Thanks for the reply Hendrik (and Steven (other reply)). Perhaps I'm
just not sophisticated enough, but I've never wanted to use a list/
tuple as a dict key. This sounds
On Monday 20 July 2009 21:26:07 Phillip B Oldham wrote:
On Jul 20, 6:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
The main reason why you need both lists and tuples is that because a
tuple of immutable objects is itself immutable you can use it as a
dictionary key.
Really? That
Hrvoje Niksic hnik...@xemacs.org wrote:
Chris Rebert c...@rebertia.com writes:
x = [2,1,3]
print sorted(x)[0]
DB 3
What kind of Python produces that?
Assuming you're referring to the latter example, it was added in
version 2.4 If you meant the former example, I think that's purely
On Jul 20, 12:27 pm, Phillip B Oldham phillip.old...@gmail.com
wrote:
[snip] We
understand that lists are mutable and tuples are not, but we're a
little lost as to why the two were kept separate from the start. They
both perform a very similar job as far as we can tell.
My guess is that it
Hendrik van Rooyen hend...@microcorp.co.za (HvR) wrote:
HvR On Monday 20 July 2009 21:26:07 Phillip B Oldham wrote:
On Jul 20, 6:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
The main reason why you need both lists and tuples is that because a
tuple of immutable objects is itself
Piet van Oostrum wrote:
Hendrik van Rooyen hend...@microcorp.co.za (HvR) wrote:
HvR On Monday 20 July 2009 21:26:07 Phillip B Oldham wrote:
On Jul 20, 6:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
The main reason why you need both lists and tuples is that because a
tuple of
David Smith d...@cornell.edu (DS) wrote:
DS Piet van Oostrum wrote:
Hendrik van Rooyen hend...@microcorp.co.za (HvR) wrote:
HvR On Monday 20 July 2009 21:26:07 Phillip B Oldham wrote:
On Jul 20, 6:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
The main reason why you need both
On Jul 20, 12:27 pm, Phillip B Oldham phillip.old...@gmail.com
wrote:
My colleagues and I have been working with python for around 6 months
now, and while we love a lot of what python has done for us and what
it enables us to do some of the decisions behind such certain
data-types and their
My colleagues and I have been working with python for around 6 months
now, and while we love a lot of what python has done for us and what
it enables us to do some of the decisions behind such certain
data-types and their related methods baffle us slightly (when compared
to the decisions made in
On Mon, Jul 20, 2009 at 11:27 AM, Phillip B
Oldhamphillip.old...@gmail.com wrote:
snip
We often find we need to do manipulations like the above without
changing the order of the original list, and languages like JS allow
this. We can't work out how to do this in python though, other than
Phillip B Oldham phillip.old...@gmail.com wrote:
This make a lot more sense to us, and follows the convention from
other languages. It would also mean chaining methods to manipulate
lists would be easier:
x = [2,1,3]
print x.sort()[0]
3
print x
[2,1,3]
You already have a way to do what
Phillip wrote:
Specifically the differences between lists and tuples have us
confused and have caused many discussions in the office. We
understand that lists are mutable and tuples are not, but we're a
little lost as to why the two were kept separate from the start. They
both perform a very
On Jul 20, 12:27 pm, Phillip B Oldham phillip.old...@gmail.com
wrote:
...
Specifically the differences between lists and tuples have us
confused and have caused many discussions in the office. We
understand that lists are mutable and tuples are not, but we're a
little lost as to why the two
On Jul 20, 6:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
The main reason why you need both lists and tuples is that because a tuple
of immutable objects is itself immutable you can use it as a dictionary
key.
Really? That sounds interesting, although I can't think of any real-
Phillip B Oldham phillip.old...@gmail.com wrote:
On Jul 20, 6:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
The main reason why you need both lists and tuples is that because a
tuple of immutable objects is itself immutable you can use it as a
dictionary key.
Really? That sounds
On 7/20/2009 3:26 PM, Phillip B Oldham wrote:
On Jul 20, 6:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
The main reason why you need both lists and tuples is that because a tuple
of immutable objects is itself immutable you can use it as a dictionary
key.
Really? That sounds
On Mon, 2009-07-20 at 12:26 -0700, Phillip B Oldham wrote:
On Jul 20, 6:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
The main reason why you need both lists and tuples is that because a tuple
of immutable objects is itself immutable you can use it as a dictionary
key.
Really?
Duncan Booth duncan.bo...@invalid.invalid (DB) wrote:
DB Phillip B Oldham phillip.old...@gmail.com wrote:
This make a lot more sense to us, and follows the convention from
other languages. It would also mean chaining methods to manipulate
lists would be easier:
x = [2,1,3]
print
On Mon, Jul 20, 2009 at 2:23 PM, Piet van Oostrump...@cs.uu.nl wrote:
Duncan Booth duncan.bo...@invalid.invalid (DB) wrote:
DB Phillip B Oldham phillip.old...@gmail.com wrote:
This make a lot more sense to us, and follows the convention from
other languages. It would also mean chaining methods
2009/7/20 Chris Rebert c...@rebertia.com:
On Mon, Jul 20, 2009 at 2:23 PM, Piet van Oostrump...@cs.uu.nl wrote:
x = [2,1,3]
print sorted(x)[0]
DB 3
What kind of Python produces that?
Assuming you're referring to the latter example, it was added in version 2.4
If you meant the former
Phillip B Oldham phillip.old...@gmail.com writes:
We often find we need to do manipulations like the above without
changing the order of the original list, and languages like JS allow
this. We can't work out how to do this in python though, other than
duplicating the list, sorting, reversing,
Niels L. Ellegaard wrote:
Phillip B Oldham phillip.old...@gmail.com writes:
We often find we need to do manipulations like the above without
changing the order of the original list, and languages like JS allow
this. We can't work out how to do this in python though, other than
duplicating
Phillip B Oldham phillip.old...@gmail.com writes:
On Jul 20, 6:08 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
The main reason why you need both lists and tuples is that because a tuple
of immutable objects is itself immutable you can use it as a dictionary
key.
Really? That sounds
Chris Rebert c...@rebertia.com writes:
x = [2,1,3]
print sorted(x)[0]
DB 3
What kind of Python produces that?
Assuming you're referring to the latter example, it was added in version 2.4
If you meant the former example, I think that's purely pseudo-Python.
sorted([2, 1, 3])[0] evaluates
Paul Moore p.f.mo...@gmail.com (PM) wrote:
PM 2009/7/20 Chris Rebert c...@rebertia.com:
On Mon, Jul 20, 2009 at 2:23 PM, Piet van Oostrump...@cs.uu.nl wrote:
x = [2,1,3]
print sorted(x)[0]
DB 3
What kind of Python produces that?
Assuming you're referring to the latter example, it was
66 matches
Mail list logo