Re: dynamic allocation file buffer

2008-09-11 Thread Aaron "Castironpi" Brady
On Sep 12, 1:30 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 11 Sep 2008 22:40:01 -0700, Dennis Lee Bieber wrote: > > On 12 Sep 2008 03:37:51 GMT, Steven D'Aprano > > <[EMAIL PROTECTED]> declaimed the following in > > comp.lang.python: > > >> I'm pretty sure you're wrong. XML can be use

Re: dynamic allocation file buffer

2008-09-11 Thread Steven D'Aprano
On Thu, 11 Sep 2008 22:40:01 -0700, Dennis Lee Bieber wrote: > On 12 Sep 2008 03:37:51 GMT, Steven D'Aprano > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > > >> I'm pretty sure you're wrong. XML can be used for serialization, but >> that doesn't mean it is only sequential

Re: How to Determine Name of the Day in the Week

2008-09-11 Thread Tino Wildenhain
Henry Chang wrote: Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; is there a way to get the actual names, such as "Monday ... Sunday"? I would like to do this without creating a data mapping. :) The 'actual names' in which language? Chinese, Russian, French, ... :)

Re: hashing an array - howto

2008-09-11 Thread sudhi . herle
On Sep 5, 9:38 am, Helmut Jarausch <[EMAIL PROTECTED]> wrote: > Hi, > > I need to hash arrays of integers (from the hash module). > > So, I have to derive from array and supply a __hash__ method. I don't believe you need to derive from an array. Here are two simple and well known hash functions y

Re: function return

2008-09-11 Thread Matt Nordhoff
Gabriel Genellina wrote: > En Thu, 11 Sep 2008 10:59:10 -0300, Matt Nordhoff > <[EMAIL PROTECTED]> escribió: > >>>result = "%s\t%s\t%s" %(id,gene_symbol,ptms) >> >> This is very trivial, but you could change the above line to: >> >>result = "\t".join(id, gene_symbol, ptms)

Re: dynamic allocation file buffer

2008-09-11 Thread Aaron "Castironpi" Brady
On Sep 11, 10:37 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 11 Sep 2008 10:20:41 -0700, Aaron \"Castironpi\" Brady wrote: > > XML is the wrong word for the example I was thinking of (as was already > > pointed out in another thread).  XML is by definition sequential. > > I'm pretty su

Problem on getting date column in SQLObject

2008-09-11 Thread CL (Ciu Loeng) Lam
Hi,all:I make the SQLObject as the ORM in turbogears ,now I meet a problems on selecting records for a given date . Here is the define for my class: class updateHistory(SQLObject): actionTime = DateTimeCol(default=datetime.now) actionContent = UnicodeCol(length=500,default="") Then how ca

Re: dynamic allocation file buffer

2008-09-11 Thread Steven D'Aprano
On Thu, 11 Sep 2008 10:20:41 -0700, Aaron \"Castironpi\" Brady wrote: > XML is the wrong word for the example I was thinking of (as was already > pointed out in another thread). XML is by definition sequential. I'm pretty sure you're wrong. XML can be used for serialization, but that doesn't me

Re: wx

2008-09-11 Thread Mahdi
if you just type "python wx" you will get 2,080,000 results. The first by luck (not chance) is wxPython. it scares me when ppl start to post on newsgroups before even searching in the web for a second! how old r u Mr. Chance not Choice? on 09/12/2008 02:32 AM Fredrik Lundh wrote : Desmon

Re: rss feed generation

2008-09-11 Thread Walter Cruz
On Tue, Sep 9, 2008 at 9:35 PM, alex23 <[EMAIL PROTECTED]> wrote: > On Sep 10, 7:30 am, "Blake Garner" <[EMAIL PROTECTED]> wrote: >> I'm looking for suggestions on how to approach generating rss feed >> .xml files using python. What modules to people recommend I start >> with? pylons webhelpers ma

Re: catching exceptions from fortran

2008-09-11 Thread Gabriel Genellina
En Thu, 11 Sep 2008 10:43:08 -0300, john <[EMAIL PROTECTED]> escribió: I wrapped some fortran code using F2PY and need to be able to catch fortran runtime errors to run the following: [reindented] # "grid" is a wrapped fortran module # no runtime errors incurred when run with the correct inpu

Re: dict slice in python (translating perl to python)

2008-09-11 Thread MRAB
On Sep 11, 6:11 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: [snip] > (the next step towards true Pythonicness would be to store your data in > class instances instead of dictionaries in the first place, but one step > at a time...) > Surely the word is "Pythonicity"? :-) -- http://mail.python.org/

Re: function return

2008-09-11 Thread Gabriel Genellina
En Thu, 11 Sep 2008 10:59:10 -0300, Matt Nordhoff <[EMAIL PROTECTED]> escribió: result = "%s\t%s\t%s" %(id,gene_symbol,ptms) This is very trivial, but you could change the above line to: result = "\t".join(id, gene_symbol, ptms) So trivial that you did not even attem

Re: SSH using PEXPECT

2008-09-11 Thread yellowblueyellow
On Sep 10, 7:01 pm, Sean DiZazzo <[EMAIL PROTECTED]> wrote: > On Sep 10, 6:04 pm, [EMAIL PROTECTED] wrote: > > > > > Hey , I need toSSHinto a server .. (10.8.42.38) usingpexpectthe > > username is 'admin' and password is 'abc123' so far i have the > > following code > > > importpexpect > > import s

Re: Accessing __slots__ from C

2008-09-11 Thread Christian Heimes
Chris wrote: Ok, thanks for the confirmation. We'd been hoping to avoid creating such a struct... Don't worry, a C extension with its own struct isn't hard to write. Your C code can access the member variables w/o using any Python API. You'll get the full speed of C. :] Christian -- http:/

Re: dynamic allocation file buffer

2008-09-11 Thread Paul Boddie
On 11 Sep, 19:31, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > > An acquaintance suggests that defragmentation would be a useful > service to provide along with memory management too, which also > requires an index. I presume that you mean efficient access to large amounts of data in

Re: Accessing __slots__ from C

2008-09-11 Thread Carl Banks
On Sep 10, 7:41 am, Chris <[EMAIL PROTECTED]> wrote: > Hi, > > I'd like to be able to access an attribute of a particular Python > object as fast as possible from some C code. > > I wondered if using __slots__ to store the attribute would allow me to > do this in a faster way. > > The reason I'd li

Re: Adding environment variables to bash.

2008-09-11 Thread Craig Allen
On Sep 11, 10:25 am, nntpman68 <[EMAIL PROTECTED]> wrote: > >> doesn't exactly work for Python scripts, though: > > >> $ cat env.py > >> #!/usr/bin/env python > >> import os > >> os.environ["TEST"] = "hello" > > >> $ . ./env.py && env | grep TEST > >> import: unable to open X server `'. > >> bash:

Finding tcltk when building Python on Windows

2008-09-11 Thread Chris
Hi, I'm trying to build Python on Windows using Visual Studio 2005. I have no trouble compiling tcl/tk 8.5, but when I subsequently build Python it doesn't find tcl/tk (I get a message about being unable to find tcl.h). I'm using the source distribution of Python 2.5.2, not the svn version. I'm t

Re: Is len O(n) or O(1) ?

2008-09-11 Thread skip
>> ok but if len is O(1) then it doesnt matter? compared to >> if not lista: >> return [] >> i mean. Depends on how often the test is performed, e.g.: >>> def f(a): ... if not a: return [] ... >>> dis.dis(f) 2 0 LOAD_FAST

Re: Is len O(n) or O(1) ?

2008-09-11 Thread Fredrik Lundh
process wrote: ok but if len is O(1) then it doesnt matter? compared to if not lista: return [] what doesn't matter? -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding environment variables to bash.

2008-09-11 Thread nntpman68
doesn't exactly work for Python scripts, though: $ cat env.py #!/usr/bin/env python import os os.environ["TEST"] = "hello" $ . ./env.py && env | grep TEST import: unable to open X server `'. bash: os.environ[TEST]: command not found There's two options for the desperate ones. 1. Assumin

Re: Is len O(n) or O(1) ?

2008-09-11 Thread process
ok but if len is O(1) then it doesnt matter? compared to if not lista: return [] i mean. -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing __slots__ from C

2008-09-11 Thread Chris
Hrvoje Niksic xemacs.org> writes: ... > [ You can use the capi-sig for questions like this; see > http://mail.python.org/mailman/listinfo/capi-sig ] Thanks, I had no idea about that. > PyObject_GetAttrString is convenient, but it creates a Python string > only so it can intern it (and in most

Re: Accessing __slots__ from C

2008-09-11 Thread Chris
Christian Heimes cheimes.de> writes: ... > You can use slots to increase the performance but it doesn't work > like you think. If you need it *really* fast than write a C > Extension, store the data in a C struct and access the data via > PyMemberDef. Ok, thanks for the confirmation. We'd been ho

Re: PLEASE HELP ME WITH THIS ASSIGNMENT...PLEASE....

2008-09-11 Thread Timothy Grant
On Thu, Sep 11, 2008 at 12:02 PM, Daniel Fetchinson <[EMAIL PROTECTED]> wrote: > > >>> Thanking you, >>> >>> Ms. Vaidehi Pawar >> >> How much do you pay? >> >>> How much do you ask for >>> >>> cheers >>> Ms. Vaidehi > > I was just kidding. But if you seriously need people to do this kind > of

Re: Is there a SOAP module that can do this...?

2008-09-11 Thread Waldemar Osuch
On Sep 11, 3:50 am, thebjorn <[EMAIL PROTECTED]> wrote: > On Sep 10, 9:44 pm, Waldemar Osuch <[EMAIL PROTECTED]> wrote: > > > > > On Sep 10, 1:23 pm, thebjorn <[EMAIL PROTECTED]> > > wrote:> I've been trying to use SOAPpy and ZSI (with and without the use of > > > wsdl2py) to communicate with a SOA

Re: PLEASE HELP ME WITH THIS ASSIGNMENT...PLEASE....

2008-09-11 Thread Daniel Fetchinson
>> Thanking you, >> >> Ms. Vaidehi Pawar > > How much do you pay? > >> How much do you ask for >> >> cheers >> Ms. Vaidehi I was just kidding. But if you seriously need people to do this kind of job it's better to post the amount you are willing to pay otherwise nobody will take it seriously

Re: huge socket recv speed discrepancy between different OSs

2008-09-11 Thread Thorben Krueger
If you follow the bug report, you might notice that this is probably an issue of socket flags. I know that *BSD and Linux handle sockets slightly differently, but that about covers my knowledge of these things. Maybe a solution can be found simply by setting the right flags for the socket... Any i

Re: huge socket recv speed discrepancy between different OSs

2008-09-11 Thread Dan Stromberg
On Thu, 11 Sep 2008 16:17:58 +0200, Thorben Krueger wrote: > Do you see this too? > > Mor information and testcase here: > > http://bugs.python.org/issue3766 > > I would also be interested in the profiler output under windows. > > All the best > Thorben I regret that I don't have a lot of tim

Re: Python platform.

2008-09-11 Thread Sean DiZazzo
On Sep 11, 11:39 am, Sean DiZazzo <[EMAIL PROTECTED]> wrote: > On Sep 11, 9:59 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > > I want to build a desktop application. I am searching for some kind of > > > environment that would provide all the elements ready (Wi

Re: Python platform.

2008-09-11 Thread Sean DiZazzo
On Sep 11, 9:59 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I want to build a desktop application. I am searching for some kind of > > environment that would provide all the elements ready (Windows...). > > Then I would have to code the business logic only. > > start

Re: wx

2008-09-11 Thread Fredrik Lundh
Desmond Scott E wrote: I'm am a Python novice by chance not choice. (Although it appears to be a nice tool. Plus anything based on Monte Python can't be bad!) My Quest is to migrate a Python-based process from Windows2000/Python v2.4.2 (#67) to WindowsXP/Python v2.5.2 (r252:60911). I've s

Re: wx

2008-09-11 Thread Nikola Stjelja
The module you are talking about is a python GUI toolkit named WxPython, which is a port of the cross platform C++ GUI toolkit wxwidgets. It's an excelent gui toolkit , easy to learn and code on. Well documented and has an excelent community around it. Here are the links for both sites: http://www.

Re: shelve file name extention

2008-09-11 Thread Fredrik Lundh
Monu wrote: So Can't I choose which module to use. Is there any preferance on which shelve chooses these modules? it uses the anydbm module to look for available DBM-style drivers, which looks for modules in the following order: dbhash, gdbm, dbm, dumbdbm. if you know which one you want, yo

wx

2008-09-11 Thread Desmond Scott E
I'm am a Python novice by chance not choice. (Although it appears to be a nice tool. Plus anything based on Monte Python can't be bad!) My Quest is to migrate a Python-based process from Windows2000/Python v2.4.2 (#67) to WindowsXP/Python v2.5.2 (r252:60911). I've searched the Python website and

Re: Please help me finding a way to implement os.path.issubpath(a, b)

2008-09-11 Thread Fredrik Lundh
Diez B. Roggisch wrote: Any reason why os.path.normpath(a).startswith(os.normpath(b)) doesn't do the trick? Except for the trivial type, you mean? That depends on whether "c:\foo" should be seen as a subpath to "c:\foobar" or not. I'd probably go for (also untested): def issubpath(a, b)

Re: shelve file name extention

2008-09-11 Thread Monu
On Sep 8, 1:47 pm, [EMAIL PROTECTED] wrote: >     Monu> When I am using shelve on my local machine it generates the db >     Monu> file as given filename. But in another machine it's generating >     Monu> .dat and .dir.  can anyone tell me how can I force sheve >     Monu> module to write the db i

Re: shelve file name extention

2008-09-11 Thread Monu
On Sep 8, 1:47 pm, [EMAIL PROTECTED] wrote: >     Monu> When I am using shelve on my local machine it generates the db >     Monu> file as given filename. But in another machine it's generating >     Monu> .dat and .dir.  can anyone tell me how can I force sheve >     Monu> module to write the db i

Re: Please help me finding a way to implement os.path.issubpath(a, b)

2008-09-11 Thread Diez B. Roggisch
Giampaolo Rodola' schrieb: Hi, I'm trying to implement a function which returns whether a path is a subpath of another one (e.g. /a/b/c is a subpath of /a/b). I wrote this function which apparently seems to work fine: import os def issubpath(path1, path2): """Return True if path1 is a sub p

Re: conditional install/distribution

2008-09-11 Thread Diez B. Roggisch
i3dmaster schrieb: Is there a feature in distutils or easy_install to specify what version of python that the target package can be installed? For example, if a package has a module that only needed if the python version < 2.6, is there a way to specifiy that in setup.py or easy_install cfg file

Re: Please help me finding a way to implement os.path.issubpath(a, b)

2008-09-11 Thread Arnaud Delobelle
On Sep 11, 5:40 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Hi, > I'm trying to implement a function which returns whether a path is a > subpath of another one (e.g. /a/b/c is a subpath of /a/b). > I wrote this function which apparently seems to work fine: > > import os > > def issubpath(p

Re: dict slice in python (translating perl to python)

2008-09-11 Thread Aaron "Castironpi" Brady
On Sep 11, 10:52 am, hofer <[EMAIL PROTECTED]> wrote: > On Sep 11, 10:36 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > >I'd type the explicit > > >  v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars > Either > > is only a couple more > > characters to  type.  It is completely

Re: Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread MRAB
On Sep 11, 4:48 pm, Manuel Ebert <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Ah, well. Don't know whether it meets your aesthetic standards, but: >  >>> my_list = ['tree', 'hug', 'flower', 'hug', 'bear', 'run'] >  >>> my_list[0:len(a):2] > ['tree', 'flower', 'be

Re: dynamic allocation file buffer

2008-09-11 Thread Aaron "Castironpi" Brady
On Sep 11, 5:35 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 11 Sep, 10:34, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > > And as I said before, the only use case for *huge* XML files I've ever > > seen used in practice is to store large streams of record-style data; > > I can imagine that t

Re: How to Determine Name of the Day in the Week

2008-09-11 Thread Henry Chang
Awesome, that worked. Thanks so much! On Thu, Sep 11, 2008 at 10:16 AM, Fredrik Lundh <[EMAIL PROTECTED]>wrote: > Henry Chang wrote: > > Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; >> is there a way to get the actual names, such as "Monday ... Sunday"? I >> would l

Re: dynamic allocation file buffer

2008-09-11 Thread Aaron "Castironpi" Brady
On Sep 11, 2:40 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 10 Sep 2008 11:59:35 -0700, Aaron \"Castironpi\" Brady wrote: > > On Sep 10, 5:24 am, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > >> On Wed, 10 Sep 2008 09:26:20 +0200, Fredrik Lundh wrote: > >> > Steven D'Aprano wrote: >

Re: How to Determine Name of the Day in the Week

2008-09-11 Thread Fredrik Lundh
Henry Chang wrote: Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; is there a way to get the actual names, such as "Monday ... Sunday"? I would like to do this without creating a data mapping. :) if you have a datetime or date object, you can use strftime with the

Re: dict slice in python (translating perl to python)

2008-09-11 Thread Fredrik Lundh
hofer wrote: The real example would be more like: name,age,country = itemgetter('name age country'.split())(x) ouch. if you do this a lot (=more than once), just wrap your dictionaries in a simple attribute proxy, and use plain attribute access. that is, given class AttributeWrapper:

How to Determine Name of the Day in the Week

2008-09-11 Thread Henry Chang
Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; is there a way to get the actual names, such as "Monday ... Sunday"? I would like to do this without creating a data mapping. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a SOAP module that can do this...?

2008-09-11 Thread Stefan Behnel
thebjorn wrote: > I've been trying to use SOAPpy and ZSI (with and without the use of > wsdl2py) to communicate with a SOAP server (looks like it's a WebLogic > server(?) in front of some enterprise java bean) and not having much > luck. Have you tried using soaplib? I find it very usable and from

ReportLab 2.2 has been released

2008-09-11 Thread Robin Becker
Version 2.2 of the ReportLab open-source toolkit is out! You find downloads and src instructions at http://www.reportlab.org/downloads.html. Contributions = Thanks to everybody who has contributed to the open-source toolkit in the run-up to the 2.2 release, whether by reporting bugs

Re: Use Python to solve equations?

2008-09-11 Thread Kelie
On Sep 11, 1:11 am, Uwe Schmitt <[EMAIL PROTECTED]> wrote: > > Kelie > > look atwww.sagemath.com. it is great. > > greetings, uwe Thanks Uwe! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python platform.

2008-09-11 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I want to build a desktop application. I am searching for some kind of environment that would provide all the elements ready (Windows...). Then I would have to code the business logic only. start here: http://wiki.python.org/moin/GuiProgramming The big ones are Tki

Re: Python platform.

2008-09-11 Thread bearophileHUGS
carriere.jonat...: > I want to build a desktop application. I am searching for some kind of > environment that would provide all the elements ready (Windows...). > Then I would have to code the business logic only. I don't think there's such thing in Python, "all elements ready" sounds strange :-)

Re: XML-RPC "filter"

2008-09-11 Thread Richard Levasseur
On Sep 10, 2:04 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > > > On 9 Set, 17:55, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> I would go for a slightly different approach: make your server have a > >> dispatch-method that delegates the calls to the und

Re: Python platform.

2008-09-11 Thread [EMAIL PROTECTED]
On Sep 11, 11:13 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Sep 11, 4:19 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] wrote: > > >  > I wonder if there is a platform written in python. The equivalent of > >  > the Netbeans platformhttp://platform.netbeans.or

Please help me finding a way to implement os.path.issubpath(a, b)

2008-09-11 Thread Giampaolo Rodola'
Hi, I'm trying to implement a function which returns whether a path is a subpath of another one (e.g. /a/b/c is a subpath of /a/b). I wrote this function which apparently seems to work fine: import os def issubpath(path1, path2): """Return True if path1 is a sub path of path2.""" if path1

conditional install/distribution

2008-09-11 Thread i3dmaster
Is there a feature in distutils or easy_install to specify what version of python that the target package can be installed? For example, if a package has a module that only needed if the python version < 2.6, is there a way to specifiy that in setup.py or easy_install cfg file so that when installi

Re: Gateway to python-list is generating bounce messages.

2008-09-11 Thread Grant Edwards
On 2008-09-11, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 10 Sep 2008 21:36:36 -0500, Grant Edwards <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> Wrong. I didn't send _any_ e-mail. Why should I get bounce >> messages? >> > One: Comp.lang.python is dua

Re: dict slice in python (translating perl to python)

2008-09-11 Thread bearophileHUGS
hofer: > The real example would be more like: > name,age,country = itemgetter('name age country'.split())(x) # or any > of my above versions That solution is very clever, and the inventor smart, but it's too much out of standard and complex to be used in normal real code. Learning tricks is useful

Re: Better error message on recursive import

2008-09-11 Thread Marc 'BlackJack' Rintsch
On Thu, 11 Sep 2008 12:43:34 +0200, Thomas Guettler wrote: > why does Python only raise ImportError if it fails caused by a recursive > import? > > I know what's wrong. But I guess many beginner don't know what's wrong. > I don't want much, just "RecursiveImportError" instead of "ImportError". >

Re: Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread andy_westken
On Sep 11, 4:48 pm, Manuel Ebert <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Ah, well. Don't know whether it meets your aesthetic standards, but: >  >>> my_list = ['tree', 'hug', 'flower', 'hug', 'bear', 'run'] >  >>> my_list[0:len(a):2] > ['tree', 'flower', 'be

Re: dict slice in python (translating perl to python)

2008-09-11 Thread hofer
On Sep 11, 10:36 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >I'd type the explicit > > v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars > Either > is only a couple more > characters to type.  It is completely > explicit and comprehensible to everyone, in comparison to > >  

Re: dict slice in python (translating perl to python)

2008-09-11 Thread hofer
Thanks a lot for all your answers. There's quite some things I learnt :-) [v1,v2,v3] = ... can be typed as v1,v2,v3 = . . . I also wasn't used to map(myhash.get, ['one', 'two', 'two']) itemgetter('one', 'one', 'two')(x) I also didn't know print "%(one)s\n%(two)s\n%(two)s" % mydict The reason

Re: Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread Manuel Ebert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ah, well. Don't know whether it meets your aesthetic standards, but: >>> my_list = ['tree', 'hug', 'flower', 'hug', 'bear', 'run'] >>> my_list[0:len(a):2] ['tree', 'flower', 'bear'] >>> my_list[1:len(a):2] ['hug', 'hug', 'run'] and hence >>> zip(my_

Re: emulating read and readline methods

2008-09-11 Thread MRAB
On Sep 11, 9:23 am, Sean Davis <[EMAIL PROTECTED]> wrote: > On Sep 10, 7:54 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > > On Sep 11, 8:01 am, MRAB <[EMAIL PROTECTED]> wrote: > > > > On Sep 10, 6:59 pm, Sean Davis <[EMAIL PROTECTED]> wrote: > > > > > I have a large file that I would like to t

Re: Gateway to python-list is generating bounce messages.

2008-09-11 Thread Sjoerd Mullender
Grant Edwards <[EMAIL PROTECTED]> writes: > Could whoever is responsible for the gateway that is grabbing > my postings off of Usenet and e-mailing them out please fix the > headers in the mail messages so that I don't get the bounce > messages? > > While you're at it, might as well fix it for

Re: Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread andy_westken
On Sep 11, 4:04 pm, Manuel Ebert <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi Andy, > > by the looks of it I'd say that the problem is that the second   > parameter you passed to start_element is not a dictionary at all (the   > clue is in the "AttributeError:

Re: Python platform.

2008-09-11 Thread [EMAIL PROTECTED]
On Sep 11, 4:19 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >  > I wonder if there is a platform written in python. The equivalent of >  > the Netbeans platformhttp://platform.netbeans.org/in the Python >  > world. Do you know such a thing? > > You (or maybe the Java f

Re: Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread Manuel Ebert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Andy, by the looks of it I'd say that the problem is that the second parameter you passed to start_element is not a dictionary at all (the clue is in the "AttributeError: 'LIST' object" ...). >>> d = ['tree', 'house'] >>> start_element("Thin

Re: Gateway to python-list is generating bounce messages.

2008-09-11 Thread Grant Edwards
On 2008-09-11, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 11 Sep 2008 15:25:57 +1000, Ben Finney wrote: > >>> > The bounce messages are sent to you because you sent the original. >>> >>> Wrong. I didn't send _any_ e-mail. Why should I get bounce messages? >> >> You asked for email to

Enumerating ordered expat attributes with tuplets?

2008-09-11 Thread andy_westken
Hi I'm new to Python and trying to pick up good, idiomatic usage right from the offset. As I was familiar with Expat from C++ (directly and via expatpp) I'm trying to write a little script - using xml.parsers.expat - to search and replace XML attribute values. As I want the attributes to stay in

Re: Python platform.

2008-09-11 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I wonder if there is a platform written in python. The equivalent of > the Netbeans platform http://platform.netbeans.org/ in the Python > world. Do you know such a thing? You (or maybe the Java folks) seem to have missed that platform has a rather specific meaning in

huge socket recv speed discrepancy between different OSs

2008-09-11 Thread Thorben Krueger
Do you see this too? Mor information and testcase here: http://bugs.python.org/issue3766 I would also be interested in the profiler output under windows. All the best Thorben -- http://mail.python.org/mailman/listinfo/python-list

Python platform.

2008-09-11 Thread [EMAIL PROTECTED]
Hello all; I wonder if there is a platform written in python. The equivalent of the Netbeans platform http://platform.netbeans.org/ in the Python world. Do you know such a thing? Thanks a lot. Jonathan. -- http://mail.python.org/mailman/listinfo/python-list

Re: function return

2008-09-11 Thread Matt Nordhoff
Beema Shafreen wrote: > hi all, > > I have a script using functions , I have a problem in returning the > result. My script returns only one line , i donot know where the looping > is giving problem, Can any one suggest, why this is happening and let me > know how to return all the lines > > def

Re: Python and Open Office

2008-09-11 Thread Marco Bizzarri
Greg, as an addition to what I already said to you, you can consider taking a look at oood from ERP5 project http://wiki.erp5.org/HowToUseOood OOOd (openoffice.org daemon) runs openoffice behind the scene, and allows you to interact with it via XML-RPC; it should be quite robust, since it is acti

Re: function return

2008-09-11 Thread Beema Shafreen
thanks for your valuable comments. I could solve the problem wiht your comments On Thu, Sep 11, 2008 at 7:07 PM, Fredrik Lundh <[EMAIL PROTECTED]>wrote: > make that: > > note that you put the "return" statement inside the loop, so returning >> only one line is the expected behaviour. >> > > to f

Re: NumPy arrays that use memory allocated from other libraries or tools

2008-09-11 Thread Travis Oliphant
sturlamolden wrote: On Sep 10, 6:39 am, Travis Oliphant <[EMAIL PROTECTED]> wrote: I wanted to point anybody interested to a blog post that describes a useful pattern for having a NumPy array that points to the memory created by a different memory manager than the standard one used by NumPy.

catching exceptions from fortran

2008-09-11 Thread john
I wrapped some fortran code using F2PY and need to be able to catch fortran runtime errors to run the following: # "grid" is a wrapped fortran module # no runtime errors incurred when run with the correct inputs for filetype #--- def readGrid( self, coord='xyz'

RE: removing text string

2008-09-11 Thread Ahmed, Shakir
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, September 11, 2008 8:54 AM To: python-list@python.org Subject: Re: removing text string Ahmed, Shakir: > Actually the number I am getting it is from slicing from a long tex

Re: Python and Open Office

2008-09-11 Thread Peter Georgeson
On Sep 11, 7:04 am, "Colin J. Williams" <[EMAIL PROTECTED]> wrote: > Marco Bizzarri wrote: > > On Wed, Sep 10, 2008 at 10:04 PM, Greg Lindstrom <[EMAIL PROTECTED]> wrote: > >> Hello, > > >> I would like to create and manipulate Open Office documents using Python.   > >> I > >> have found then UNO P

Re: function return

2008-09-11 Thread Fredrik Lundh
make that: note that you put the "return" statement inside the loop, so returning only one line is the expected behaviour. to fix this, you can append the result strings to the data_lis list inside the loop: result = "%s\t%s\t%s" %(id,gene_symbol,ptms) data_lis.append(r

Re: function return

2008-09-11 Thread Fredrik Lundh
Beema Shafreen wrote: I have a script using functions , I have a problem in returning the result. My script returns only one line , i donot know where the looping is giving problem, Can any one suggest, why this is happening and let me know how to return all the lines def get_ptm(): fh =

Re: removing text string

2008-09-11 Thread bearophileHUGS
Ahmed, Shakir: > Actually the number I am getting it is from slicing from a long text > line. I need to slice 10 characters from that line but no string only > numeric numbers. When I am slicing 10 characters those A, c, O is coming > at the end. It's better to avoid Regular expressions when they

Re: how dump a program which is running in memory

2008-09-11 Thread Wojtek Walczak
On Thu, 11 Sep 2008 02:31:23 -0700 (PDT), ruqiang826 wrote: > I have written a service running backgroud to do something in linux. > unfortunately$B!$(BI deleted the source code by mistake, and I can still > see the process running background using "ps aux" : > > username 13820 0.0 0.0 60368

function return

2008-09-11 Thread Beema Shafreen
hi all, I have a script using functions , I have a problem in returning the result. My script returns only one line , i donot know where the looping is giving problem, Can any one suggest, why this is happening and let me know how to return all the lines def get_ptm(): fh = open('file.txt',

Re: problem with interpreter

2008-09-11 Thread Diez B. Roggisch
chusky wrote: > Hi ! > > I have Python installed on C:\Python25 > Yesterday I added new "wx" library to the Python > > when I run C:\Python25\python.exe from the command line there is a > problem with finding libraries: > > C:\Python25>python.exe > Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:4

Re: problem with interpreter

2008-09-11 Thread Fredrik Lundh
chusky wrote: File "C:\Python25\Lib\site-packages\wx-2.8-msw-ansi\wx\_core.py", line 5, in < module> import new File "new.py", line 1 import ^ SyntaxError: invalid syntax wxPython tries to import the module "new" from Python's standard library, but picks up a broken modul

RE: removing text string

2008-09-11 Thread Ahmed, Shakir
Thanks Actually the number I am getting it is from slicing from a long text line. I need to slice 10 characters from that line but no string only numeric numbers. When I am slicing 10 characters those A, c, O is coming at the end. Thanks -Original Message- From: [EMAIL PROTECTED] [mail

Re: formating a filesystem with python

2008-09-11 Thread Florian Diesch
"Ricardo Tiago" <[EMAIL PROTECTED]> wrote: > is there a package in python that allows to mount/umount and format > (to ext3) a filesystem? I know that this is possible by just calling > the os commands 'mount/umount and mkfs' but this would imply to have > to change sudoers to run the script as no

Re: Extracing data from webpage

2008-09-11 Thread Alex
On Sep 11, 11:55 am, srinivasan srinivas <[EMAIL PROTECTED]> wrote: > Hi, > I am trying to download data from a webpage. I use mechanize python module. > Could someone tell me how to set/pass an agent like Mozilla or IE that we do > in perl's WWW::Mechanize?? > > Thanks, > Srini > >       Be the f

Re: how dump a program which is running in memory

2008-09-11 Thread Gerhard Häring
ruqiang826 wrote: hi I have written a service running backgroud to do something in linux. unfortunately,I deleted the source code by mistake, and I can still see the process running background using "ps aux" : username 13820 0.0 0.0 60368 2964 ?SAug20 0:33 python ./UpdateJobSta

Re: Persuading ConfigParser to give me the section elements in the same order as the file

2008-09-11 Thread geoffbache
Hi Matt, > Have a look at this:http://www.python.org/dev/peps/pep-0372/ > Thanks, that was very useful. Good to know these things are being considered. > Looking at the config parser module, it looks like there are only a > couple of places where {} is used. I would create a mixin class to > re

Re: Accessing __slots__ from C

2008-09-11 Thread Hrvoje Niksic
[ You can use the capi-sig for questions like this; see http://mail.python.org/mailman/listinfo/capi-sig ] Chris <[EMAIL PROTECTED]> writes: > I'd like to be able to access an attribute of a particular Python > object as fast as possible from some C code. > > I wondered if using __slots__ to sto

Re: I want to use a C++ library from Python

2008-09-11 Thread Uwe Schmitt
On 10 Sep., 09:57, Anders Eriksson <[EMAIL PROTECTED]> wrote: > Hello, > > I have a C++ library compiled as Windows DLL's. It consists of 32 .h and 1 > .lib and 1 .dll files. I don't have the source code. > > How can I create a Python module from these files? Do you need the full library including

Re: Use Python to solve equations?

2008-09-11 Thread Uwe Schmitt
On 11 Sep., 09:09, Kelie <[EMAIL PROTECTED]> wrote: > Hello group, > > Is there any packages in Python that will help me solve functions > similar to this: > > x = a*(1+bx)**2.5-c where a, b, c is known and the task to solve x? > > Thank you, > > Kelie look at www.sagemath.com . it is great. gree

Re: Extracing data from webpage

2008-09-11 Thread Uwe Schmitt
On 11 Sep., 11:55, srinivasan srinivas <[EMAIL PROTECTED]> wrote: > Hi, > I am trying to download data from a webpage. I use mechanize python module. > Could someone tell me how to set/pass an agent like Mozilla or IE that we do > in perl's WWW::Mechanize?? > > Thanks, > Srini > http://wwwsearch.

Re: Adding environment variables to bash.

2008-09-11 Thread John Lawrence
> > doesn't exactly work for Python scripts, though: > True, but you can use it in the following (admittedly messy) way: jl> cat setenv.sh /usr/bin/env python $@ . ./settmp rm settmp jl> cat env.py #!/usr/bin/python command = "export TEST='hello'\n" open('settmp', 'w').write(command) jl> . sete

  1   2   >