Assignment-in-conditional
I am not sure if this came up before, but I would love to have an
'assignment-in-conditional' form in python, e.g
pat = re.compile('something')
if m = pat.match(s):
m.group(1)
Of course there is some concern about accidentally using '=' instead of
'=='. One possible solution is to do what the 'with' statement does:
if pat.match(s) as m:
...
a little ugly but not too much worse that with itself..
what do you guys think?
- max
--
http://mail.python.org/mailman/listinfo/python-list
Re: Assignment-in-conditional
Thanks for the FAQ, and for the 'casm ;) What do you think about using alternative syntax (something like 'as') - max Fredrik Lundh wrote: > xamdam wrote: > > > I am not sure if this came up before, but I would love to have an > > 'assignment-in-conditional' form in python, e.g > > it's a FAQ, so it has probably come up before: > > http://pyfaq.infogami.com/why-can-t-i-use-an-assignment-in-an-expression > > -- http://mail.python.org/mailman/listinfo/python-list
no-setup packages?
Hi all, we have a situation where I need to deploy some python modules without superuser permissions - is there a 'standard' way of doing it? Better yet, is there a way to deploy modules without running any scripts at all? Tarball deployment of some sort? Particular things I have in mind are cx_Oracle, Cheetah. thanks, max -- http://mail.python.org/mailman/listinfo/python-list
zipfile 2GB problems?
Hi fellas, I am experiencing problems reading a 2GB zipfile consisting of multiple zipped files. I found a thread http://mail.python.org/pipermail/python-dev/2005-April/053027.html that mentions a problem on the writing side, does such a problem exist on a reading side? I am using 2.4.1, perhaps there is a fix in a later version? -- http://mail.python.org/mailman/listinfo/python-list
Re: zipfile 2GB problems?
On Jul 15, 12:35 am, xamdam <[EMAIL PROTECTED]> wrote: > Hi fellas, > I am experiencing problems reading a 2GB zipfile consisting of > multiple zipped files. I found a thread > http://mail.python.org/pipermail/python-dev/2005-April/053027.html > that mentions a problem on the writing side, does such a problem exist > on a reading side? I am using 2.4.1, perhaps there is a fix in a later > version? Additional info: my file is from a data provider, do not know what they used to compress it. Previous files worked ok, this one is the 1st over 2GB. Winzip has no problem with it. -- http://mail.python.org/mailman/listinfo/python-list
Re: zipfile 2GB problems?
> Hi, > I use PKZIP V9.00 and maintain a 2.5GB zipfile that consists of over > 6,600 zipped files. > There is no problem with reading or writing. > Thanks, > Jim Which version of Python? What platform? thanks, max -- http://mail.python.org/mailman/listinfo/python-list
Re: zipfile 2GB problems?
> > > Additional info: my file is from a data provider, do not know what > > they used to compress it. Previous files worked ok, this one is the > > 1st over 2GB. Winzip has no problem with it. > > It could be you are using a Python with an in-built limit of 2GB on file > size. What happens if you open the file, seek past the 2GB point and > then try and read data? > Steve, I used is_zipfile function, which from does exactly that from a quick read - goes to the end, reads expected string. It worked fine. Tried regular Windows 2.4.4 and 2.5.1, same result. -- http://mail.python.org/mailman/listinfo/python-list
Re: zipfile 2GB problems?
On Jul 15, 5:39 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > xamdam wrote: > >>> Additional info: my file is from a data provider, do not know what > >>> they used to compress it. Previous files worked ok, this one is the > >>> 1st over 2GB. Winzip has no problem with it. > >> It could be you are using a Python with an in-built limit of 2GB on file > >> size. What happens if you open the file, seek past the 2GB point and > >> then try and read data? > > > Steve, > > I used is_zipfile function, which from does exactly that from a quick > > read - goes to the end, reads expected string. It worked fine. Tried > > regular Windows 2.4.4 and 2.5.1, same result. > > Fine, if it isn't file size limitations I suspect you need to post some > code and a traceback so we can get better insight into exactly what the > problem is. > It's failing in the ZipFile constructor, which ends up throwing zipfile(2.4.3).py:291> raise BadZipfile, "Bad magic number for file header" -- http://mail.python.org/mailman/listinfo/python-list
Re: zipfile 2GB problems?
On Jul 16, 3:39 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > xamdam wrote: > > On Jul 15, 5:39 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > >> xamdam wrote: > >>>>> Additional info: my file is from a data provider, do not know what > >>>>> they used to compress it. Previous files worked ok, this one is the > >>>>> 1st over 2GB. Winzip has no problem with it. > >>>> It could be you are using a Python with an in-built limit of 2GB on file > >>>> size. What happens if you open the file, seek past the 2GB point and > >>>> then try and read data? > >>> Steve, > >>> I used is_zipfile function, which from does exactly that from a quick > >>> read - goes to the end, reads expected string. It worked fine. Tried > >>> regular Windows 2.4.4 and 2.5.1, same result. > >> Fine, if it isn't file size limitations I suspect you need to post some > >> code and a traceback so we can get better insight into exactly what the > >> problem is. > > > It's failing in the ZipFile constructor, which ends up throwing > > > zipfile(2.4.3).py:291> raise BadZipfile, "Bad magic number for file > > header" > > Well, that one bald line by itself certainly doesn't give *me* any > traction an what the problem might be. Getting information about this > problem is like (i.e. as difficult as) pulling teeth! > > regards > Steve Well, Steve, I don't know what else to tell you - I certainly do not want to cause you tooth ache! I was sort of hoping for some ZIP expert to go, 'oh, yeah'... -- http://mail.python.org/mailman/listinfo/python-list
Market simulations with Python
I am interested in market simulation with Python, simulating buyers and sellers arriving with goods at random times. I looked at SimPy, it's pretty nice, but all the examples are around congestion problems. Should I a) dig deeper b) write something from scratch c) look at another library? thanks, max. -- http://mail.python.org/mailman/listinfo/python-list
appropriate python version
Sorry if this is a stupid q, I am trying to figure out the appropriate version of Python(2.4 or 2.5) for an XP 64 system running on an Intel Core2 Quad. Python.org has a to a 64bit build, but it specifies Itanium as the target. Should I just be using the regular build? I was also thinking of getting the Enthought edition (http:// code.enthought.com/enthon/) - would their binary work with the setup, and what would be the downside of using it over the special 64bit build? thanks, max. -- http://mail.python.org/mailman/listinfo/python-list
Re: appropriate python version
Thanks. I am guessing the 32bit build should work anyways, same as other 32 progs on XP 64? -- http://mail.python.org/mailman/listinfo/python-list
SDMX format
Does anyone know of python libs for writing SDMX XML format? http://www.SDMX.org/resources/SDMXML/schemas/v2_0/common thanks, max. -- http://mail.python.org/mailman/listinfo/python-list
