Re: Disable use of pyc file with no matching py file

2012-01-31 Thread Jean-Michel Pichavant
Terry Reedy wrote: On 1/30/2012 4:30 PM, Roy Smith wrote: Every so often (typically when refactoring), I'll remove a .py file and forget to remove the corresponding .pyc file. If I then import the module, python finds the orphaned .pyc and happily imports it. Usually leading to confusing and ha

Re: Disable use of pyc file with no matching py file

2012-01-31 Thread Andrea Crotti
On 01/30/2012 09:30 PM, Roy Smith wrote: Every so often (typically when refactoring), I'll remove a .py file and forget to remove the corresponding .pyc file. If I then import the module, python finds the orphaned .pyc and happily imports it. Usually leading to confusing and hard to debug fa

Debugging / profiling subscripts

2012-01-31 Thread Andrea Crotti
If for example I have a Python script which for some reasons needs to run another Python script as a subprocess, is there a way to debug / profile it? If I add an import pdb; pdb.set_trace() In my specific case I am running a program that, under certain conditions, has to restart from scratch, d

Re: Disable use of pyc file with no matching py file

2012-01-31 Thread Ben Finney
Jean-Michel Pichavant writes: > Terry Reedy wrote: > > On 1/30/2012 4:30 PM, Roy Smith wrote: > >> Is there some way to globally tell python, "Never import a .pyc > >> unless the corresponding .py file exits"? > > > > Upgrade to 3.2. > > > No. Terry's response was an answer to “Is there some way

Re: Disable use of pyc file with no matching py file

2012-01-31 Thread Steven D'Aprano
On Tue, 31 Jan 2012 11:26:10 +0100, Jean-Michel Pichavant wrote: > Terry Reedy wrote: >> On 1/30/2012 4:30 PM, Roy Smith wrote: >>> Every so often (typically when refactoring), I'll remove a .py file >>> and forget to remove the corresponding .pyc file. If I then import >>> the module, python fin

surprising result all (generator) (bug??)

2012-01-31 Thread Neal Becker
I was just bitten by this unexpected behavior: In [24]: all ([i > 0 for i in xrange (10)]) Out[24]: False In [25]: all (i > 0 for i in xrange (10)) Out[25]: True -- http://mail.python.org/mailman/listinfo/python-list

TestFixtures 2.3.4 Released!

2012-01-31 Thread Chris Withers
Hi All, I'm very happy to announce the first TestFixtures release built after a continuous integration testing process. The main benefit of this is that TestFixtures now works with Python 2.5 and Python 2.7. I thought they did before, but there were some annoying niggles. The CI stuff can

Re: surprising result all (generator) (bug??)

2012-01-31 Thread Mark Dickinson
On Jan 31, 6:40 am, Neal Becker wrote: > I was just bitten by this unexpected behavior: > > In [24]: all ([i > 0 for i in xrange (10)]) > Out[24]: False > > In [25]: all (i > 0 for i in xrange (10)) > Out[25]: True What does: >>> import numpy >>> all is numpy.all give you? -- Mark -- http://m

Re: surprising result all (generator) (bug??)

2012-01-31 Thread Neal Becker
Mark Dickinson wrote: > On Jan 31, 6:40 am, Neal Becker wrote: >> I was just bitten by this unexpected behavior: >> >> In [24]: all ([i > 0 for i in xrange (10)]) >> Out[24]: False >> >> In [25]: all (i > 0 for i in xrange (10)) >> Out[25]: True > > What does: > import numpy all is nu

Re: except clause syntax question

2012-01-31 Thread Mel Wilson
Charles Yeomans wrote: > To catch more than one exception type in an except block, one writes > > except (A, B, C) as e: > > I'm wondering why it was decided to match tuples, but not lists: > > except [A, B, C] as e: > > The latter makes more sense semantically to me -- "catch all exception >

python zipfile v. native unzip

2012-01-31 Thread Jason Friedman
Does Python 2.7's zipfile module use its own algorithm or does it leverage the zip/unzip libraries that exist on the host? I ask because my host's native unzip program cannot handle files that, when unzipped, are larger than 2GB. Will using Python 2.7 get around this limitation? -- http://mail.p

Re: except clause syntax question

2012-01-31 Thread Charles Yeomans
On Jan 30, 2012, at 7:00 PM, Steven D'Aprano wrote: > On Mon, 30 Jan 2012 12:41:00 -0500, Charles Yeomans wrote: > >> To catch more than one exception type in an except block, one writes >> >> except (A, B, C) as e: >> >> I'm wondering why it was decided to match tuples, but not lists: >> >>

Re: surprising result all (generator) (bug??)

2012-01-31 Thread Tim Chase
On 01/31/12 06:40, Neal Becker wrote: I was just bitten by this unexpected behavior: In [24]: all ([i> 0 for i in xrange (10)]) Out[24]: False In [25]: all (i> 0 for i in xrange (10)) Out[25]: True You sure you transcribed that correctly? Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) [G

Re: Disable use of pyc file with no matching py file

2012-01-31 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Tue, 31 Jan 2012 11:26:10 +0100, Jean-Michel Pichavant wrote: Terry Reedy wrote: On 1/30/2012 4:30 PM, Roy Smith wrote: Every so often (typically when refactoring), I'll remove a .py file and forget to remove the corresponding .pyc file. If I then imp

Re: surprising result all (generator) (bug??)

2012-01-31 Thread Mark Dickinson
On Jan 31, 7:24 am, Neal Becker wrote: > In [31]: all is numpy.all > Out[31]: True > > Excellent detective work, Mark!  But it still is unexpected, at least to me. Agreed that it's a bit surprising. It's a consequence of NumPy's general mechanisms for converting arbitrary inputs to arrays: >>>

Re: except clause syntax question

2012-01-31 Thread Steven D'Aprano
On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: > I don't think of a tuple as a container, and I don't think it a > misunderstanding on my part to think this. Well, it is a misunderstanding, because tuples ARE containers. You might as well say "I don't think of boxes as containers". W

importing module versus using function?

2012-01-31 Thread gujax
Hi, I am confused on this quite bad!! If I have this typed in interactive python: >>import numpy >>def dummy(): y=numpy.arange(1,2,0.1) return y and then >>s = dummy() >>s >>array[1. , 1.1, 1.2] it works. But if I have a module called example.py, whose code is def dummy():

Re: importing module versus using function?

2012-01-31 Thread Robert Kern
On 1/31/12 3:08 PM, gujax wrote: Hi, I am confused on this quite bad!! If I have this typed in interactive python: import numpy def dummy(): y=numpy.arange(1,2,0.1) return y and then s = dummy() s array[1. , 1.1, 1.2] it works. But if I have a module called example.p

configobj

2012-01-31 Thread Andrea Crotti
I have a couple of questions about configobj, which I'm happily trying to use for this project. The first question is, how do I make a very long list of things? Suppose I have declared in a spec file. val = string_list now I would like to do val = one, two, three but that's not all

Re: except clause syntax question

2012-01-31 Thread Charles Yeomans
On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote: > On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: > >> I don't think of a tuple as a container, and I don't think it a >> misunderstanding on my part to think this. > > Well, it is a misunderstanding, because tuples ARE containers.

Re: IDLE not setting current directory in its path

2012-01-31 Thread gujax
Thanks Terry, I see that the issue has been closed by you. However, I do not know how to run the patch on my Windows. Do I reinstall IDLE? Please suggest. I am using Python2.7 gujax On Jan 30, 10:55 pm, Terry Reedy wrote: > On 1/30/2012 3:15 PM, Terry Reedy wrote: > > > This issue is under consid

Re: except clause syntax question

2012-01-31 Thread Devin Jeanpierre
On Tue, Jan 31, 2012 at 11:23 AM, Charles Yeomans wrote: > > On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote: > >> On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: >> >>> I don't think of a tuple as a container, and I don't think it a >>> misunderstanding on my part to think this. >>

Re: Killing threads, and os.system()

2012-01-31 Thread Laurent Claessens
Le 31/01/2012 17:04, Dennis Lee Bieber a écrit : Of course, if that thread is stuck waiting for a call to os.system() to complete, then it can not do anything... os.system() is a rather limited, restrictive, call -- best used for quick one-of operations. If running Python 2.

Re: surprising result all (generator) (bug??)

2012-01-31 Thread MRAB
On 31/01/2012 12:40, Neal Becker wrote: I was just bitten by this unexpected behavior: In [24]: all ([i> 0 for i in xrange (10)]) Out[24]: False In [25]: all (i> 0 for i in xrange (10)) Out[25]: True Which version of Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: except clause syntax question

2012-01-31 Thread Charles Yeomans
On Jan 31, 2012, at 11:38 AM, Devin Jeanpierre wrote: > On Tue, Jan 31, 2012 at 11:23 AM, Charles Yeomans > wrote: >> >> On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote: >> >>> On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: >>> I don't think of a tuple as a container, and

Re: except clause syntax question

2012-01-31 Thread Ethan Furman
Charles Yeomans wrote: On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote: On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: I don't think of a tuple as a container, and I don't think it a misunderstanding on my part to think this. >> Well, it is a misunderstanding, because tuples A

Re: except clause syntax question

2012-01-31 Thread Charles Yeomans
On Jan 31, 2012, at 8:24 AM, Mel Wilson wrote: > Charles Yeomans wrote: > >> To catch more than one exception type in an except block, one writes >> >> except (A, B, C) as e: >> >> I'm wondering why it was decided to match tuples, but not lists: >> >> except [A, B, C] as e: >> >> The latter

Re: speaking at PyCon

2012-01-31 Thread Martin P. Hellwig
On 29/01/2012 03:32, Eric Snow wrote: This is my first year speaking at PyCon, so I solicited speaking/preparation advice from a bunch of folks, particularly focusing on the PyCon speaking experience. I've compiled the results and put them online: http://ref.rtfd.org/speakers This is still rou

Re: Disable use of pyc file with no matching py file

2012-01-31 Thread John Roth
On Jan 30, 3:43 pm, Terry Reedy wrote: > On 1/30/2012 4:30 PM, Roy Smith wrote: > > > Every so often (typically when refactoring), I'll remove a .py file > > and forget to remove the corresponding .pyc file.  If I then import > > the module, python finds the orphaned .pyc and happily imports it. >

RE: contextlib.contextmanager and try/finally

2012-01-31 Thread Prasad, Ramit
>Like Neil mentioned, a contextmanager generator is wrapped with an >__exit__ method that is guaranteed to be called and that explicitly >resumes or closes the generator. So as long as your contextmanager >generator is properly written (i.e. it yields exactly once), the >finally block will execute

RE: contextlib.contextmanager and try/finally

2012-01-31 Thread Peter Otten
Prasad, Ramit wrote: >>Like Neil mentioned, a contextmanager generator is wrapped with an >>__exit__ method that is guaranteed to be called and that explicitly >>resumes or closes the generator. So as long as your contextmanager >>generator is properly written (i.e. it yields exactly once), the >

Re: except clause syntax question

2012-01-31 Thread Duncan Booth
Charles Yeomans wrote: > To catch more than one exception type in an except block, one writes > > except (A, B, C) as e: > > I'm wondering why it was decided to match tuples, but not lists: > > except [A, B, C] as e: > > The latter makes more sense semantically to me -- "catch all exception >

Re: contextlib.contextmanager and try/finally

2012-01-31 Thread Ian Kelly
On Tue, Jan 31, 2012 at 2:07 PM, Prasad, Ramit wrote: >>Like Neil mentioned, a contextmanager generator is wrapped with an >>__exit__ method that is guaranteed to be called and that explicitly >>resumes or closes the generator.  So as long as your contextmanager >>generator is properly written (i.

Re: IDLE not setting current directory in its path

2012-01-31 Thread Terry Reedy
On 1/31/2012 11:27 AM, gujax wrote: Thanks Terry, I see that the issue has been closed by you. However, I do not know how to run the patch on my Windows. Do I reinstall IDLE? Please suggest. I am using Python2.7 Choices: 1. Wait for the next 2.7 release, which should be within a month. Easiest

Re: Disable use of pyc file with no matching py file

2012-01-31 Thread Terry Reedy
On 1/31/2012 3:20 PM, John Roth wrote: On Jan 30, 3:43 pm, Terry Reedy wrote: On 1/30/2012 4:30 PM, Roy Smith wrote: Every so often (typically when refactoring), I'll remove a .py file and forget to remove the corresponding .pyc file. If I then import the module, python finds the orphaned .p

Re: Disable use of pyc file with no matching py file

2012-01-31 Thread Terry Reedy
On 1/31/2012 9:19 AM, Jean-Michel Pichavant wrote: A: "My wheel is flat" B: "Buy a new car" A better analogy would be Q. "How do I make my old model car do something (it cannot do)?" A. "Get the free new model that has that feature added." Of course, there is a cost to giving up the old and

Re: except clause syntax question

2012-01-31 Thread Terry Reedy
On 1/31/2012 8:57 AM, Charles Yeomans wrote: In any case, though I appreciate your attempt at a post hoc justification, > I was hoping for a positive explanation. I think the best you are going to get is that Python somewhat consistently*, for both practical and historical reasons#, uses tupl

the script can not go through all the list, anyone could help, would be highly appreciated, thanks a lot !

2012-01-31 Thread Para
the script can not go through all the list, anyone could help, would be highly appreciated, thanks a lot ! output: initial 7 lines: [9379, 'G', '0.1830'] [9378, 'G', '0.1752'] [9377, 'G', '0.1929'] [9375, 'G', '0.1950'] [9370, 'G', '0.1872'] [937, 'G', '0.1931'] [93, 'G', '0.1974'] processing: c

Re: configobj

2012-01-31 Thread Terry Reedy
On 1/31/2012 11:06 AM, Andrea Crotti wrote: I have a couple of questions about configobj, which I'm happily trying to use for this project. When asking about 3rd party modules, please include a url, so we can be sure of what you mean and even take a look. Is www.voidspace.org.uk/python/config

Re: except clause syntax question

2012-01-31 Thread Charles Yeomans
On Jan 31, 2012, at 7:12 PM, Terry Reedy wrote: > On 1/31/2012 8:57 AM, Charles Yeomans wrote: > >> In any case, though I appreciate your attempt at a post hoc justification, > > I was hoping for a positive explanation. > > I think the best you are going to get is that Python somewhat consisten

How can I verify if the content of a variable is a list or a string?

2012-01-31 Thread Andres Soto
Hi, I'm writing a function which receive a list which elements are strings or new lists (sublists) containing strings. How can I verify if sone element of the list (which is contained in a variable) is a list or a string? I found the method isinstance(object,class) but I don't know which class

Re: except clause syntax question

2012-01-31 Thread Chris Angelico
On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth wrote: > Abitrarily nested tuples of exceptions cannot contain loops so the code > simply needs to walk through the tuples until it finds a match. Is this absolutely guaranteed? The C API for CPython provides: (Py2) http://docs.python.org/c-api/tuple.h

Re: How can I verify if the content of a variable is a list or a string?

2012-01-31 Thread Terry Reedy
On 1/31/2012 7:44 PM, Andres Soto wrote: Hi, I'm writing a function which receive a list which elements are strings or new lists (sublists) containing strings. How can I verify if sone element of the list (which is contained in a variable) is a list or a string? I found the method isinstance(obje

Re: How can I verify if the content of a variable is a list or a string?

2012-01-31 Thread Noah Hall
On Wed, Feb 1, 2012 at 12:44 AM, Andres Soto wrote: > Hi, > I'm writing a function which receive a list which elements are strings or > new lists (sublists) containing strings. > How can I verify if sone element of the list (which is contained in a > variable) is a list or a string? > I found the

'class' named tuple

2012-01-31 Thread Emmanuel Mayssat
I have the following program. I am trying to have index the attributes of an object using __getitem__. Reading them this way works great, but assigning them a value doesn't Is there a way to do such a thing? (Almost like a named tuple, but with custom methods) class LIter(object): def __init__

Re: the script can not go through all the list, anyone could help, would be highly appreciated, thanks a lot !

2012-01-31 Thread MRAB
On 01/02/2012 00:00, Para wrote: the script can not go through all the list, anyone could help, would be highly appreciated, thanks a lot ! output: initial 7 lines: [9379, 'G', '0.1830'] [9378, 'G', '0.1752'] [9377, 'G', '0.1929'] [9375, 'G', '0.1950'] [9370, 'G', '0.1872'] [937, 'G', '0.1931']

Re: except clause syntax question

2012-01-31 Thread Ian Kelly
On Tue, Jan 31, 2012 at 5:53 PM, Chris Angelico wrote: > On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth > wrote: >> Abitrarily nested tuples of exceptions cannot contain loops so the code >> simply needs to walk through the tuples until it finds a match. > > Is this absolutely guaranteed? The C API

Re: except clause syntax question

2012-01-31 Thread Ian Kelly
On Tue, Jan 31, 2012 at 6:09 PM, Ian Kelly wrote: > On Tue, Jan 31, 2012 at 5:53 PM, Chris Angelico wrote: >> On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth >> wrote: >>> Abitrarily nested tuples of exceptions cannot contain loops so the code >>> simply needs to walk through the tuples until it fi

Re: How can I verify if the content of a variable is a list or a string?

2012-01-31 Thread Andres Soto
okok, my mistake is that I was using string in place of str. Thank you!! regards Prof. Dr. Andrés Soto DES DACI UNACAR > > From: Noah Hall >To: Andres Soto >Cc: "python-list@python.org" >Sent: Tuesday, January 31, 2012 6:58 PM >Subject: Re: How can I ver

Re: 'class' named tuple

2012-01-31 Thread Ian Kelly
On Tue, Jan 31, 2012 at 5:54 PM, Emmanuel Mayssat wrote: > I have the following program. > I am trying to have index the attributes of an object using __getitem__. > Reading them this way works great, but assigning them a value doesn't > Is there a way to do such a thing? For assignment, use __se

Re: contextlib.contextmanager and try/finally

2012-01-31 Thread Tim Delaney
On 1 February 2012 09:02, Peter Otten <__pete...@web.de> wrote: > Prasad, Ramit wrote: > > Is that true even in the face of something like sys.exit()? > > What happens if 1) sys.exit is called while in the same thread > > 2) sys.exit is called from another thread but while this thread > > is in co

Re: Iterate from 2nd element of a huge list

2012-01-31 Thread Cameron Simpson
On 01Feb2012 01:39, Paulo da Silva wrote: | What is the best way to iterate thru a huge list having the 1st element | a different process? I.e.: | | process1(mylist[0]) | for el in mylist[1:]: | process2(el) | | This way mylist is almost duplicated, isn't it? Yep. What about (untested):

Re: Iterate from 2nd element of a huge list

2012-01-31 Thread Tim Delaney
On 1 February 2012 12:39, Paulo da Silva wrote: > Hi! > > What is the best way to iterate thru a huge list having the 1st element > a different process? I.e.: > > process1(mylist[0]) > for el in mylist[1:]: >process2(el) > > This way mylist is almost duplicated, isn't it? > If you are sur

Re: contextlib.contextmanager and try/finally

2012-01-31 Thread Steven D'Aprano
On Tue, 31 Jan 2012 15:09:34 -0700, Ian Kelly wrote: > On Tue, Jan 31, 2012 at 2:07 PM, Prasad, Ramit > wrote: >>>Like Neil mentioned, a contextmanager generator is wrapped with an >>>__exit__ method that is guaranteed to be called and that explicitly >>>resumes or closes the generator.  So as lo

Re: Iterate from 2nd element of a huge list

2012-01-31 Thread duncan smith
On 01/02/12 01:39, Paulo da Silva wrote: Hi! What is the best way to iterate thru a huge list having the 1st element a different process? I.e.: process1(mylist[0]) for el in mylist[1:]: process2(el) This way mylist is almost duplicated, isn't it? Thanks. Maybe (untested), it = iter

Re: except clause syntax question

2012-01-31 Thread Chris Angelico
On Wed, Feb 1, 2012 at 12:12 PM, Ian Kelly wrote: > Incidentally, I *think* that any correctly written C code attempting > to nest a tuple inside itself would make the reference count of the > tuple be at least 2 at the time of the call, and so it would fail. Good, nice that that's certain :) Mi

Re: Iterate from 2nd element of a huge list

2012-01-31 Thread Paulo da Silva
Em 01-02-2012 01:39, Paulo da Silva escreveu: > Hi! > > What is the best way to iterate thru a huge list having the 1st element > a different process? I.e.: > > process1(mylist[0]) > for el in mylist[1:]: > process2(el) > > This way mylist is almost duplicated, isn't it? > > Thanks. I t

Re: Iterate from 2nd element of a huge list

2012-01-31 Thread Paulo da Silva
Em 01-02-2012 03:16, Paulo da Silva escreveu: > Em 01-02-2012 01:39, Paulo da Silva escreveu: >> Hi! >> >> What is the best way to iterate thru a huge list having the 1st element >> a different process? I.e.: >> >> process1(mylist[0]) >> for el in mylist[1:]: >> process2(el) >> >> This way myl

Re: Disable use of pyc file with no matching py file

2012-01-31 Thread Roy Smith
In article , Terry Reedy wrote: > But I am sure that 95% of readers here will be using 3.x withing 10 > years. The only question for them is "When?". This not-well-known new > feature is one straw that some will put on the 'sooner' side of the balance. We would love to move to 3.x, for the be

ANN: PySAL 1.3

2012-01-31 Thread Serge Rey
On behalf of the PySAL development team, I'm happy to announce the official release of PySAL 1.3. PySAL is a library of tools for spatial data analysis and geocomputation written in Python. PySAL 1.3, the fourth official release of PySAL, includes a number of new features and enhancements: -

Re: except clause syntax question

2012-01-31 Thread Mel Wilson
Chris Angelico wrote: > On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth > wrote: >> Abitrarily nested tuples of exceptions cannot contain loops so the code >> simply needs to walk through the tuples until it finds a match. > > Is this absolutely guaranteed? The C API for CPython provides: > (Py2) h

Re: Iterate from 2nd element of a huge list

2012-01-31 Thread Cameron Simpson
On 01Feb2012 03:34, Paulo da Silva wrote: | Em 01-02-2012 03:16, Paulo da Silva escreveu: | > I think iter is nice for what I need. | > Thank you very much to all who responded. | | BTW, iter seems faster than iterating thru mylist[1:]! I would hope the difference can be attributed to the cost o

xhtml encoding question

2012-01-31 Thread Tim Arnold
I have to follow a specification for producing xhtml files. The original files are in cp1252 encoding and I must reencode them to utf-8. Also, I have to replace certain characters with html entities. I think I've got this right, but I'd like to hear if there's something I'm doing that is dangero

Installing pypi package twice

2012-01-31 Thread Jason Friedman
My system's default python is 2.6.5. I have separately installed 3.2.2 at /opt/python. I downloaded python-daemon-1.5.5 and installed with: $ tar xzf python-daemon-1.5.5 $ cd python-daemon-1.5.5 $ python setup.py build $ sudo python setup.py install How would I also install this package for 3.2.2

Installing pypi package twice

2012-01-31 Thread Jason Friedman
My system's default python is 2.6.5. I have also installed python3.2 at /opt/python. I installed a pypi package for 2.6.5 with: $ tar xzf package.tar.gz $ cd package $ python setup.py build $ sudo python setup.py install How can I also install this same package for 3.2? (I am assuming this packa

Re: Python Descriptor as Instance Attribute

2012-01-31 Thread Hua Yanghao
Thanks Ian for the explanation. Please see my comments below: > The behavior is by design.  First, keeping object behavior in the > class definition simplifies the implementation and also makes instance > checks more meaningful.  To borrow your Register example, if the "M" > descriptor is defined

Re: Iterate from 2nd element of a huge list

2012-01-31 Thread Arnaud Delobelle
On 1 February 2012 03:16, Paulo da Silva wrote: > Em 01-02-2012 01:39, Paulo da Silva escreveu: >> Hi! >> >> What is the best way to iterate thru a huge list having the 1st element >> a different process? I.e.: >> >> process1(mylist[0]) >> for el in mylist[1:]: >>       process2(el) >> >> This way

Re: 'class' named tuple

2012-01-31 Thread Arnaud Delobelle
On 1 February 2012 00:54, Emmanuel Mayssat wrote: > I have the following program. > I am trying to have index the attributes of an object using __getitem__. > Reading them this way works great, but assigning them a value doesn't > Is there a way to do such a thing? > (Almost like a named tuple, bu