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
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
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
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
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
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
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
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
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
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
>
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
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:
>>
>>
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
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
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:
>>>
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
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():
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
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
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.
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
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.
>>
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.
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
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
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
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
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
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.
>
>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
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
>
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
>
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.
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
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
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
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 !
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
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
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
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
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
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
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
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__
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']
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
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
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
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
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
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):
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
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
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
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
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
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
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
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:
-
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
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
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
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
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
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
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
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
68 matches
Mail list logo