Reminder: Python Bug Day on Saturday

2009-04-23 Thread Georg Brandl
Hi, I'd like to remind everyoone that there will be a Python Bug Day on April 25. As always, this is a perfect opportunity to get involved in Python development, or bring your own issues to attention, discuss them and (hopefully) resolve them together with the core developers. We will

Re: Programming in Python with a view to extending in C at a later date.

2009-04-23 Thread Stefan Behnel
Hi, dug.armad...@googlemail.com wrote: Say you set out to program in Python knowing that you will be converting parts of it into C ( or maybe C++) at a later date, but you do not know which parts. Can you give any general Python structure / syntax advice that if implemented from the start,

regular expresions and dolar sign ($) in source string

2009-04-23 Thread Jax
Hi I encountered problem with dolar sign in source string. It seems that $ require special threatening. Below is copy of session with interactive Python's shell: Python 2.5.2 (r252:60911, Jan 8 2009, 12:17:37) [GCC 4.3.2] on linux2 Type help, copyright, credits or license for more information.

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread Patrick Mullen
On Wed, Apr 22, 2009 at 9:33 PM, David Lyon david.l...@preisshare.net wrote: Hi Steve, Why should the package developer dictacte which python version the package will run on ? Because they're the developer. Who else should decide what Python versions to support? The developer shouldn't be

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread Daniel Fetchinson
Why? Why should every package on PyPI need to support all those Python versions? That should be the decision of the package maintainer. If they want to support every version of Python back to 1.0, they can, and if they want to only support version 2.5 that's fine too. Why shouldn't packages

Memory problems (garbage collection)

2009-04-23 Thread Carbon Man
Very new to Python, running 2.5 on windows. I am processing an XML file (7.2MB). Using the standard library I am recursively processing each node and parsing it. The branches don't go particularly deep. What is happening is that the program is running really really slowly, so slow that even

Re: regular expresions and dolar sign ($) in source string

2009-04-23 Thread Peter Otten
Jax wrote: I encountered problem with dolar sign in source string. It seems that $ require special threatening. Below is copy of session with interactive Python's shell: Python 2.5.2 (r252:60911, Jan 8 2009, 12:17:37) [GCC 4.3.2] on linux2 Type help, copyright, credits or license for

Re: python command not working

2009-04-23 Thread 83nini
On 23 Apr, 02:25, Dave Angel da...@ieee.org wrote: 83nini wrote: Christian, at last i made the bat file (python25.bat) that contains the following contents: --- @C:\Python25\python.exe %* --- could you tell me how to call python25 in the batch files? what batch files do you

Re: Memory problems (garbage collection)

2009-04-23 Thread Gerhard Häring
Carbon Man wrote: Very new to Python, running 2.5 on windows. I am processing an XML file (7.2MB). Using the standard library I am recursively processing each node and parsing it. The branches don't go particularly deep. What is happening is that the program is running really really

Re: Memory problems (garbage collection)

2009-04-23 Thread Gerhard Häring
Here's a link for you: http://wiki.python.org/moin/PythonSpeed/PerformanceTips which also talks about string concatenation and othere do's and don'ts. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread Steven D'Aprano
On Wed, 22 Apr 2009 23:47:08 -0700, Daniel Fetchinson wrote: Why? Why should every package on PyPI need to support all those Python versions? That should be the decision of the package maintainer. If they want to support every version of Python back to 1.0, they can, and if they want to only

Supply a plugin interface

2009-04-23 Thread Johannes Bauer
Hello group, I'm developing a GUI application in Python and having a blast so far :-) What I'd like to add: I want the GUI users to supply plugin scripts, i.e. offer some kind of API. That is, I want the user to write short Python pieces which look something like import guiapp class

a py2exe feature for non-windows environments

2009-04-23 Thread Tzury Bar Yochay
Hi, The nicest thing I like about py2exe is its library.zip which encapsulate all the dependencies into one single file. I wonder if there a script which can do the same for linux/mac osx so one can ship a python solution as a single file (instead of starting easy_install per used library on the

Re: a py2exe feature for non-windows environments

2009-04-23 Thread Chris Rebert
On Thu, Apr 23, 2009 at 1:13 AM, Tzury Bar Yochay afro.syst...@gmail.com wrote: Hi, The nicest thing I like about py2exe is its library.zip which encapsulate all the dependencies into one single file. I wonder if there a script which can do the same for linux/mac osx so one can ship a python

Re: Memory problems (garbage collection)

2009-04-23 Thread Peter Otten
Carbon Man wrote: Very new to Python, running 2.5 on windows. I am processing an XML file (7.2MB). Using the standard library I am recursively processing each node and parsing it. The branches don't go particularly deep. What is happening is that the program is running really really slowly,

Re: a py2exe feature for non-windows environments

2009-04-23 Thread Tzury Bar Yochay
Mac OS X:http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html Found these for linux: http://www.pyinstaller.org/ http://wiki.python.org/moin/Freeze thanks alot -- http://mail.python.org/mailman/listinfo/python-list

Re: Ending data exchange through multiprocessing pipe

2009-04-23 Thread Michal Chruszcz
On Apr 22, 6:33 pm, MRAB goo...@mrabarnett.plus.com wrote: You could do this:      from multiprocessing.queues import Empty      queue = Queue()      Process(target=f, args=(queue,)).start()      while active_children():          try:              print queue.get(timeout=1)          

Re: Supply a plugin interface

2009-04-23 Thread Ulrich Eckhardt
Johannes Bauer wrote: What I'd like to add: I want the GUI users to supply plugin scripts, i.e. offer some kind of API. That is, I want the user to write short Python pieces which look something like import guiapp class myplugin(): def __init__(self): guiapp.add_menu(foobar) def

Re: Supply a plugin interface

2009-04-23 Thread Steven D'Aprano
On Thu, 23 Apr 2009 09:47:56 +0200, Johannes Bauer wrote: Hello group, I'm developing a GUI application in Python and having a blast so far :-) What I'd like to add: I want the GUI users to supply plugin scripts, i.e. offer some kind of API. That is, I want the user to write short Python

Re: Python Packages : A looming problem?

2009-04-23 Thread Lawrence D'Oliveiro
In message mailman.4395.1240441756.11746.python-l...@python.org, David Lyon wrote: There are now over 6,000 packages listed on PyPi - and this number can only get bigger. Then, there are the three major operating systems: * Windows * Mac * Linix/Unix Major Linux distros provide

Re: Python, MS SQL, and batch inserts

2009-04-23 Thread Lawrence D'Oliveiro
In message mailman.4414.1240468019.11746.python-l...@python.org, Dennis Lee Bieber wrote: You don't mean to say you are creating full SQL insert statements WITH THE DATA! Nothing wrong with that http://codecodex.com/wiki/index.php?title=Useful_MySQL_Routines. --

Re: Python, MS SQL, and batch inserts

2009-04-23 Thread Lawrence D'Oliveiro
In message mailman.4293.1240337749.11746.python-l...@python.org, Philip Semanchuk wrote: Are you sure your logjam is in Python? Inserting 5500 rows can take a few seconds if you're COMMITting after each INSERT. Wrap the whole thing in an explicit transaction and see if that helps. Does

Reminder: Python Bug Day on Saturday

2009-04-23 Thread Georg Brandl
Hi, I'd like to remind everyoone that there will be a Python Bug Day on April 25. As always, this is a perfect opportunity to get involved in Python development, or bring your own issues to attention, discuss them and (hopefully) resolve them together with the core developers. We will

New fonts for python docs site

2009-04-23 Thread Mark
e.g. see http://docs.python.org/library/index.html Please tell me this is a mistake? 3.X docs are the same. -- http://mail.python.org/mailman/listinfo/python-list

Re: New fonts for python docs site

2009-04-23 Thread Marco Mariani
Mark wrote: e.g. see http://docs.python.org/library/index.html Please tell me this is a mistake? 3.X docs are the same. Looks ok. What do you see? -- http://mail.python.org/mailman/listinfo/python-list

Re: WINXP vs. LINUX in threading.Thread

2009-04-23 Thread Kent
Thanx you guys. Now my program is working. I used the Thread subclass. and at the end of the run method, i call wx.CallAfter(mainFrame.somefunction, para) to show the dialog or change some text. I tested in winxplinux. both worked. Kent On Apr 23, 6:16 am, Carl Banks pavlovevide...@gmail.com

Re: Supply a plugin interface

2009-04-23 Thread Almar Klein
Hi, I did this a few times and put the code that loads the plugins in the __init__.py of the plugin directory. You then do not have to do the path stuff. You can also make a rule that the class defined in each plugin module should be a certain name, for example the same name as the module (but

Re: New fonts for python docs site

2009-04-23 Thread Mark
On Thu, 23 Apr 2009 11:41:45 +0200, Marco Mariani wrote: Looks ok. What do you see? Hmm, I was seeing a ugly jagged bit-mapped font, but only on the docs.python.org site. So I cleared out my firefox cache and restarted and it now looks fine. Never seen that one before. Sorry for the now silly

Re: Ending data exchange through multiprocessing pipe

2009-04-23 Thread Michal Chruszcz
On Apr 22, 10:30 pm, Scott David Daniels scott.dani...@acm.org wrote: Michal Chruszcz wrote: ... First idea, which came to my mind, was using a queue. I've got many producers (all of the workers) and one consumer. Seams quite simple, but it isn't, at least for me. I presumed that each

Re: and [True,True] -- [True, True]?????

2009-04-23 Thread Leo
Steven D'Aprano wrote: On Mon, 20 Apr 2009 15:13:15 -0500, Grant Edwards wrote: I fail to see the difference between length greater than 0 and list is not empty. They are, by definition, the same thing, aren't they? For built-in lists, but not necessarily for arbitrary list-like

Large data arrays?

2009-04-23 Thread Ole Streicher
Hi, for my application, I need to use quite large data arrays (100.000 x 4000 values) with floating point numbers where I need a fast row-wise and column-wise access (main case: return a column with the sum over a number of selected rows, and vice versa). I would use the numpy array for that,

Re: and [True,True] -- [True, True]?????

2009-04-23 Thread Peter Otten
Leo wrote: Steven D'Aprano wrote: On Mon, 20 Apr 2009 15:13:15 -0500, Grant Edwards wrote: I fail to see the difference between length greater than 0 and list is not empty. They are, by definition, the same thing, aren't they? For built-in lists, but not necessarily for arbitrary

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread David Stanek
On Thu, Apr 23, 2009 at 2:47 AM, Daniel Fetchinson fetchin...@googlemail.com wrote: The OP is just thinking out loud that it would be great if developers could count on some help for testing various platforms and versions. And I agree, it would indeed be great. I think you interpreted the OP

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread David Stanek
On Thu, Apr 23, 2009 at 12:33 AM, David Lyon david.l...@preisshare.net wrote: Hi Steve, Why should the package developer dictacte which python version the package will run on ? Because they're the developer. Who else should decide what Python versions to support? The developer shouldn't be

Re: Ending data exchange through multiprocessing pipe

2009-04-23 Thread Jesse Noller
On Thu, Apr 23, 2009 at 5:15 AM, Michal Chruszcz mchrus...@gmail.com wrote: On Apr 22, 10:30 pm, Scott David Daniels scott.dani...@acm.org wrote: Michal Chruszcz wrote: ... First idea, which came to my mind, was using a queue. I've got many producers (all of the workers) and one consumer.

Re: pyflakes, pylint, pychecker - and other tools

2009-04-23 Thread Nick Craig-Wood
Colin J. Williams c...@ncf.ca wrote: Esmail wrote: What is the consensus of the Python community regarding these code checkers? In particular, are the stylistic recommendations that pylint makes considered sensible/valid? pylint seems a bit heavy handled, a bit too much PEP 8,

Re: Large data arrays?

2009-04-23 Thread Nick Craig-Wood
Ole Streicher ole-usenet-s...@gmx.net wrote: for my application, I need to use quite large data arrays (100.000 x 4000 values) with floating point numbers where I need a fast row-wise and column-wise access (main case: return a column with the sum over a number of selected rows, and vice

Re: Memory footpring of python objects

2009-04-23 Thread Nick Craig-Wood
BlueBird p...@freehackers.org wrote: I have a program that manages several thousands instances of one object. To reduce memory consumption, I want of course that specific object to have the smallest memory footpring possible. I have a few ideas that I want to experiment with, like

Using optparse

2009-04-23 Thread loial
A shell script is passing parameters to my python script in the following format -PARAM1 12345 -PARAM2 67890 Can I parse these with optparse ? If so how? I can't seem to get it to work. It seems to expect --PARAM1 and -- PARAM2 -- http://mail.python.org/mailman/listinfo/python-list

Help with code! Gamepad?

2009-04-23 Thread DC16
I am using pygame and OpenGL. How do I make a gamepad able to move the camera to a side of a cube on screen. Here is the code for keyboard use: import pygame from pygame.locals import * import sys from OpenGLLibrary import * pygame.init() Screen = (800,600) Window =

Re: need help with a multiloop error

2009-04-23 Thread MRAB
John Machin wrote: On Apr 23, 10:54 am, delc...@gmail.com wrote: Here is a little more of the code? Does this help at all? Not much. MRAB asked what is str2bool. Instead of answering the question, you have supplied some code which is calling str2bool (and doing interesting things if it

Re: Supply a plugin interface

2009-04-23 Thread R. David Murray
Ulrich Eckhardt eckha...@satorlaser.com wrote: Johannes Bauer wrote: What I'd like to add: I want the GUI users to supply plugin scripts, i.e. offer some kind of API. That is, I want the user to write short Python pieces which look something like import guiapp class myplugin():

Re: Ending data exchange through multiprocessing pipe

2009-04-23 Thread MRAB
Michal Chruszcz wrote: On Apr 22, 6:33 pm, MRAB goo...@mrabarnett.plus.com wrote: You could do this: from multiprocessing.queues import Empty queue = Queue() Process(target=f, args=(queue,)).start() while active_children(): try: print

Unicode in writing to a file

2009-04-23 Thread Carbon Man
Py 2.5 Trying to write a string to a file. self.dataUpdate.write(u\nentry.+node.tagName+ u = + cValue) cValue contains a unicode character. node.tagName is also a unicode string though it has no special characters in it. Getting the error: UnicodeEncodeError: 'ascii' codec can't encode character

Re: and [True,True] -- [True, True]?????

2009-04-23 Thread Hrvoje Niksic
Peter Otten __pete...@web.de writes: The only popular data structure I know that implements its length like this are strings in C. Linked lists and trees also tend to do the same, with the exception of those that explicitly store their length to optimize length queries. --

Re: Memory problems (garbage collection)

2009-04-23 Thread Carbon Man
Thanks for the help. I converted everything into the StringIO() format. Memory is still getting chewed up. I will look at ElementTree later but for now I believe the speed issue must be related to the amount of memory that is getting used. It is causing all of windows to slow to a crawl.

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread Marco Mariani
David Lyon wrote: What if I decide to write only to Python 3? Fair enough. But don't forget it is open source. So what? Let me ask these two questions... - What about the use case where somebody likes the code and wants to use it on Python 2.5? A patch, a fork, whatever. -

Re: Using optparse

2009-04-23 Thread Peter Otten
loial wrote: A shell script is passing parameters to my python script in the following format -PARAM1 12345 -PARAM2 67890 Can I parse these with optparse ? If so how? I can't seem to get it to work. It seems to expect --PARAM1 and -- PARAM2 You are out of luck. Quoting

Re: Unicode in writing to a file

2009-04-23 Thread Marco Mariani
Carbon Man wrote: Py 2.5 Trying to write a string to a file. self.dataUpdate.write(u\nentry.+node.tagName+ u = + cValue) cValue contains a unicode character. node.tagName is also a unicode string though it has no special characters in it. So what's the encoding of your file? If you didn't

Re: Unicode in writing to a file

2009-04-23 Thread Diez B. Roggisch
Carbon Man wrote: Py 2.5 Trying to write a string to a file. self.dataUpdate.write(u\nentry.+node.tagName+ u = + cValue) cValue contains a unicode character. node.tagName is also a unicode string though it has no special characters in it. Getting the error: UnicodeEncodeError: 'ascii'

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread David Lyon
On Thu, 23 Apr 2009 07:04:35 -0400, David Stanek dsta...@dstanek.com wrote: If I use win32com how do you expect me to support Linux? Of course not... What about the many packages on PYPI containing C? Exactly. What if I decide to write only to Python 3? Fair enough. But don't forget

Re: Unicode in writing to a file

2009-04-23 Thread Ulrich Eckhardt
Carbon Man wrote: self.dataUpdate.write(u\nentry.+node.tagName+ u = + cValue) cValue contains a unicode character. node.tagName is also a unicode string though it has no special characters in it. Getting the error: UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in position

Re: Unicode in writing to a file

2009-04-23 Thread Peter Otten
Carbon Man wrote: Py 2.5 Trying to write a string to a file. self.dataUpdate.write(u\nentry.+node.tagName+ u = + cValue) cValue contains a unicode character. node.tagName is also a unicode string though it has no special characters in it. Getting the error: UnicodeEncodeError: 'ascii'

Re: Large data arrays?

2009-04-23 Thread Ole Streicher
Hi Nick, Nick Craig-Wood n...@craig-wood.com writes: mmaps come out of your applications memory space, so out of that 3 GB limit. You don't need that much RAM of course but it does use up address space. Hmm. So I have no chance to use = 2 of these arrays simultaniously? Sorry don't know

Re: sorting two corresponding lists?

2009-04-23 Thread Piet van Oostrum
Saketh saketh.bhamidip...@gmail.com (S) wrote: S Why not use a dictionary instead of two lists? Then you can sort the S dictionary by value -- e.g. S d = dict(zip(items, values)) S sorted_items = sorted(d.iteritems(), key=lambda (k,v): (v,k)) S This produces a list of pairs, but demonstrates

Re: Ending data exchange through multiprocessing pipe

2009-04-23 Thread Paul Boddie
On 22 Apr, 17:43, Michal Chruszcz mchrus...@gmail.com wrote: I am adding support for parallel processing to an existing program which fetches some data and then performs some computation with results saved to a database. Everything went just fine until I wanted to gather all of the results

Cleaning out the cobwebs in the PEP cupboard

2009-04-23 Thread Larry Hastings
There are some PEPs that seem to be stuck in a perpetual limbo, never to be decided upon. Some of them seem hopelessly antiquated now--they were proposed long ago and the language has moved on. With every passing day it becomes less likely they will ever be Accepted. On the off chance

Re: gethostbyname blocking

2009-04-23 Thread Piet van Oostrum
marc wyburn marc.wyb...@googlemail.com (MW) wrote: MW Hi, I am writing an asynchronous ping app to check if 1000s of hosts MW are alive very quickly. Everything works extremely quickly unless the MW host name doesn't have a DNS record. MW when calling socket.gethostbyname if there is no record

OT: a metacomment on feedback comments

2009-04-23 Thread Aaron Watters
I just noticed this on my documentation page. http://aaron.oirt.rutgers.edu/myapp/docs/W.intro This is quite possible the most confusing web framework ever. It really deserves some kind of award in a special category. This was posted just after someone on the same computer (somewhere in

Re: WINXP vs. LINUX in threading.Thread

2009-04-23 Thread Mike Driscoll
On Apr 22, 2:57 pm, Kent kent.y...@gmail.com wrote: hello all, i want to add a new update notification feature to my wxPython appl. The codes below do the job. The logic is simple enough, I don't think it needs to be explained. since sometimes, under windows, proxy setting was a script. and

Re: Memory problems (garbage collection)

2009-04-23 Thread Christian Heimes
Peter Otten wrote: Like Gerhard says, in the long run you are probably better off with ElementTree. In the long run it's even better to use lxml [1]. It's the fastest und most powerful XML library for Python. It also supports element tree. Christian [1] http://codespeak.net/lxml/ --

Re: Python Packages : A looming problem?

2009-04-23 Thread Paul Boddie
On 23 Apr, 10:59, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: The Linux solution is to leave distro packaging to the distro maintainers. Release the source, and they will make up the necessary packages for their specific one-click installers. You don't have to worry about it.

Configuring pylint for local conventions (was: pyflakes, pylint, pychecker - and other tools)

2009-04-23 Thread Ben Finney
a...@pythoncraft.com (Aahz) writes: Second, you can configure pylint to respect your personal style How? I haven't seen any decent documentation on doing so. -- \ “When we call others dogmatic, what we really object to is | `\ their holding dogmas that are different from our

Re: OT: a metacomment on feedback comments

2009-04-23 Thread Paul Boddie
On 23 Apr, 15:22, Aaron Watters aaron.watt...@gmail.com wrote: This was posted just after someone on the same computer (somewhere in Texas) tried and failed to inject some javascript into the page using a comment. This just means that you may have reached the Reddit crowd. Don't worry,

Re: gethostbyname blocking

2009-04-23 Thread Jean-Paul Calderone
On Thu, 23 Apr 2009 15:16:56 +0200, Piet van Oostrum p...@cs.uu.nl wrote: marc wyburn marc.wyb...@googlemail.com (MW) wrote: MW Hi, I am writing an asynchronous ping app to check if 1000s of hosts MW are alive very quickly. Everything works extremely quickly unless the MW host name doesn't

Re: Help with code! Gamepad?

2009-04-23 Thread Mike Driscoll
On Apr 23, 6:46 am, DC16 luster...@gmail.com wrote: I am using pygame and OpenGL. How do I make a gamepad able to move the camera to a side of a cube on screen. Here is the code for keyboard use: import pygame from pygame.locals import * import sys from OpenGLLibrary import *

Cython + tuple unpacking

2009-04-23 Thread Hugues Salamin
Hello, The following code will crash with a segfault when compiled using cython (v0.11) def func(): for (a, b) ,c ,d in zip(zip(range(3), range(3)), range(3), range(3)): print a, b print c print d # This line segfault Compilation is done using distutils. If the

Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Jeremy Banks
Hi. I'm sure there've been debates about this before, but I can't seem to figure out what to search for to pull them up, so I'm asking here. It seems to me that a lot of things could be made much easier if you could use primaries other than basic identifiers for the target of function

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Gary Herron
Jeremy Banks wrote: Hi. I'm sure there've been debates about this before, but I can't seem to figure out what to search for to pull them up, so I'm asking here. It seems to me that a lot of things could be made much easier if you could use primaries other than basic identifiers for the target

value error

2009-04-23 Thread Francesco Pietra
hi: with script data = open('134-176_rectified_edited.pdb', 'r') outp = open('134-176_renumbered.pdb', 'w') for L in data: if L[3] == 'M': L = L[:24] + %4d % (int(L[24-28])+133) + L[28:] outp.write(L) i wanted to modify lines of the type: ATOM 1 HH31 ACE 1 1.573

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Jeremy Banks
Thanks for your comments. On Thu, Apr 23, 2009 at 11:52, Gary Herron gher...@islandtraining.com wrote: [...] There's no need for a specific addition to the syntax to do this. Try this:   def foo_bar():       return(...)   foo.bar = foo_bar [...] and this:   def foo_bar():      

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Alan Franzoni
Jeremy Banks was kind enough to say: Hi. I'm sure there've been debates about this before, but I can't seem to figure out what to search for to pull them up, so I'm asking here. I'm not exactly sure what you mean... if you want to add functions to another fuction, just do it this way: def

Re: Configuring pylint for local conventions (was: pyflakes, pylint, pychecker - and other tools)

2009-04-23 Thread Jeremiah Dodds
On Thu, Apr 23, 2009 at 2:58 PM, Ben Finney ben+pyt...@benfinney.id.auben%2bpyt...@benfinney.id.au wrote: a...@pythoncraft.com (Aahz) writes: Second, you can configure pylint to respect your personal style How? I haven't seen any decent documentation on doing so. -- \ “When we

Re: value error

2009-04-23 Thread Gerhard Häring
Francesco Pietra wrote: hi: with script data = open('134-176_rectified_edited.pdb', 'r') outp = open('134-176_renumbered.pdb', 'w') for L in data: if L[3] == 'M': L = L[:24] + %4d % (int(L[24-28])+133) + L[28:] outp.write(L) i wanted to modify lines of the type: ATOM

Re: value error

2009-04-23 Thread Ben Finney
Francesco Pietra chiendar...@gmail.com writes: $ python renumber.py 134-176_rectified.pdb Traceback (most recent call last): File renumber.py, line 6, in module L = L[:24] + %4d % (int(L[24-28])+133) + L[28:] ValueError: invalid literal for int() with base 10: '' For this reason, it's

Re: value error

2009-04-23 Thread Jeremiah Dodds
On Thu, Apr 23, 2009 at 3:59 PM, Francesco Pietra chiendar...@gmail.comwrote: hi: with script data = open('134-176_rectified_edited.pdb', 'r') outp = open('134-176_renumbered.pdb', 'w') for L in data: if L[3] == 'M': L = L[:24] + %4d % (int(L[24-28])+133) + L[28:] outp.write(L)

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Gary Herron
Jeremy Banks wrote: Thanks for your comments. On Thu, Apr 23, 2009 at 11:52, Gary Herron gher...@islandtraining.com wrote: [...] There's no need for a specific addition to the syntax to do this. Try this: def foo_bar(): return(...) foo.bar = foo_bar [...]

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Jeremy Banks
Things like your suggestion are called syntactic-sugar  -- syntax that adds a convenience, but *no* new functionality.  Python has plenty of syntactic-sugars, and more will be added in the future.  To make an argument for such an addition, one would have to describe some compelling (and

Re: Regular expression to capture model numbers

2009-04-23 Thread Piet van Oostrum
John Machin sjmac...@lexicon.net (JM) wrote: JM On Apr 23, 8:01 am, krishnaposti...@gmail.com wrote: Requirements:   The text must contain a combination of numbers, alphabets and hyphen with at least two of the three elements present. JM Unfortunately(?), regular expressions can't express

Numpy Performance

2009-04-23 Thread timlash
Still fairly new to Python. I wrote a program that used a class called RectangularArray as described here: class RectangularArray: def __init__(self, rows, cols, value=0): self.arr = [None]*rows self.row = [value]*cols def __getitem__(self, (i, j)): return (self.arr[i] or

Re: Using optparse

2009-04-23 Thread Piet van Oostrum
loial jldunn2...@googlemail.com (L) wrote: L A shell script is passing parameters to my python script in the L following format L -PARAM1 12345 -PARAM2 67890 L Can I parse these with optparse ? If so how? L I can't seem to get it to work. It seems to expect --PARAM1 and -- L PARAM2 See the

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread Daniel Fetchinson
Why? Why should every package on PyPI need to support all those Python versions? That should be the decision of the package maintainer. If they want to support every version of Python back to 1.0, they can, and if they want to only support version 2.5 that's fine too. Why shouldn't packages

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread Daniel Fetchinson
The OP is just thinking out loud that it would be great if developers could count on some help for testing various platforms and versions. And I agree, it would indeed be great. I think you interpreted the OP differently. As I said before the idea is not a bad one, but as a package

Re: OT: a metacomment on feedback comments

2009-04-23 Thread Johannes Bauer
Aaron Watters schrieb: This was posted just after someone on the same computer (somewhere in Texas) tried and failed to inject some javascript into the page using a comment. Script-kid moron. Delete and enjoy your life. I don't see how this comment is helpful to me or anyone reading the

Re: Configuring pylint for local conventions (was: pyflakes, pylint, pychecker - and other tools)

2009-04-23 Thread Aahz
In article 874owf4gky.fsf...@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: a...@pythoncraft.com (Aahz) writes: Second, you can configure pylint to respect your personal style How? I haven't seen any decent documentation on doing so. Actually, I don't know how, I'm just

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Jeremy Banks
On Thu, Apr 23, 2009 at 13:03, John Krukoff jkruk...@ltgc.com wrote: You probably want to be searching for multi-line lambda to find the past decade or so of this argument, as that's where most people who argued for this came from. But, if you'd just like a bit of discouragement, here's GvR

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread John Krukoff
On Thu, 2009-04-23 at 12:26 -0300, Jeremy Banks wrote: Things like your suggestion are called syntactic-sugar -- syntax that adds a convenience, but *no* new functionality. Python has plenty of syntactic-sugars, and more will be added in the future. To make an argument for such an

Re: Numpy Performance

2009-04-23 Thread Peter Otten
timlash wrote: Still fairly new to Python. I wrote a program that used a class called RectangularArray as described here: class RectangularArray: def __init__(self, rows, cols, value=0): self.arr = [None]*rows self.row = [value]*cols def __getitem__(self, (i, j)):

Re: Supply a plugin interface

2009-04-23 Thread Aahz
In article 75akp8f17g29...@mid.dfncis.de, Johannes Bauer dfnsonfsdu...@gmx.de wrote: the GUI application should now browse the plugin directory and read those plugin python files and somehow incorporate (i.e. discover what modules are there, instanciate, etc.) How do I do that at runtime with

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Marco Mariani
Jeremy Banks wrote: I've read those discussion before, but somehow never made the connection between those and this. I'll give that article a read, it probably details exactly the perspective I'm looking for. Thank you! You could also read this:

Re: pylab quick reference? (matplotlib)

2009-04-23 Thread Esmail
Arnaud Delobelle wrote: python -c 'import pylab; help(pylab)' pylab.txt Do you know pydoc? From the (shell) command line, try: $ pydoc pylab # piped through less $ pydoc pylab pylab.txt # stored in a file $ pydoc -w pylab # Creates a 'pylab.html' file wrote

Re: Essential tools for Python development

2009-04-23 Thread Esmail
Jeremiah Dodds wrote: pdb is good if you need to do step-through debugging. What I normally do in emacs is the following (while working on python script, and with the python-mode that comes with emacs22): C-x 3 #splits the screen into two vertical columns C-c C-c #fires up python and

Re: Essential tools for Python development

2009-04-23 Thread Esmail
Alex VanderWoude wrote: I really like using Winpdb (http://winpdb.org/) which provides a GUI for pdb. It allows you to single-step your code and inspect objects in memory. What exactly is in that silly nextOne variable? Hey, it's a list rather but it's supposed to be a number! You get

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread Paul Boddie
On 23 Apr, 17:46, Daniel Fetchinson fetchin...@googlemail.com wrote: You and I probably have a different approach to posts to c.l.p. I try to interpret things in the best possible light and get the most out of a suggestion. There may be merit in the suggestion, but there also has to be

Re: sorting two corresponding lists?

2009-04-23 Thread Esmail
My solution, I know the 'zip' version is more elegant, this is just for fun:) items = ['apple', 'car', 'town', 'phone'] values = [5, 2, 7, 1] new_values = sorted(values, reverse = True) new_items = [items[x] for x in [i for i in map(values.index, new_values)]] print(new_values)

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread Scott David Daniels
Daniel Fetchinson wrote: I don't think every package should work on every platform and with every version of python. But I do think that many developers want to support more platforms and versions than what they have access to. Having a test farm would be beneficial to these developers and their

Re: Python Packages : A looming problem? packages might no longer work? (well not on your platform or python version anyway)

2009-04-23 Thread norseman
(and or machine architecture) not in possession for testing compatibility in cases where it's an issue. But then just asking usually gets it done. :) Today is: 20090423 Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Large data arrays?

2009-04-23 Thread Scott David Daniels
Ole Streicher wrote: Nick Craig-Wood n...@craig-wood.com writes: mmaps come out of your applications memory space, so out of that 3 GB limit. You don't need that much RAM of course but it does use up address space. Hmm. So I have no chance to use = 2 of these arrays simultaniously? ... That

Windows Shell Extensions - Out of Proc

2009-04-23 Thread Ralf
I'm trying to develop Windows Shell Extensions with the Python Win32 Extensions. Most of the samples are working. However, I have a slightly different need: I want the Python COM server to run as a separate process (LocalServer or OutOfProc). As I understand, both the InProc and LocalServer

Re: JOB: Statistical Programmer | LOCATION: London, England, UK

2009-04-23 Thread Scott David Daniels
jt wrote: JOB: Statistical Programmer ... Job postings are not in order here, they are off-topic. If you go to http://www.python.org/community/jobs/ You will see a jobs posting board that will happily post your job. --Scott David Daniels scott.dani...@acm.org --

  1   2   3   >