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 "li

Re: python command not working

2009-04-23 Thread 83nini
On 23 Apr, 02:25, Dave Angel 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 sl

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 the

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 myplugin():

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 t

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 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 solution as a si

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 slow

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 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) >          except Empty: >      

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") >

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 >

Re: Python Packages : A looming problem?

2009-04-23 Thread Lawrence D'Oliveiro
In message , 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 20,000 or more packages each, without breaking a

Re: Python, MS SQL, and batch inserts

2009-04-23 Thread Lawrence D'Oliveiro
In message , 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://mail.python.org/mailman/listinfo/python-list

Re: Python, MS SQL, and batch inserts

2009-04-23 Thread Lawrence D'Oliveiro
In message , 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 MS-SQL have the equivalent of "insert delayed"

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 coordinate

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 winxp&linux. both worked. Kent On Apr 23, 6:16 am, Carl Banks wrote: > On Apr 22, 5:34

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 st

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 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 worker will put() >

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

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, b

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 necessa

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 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 differently. As I sa

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 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 making such

Re: Ending data exchange through multiprocessing pipe

2009-04-23 Thread Jesse Noller
On Thu, Apr 23, 2009 at 5:15 AM, Michal Chruszcz wrote: > On Apr 22, 10:30 pm, Scott David Daniels > 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

Re: pyflakes, pylint, pychecker - and other tools

2009-04-23 Thread Nick Craig-Wood
Colin J. Williams 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 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 versa). > > I wou

Re: Memory footpring of python objects

2009-04-23 Thread Nick Craig-Wood
BlueBird 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 > __slots__,

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 = glLibWindow(Screen,caption

Re: need help with a multiloop error

2009-04-23 Thread MRAB
John Machin wrote: On Apr 23, 10:54 am, [email protected] 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 fails)

Re: Supply a plugin interface

2009-04-23 Thread R. David Murray
Ulrich Eckhardt 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(): > > def __i

Re: Ending data exchange through multiprocessing pipe

2009-04-23 Thread MRAB
Michal Chruszcz wrote: On Apr 22, 6:33 pm, MRAB 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) except Empty:

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 charac

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

2009-04-23 Thread Hrvoje Niksic
Peter Otten <[email protected]> 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. -- http://mail.pyt

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. gc.coll

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. - Should

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 http

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

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: '

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 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 it is open source

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 >

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: '

Re: Large data arrays?

2009-04-23 Thread Ole Streicher
Hi Nick, Nick Craig-Wood 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 very much about n

Re: sorting two corresponding lists?

2009-04-23 Thread Piet van Oostrum
> Saketh (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 the general ide

Re: Ending data exchange through multiprocessing pipe

2009-04-23 Thread Paul Boddie
On 22 Apr, 17:43, Michal Chruszcz 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 from the subproce

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 tha

Re: gethostbyname blocking

2009-04-23 Thread Piet van Oostrum
> marc wyburn (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 for the host

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 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 was > set

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/ -- http://

Re: Python Packages : A looming problem?

2009-04-23 Thread Paul Boddie
On 23 Apr, 10:59, Lawrence D'Oliveiro 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. And the crucial message, that

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

2009-04-23 Thread Ben Finney
[email protected] (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 own

Re: OT: a metacomment on feedback comments

2009-04-23 Thread Paul Boddie
On 23 Apr, 15:22, Aaron Watters 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, though: ten seconds afte

Re: gethostbyname blocking

2009-04-23 Thread Jean-Paul Calderone
On Thu, 23 Apr 2009 15:16:56 +0200, Piet van Oostrum wrote: marc wyburn (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

Re: Help with code! Gamepad?

2009-04-23 Thread Mike Driscoll
On Apr 23, 6:46 am, DC16 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 * > > pygame.init() > >

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 modul

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 definitions.

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 of

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 1.

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 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(): >       return(...

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 fo

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 > wrote: > [email protected] (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

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

Re: value error

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

Re: value error

2009-04-23 Thread Jeremiah Dodds
On Thu, Apr 23, 2009 at 3:59 PM, 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 wa

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 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 Jeremy Banks
> Things like your suggestion are called "syntactic-sugar"  -- syntax that > adds a convenience, but *no* new functionality.  Python has plenty of > "syntactic-sugar"s, and more will be added in the future.  To make an > argument for such an addition, one would have to describe some compelling > (a

Re: Regular expression to capture model numbers

2009-04-23 Thread Piet van Oostrum
> John Machin (JM) wrote: >JM> On Apr 23, 8:01 am, [email protected] 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 comp

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 (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 doc: Som

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.

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 packag

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

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

2009-04-23 Thread Aahz
In article <[email protected]>, Ben Finney wrote: >[email protected] (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 repeating what was claime

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 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 arguing that the

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-sugar"s, and more will be added in the future. To make an > > argument for su

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 <[email protected]>, Johannes Bauer 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 Python? You m

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: http://unlimitednovelty.com/2009/03/indentation

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 pyl

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 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 Paul Boddie
On 23 Apr, 17:46, Daniel Fetchinson 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 skepticism, even if it is re

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

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
: It would be nice to have access to an OS (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 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 would be a solution

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 ve

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 [email protected] -- http://mail.python.org/mail

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

2009-04-23 Thread Scott David Daniels
Jeremy Banks wrote: (proposing def (): ... On Thu, Apr 23, 2009 at 11:52, Gary Herron wrote: Try this: def foo_bar(): return(...) foo.bar = foo_bar and this: def foo_bar(): return(...) foo["bar"] = foo_bar I understand that this is possible now, but I just don't see why it'

Presentation software for Python code

2009-04-23 Thread Michael Hoffman
I mean to give a presentation next week to my workgroup on good Python programming practice. Last time I did a Python presentation I used PowerPoint which was not totally well-suited for the task. In particular, formatting code snippets was a pain, and they weren't even prettyprinted. Does an

Re: Windows Shell Extensions - Out of Proc

2009-04-23 Thread Thomas Heller
Ralf schrieb: > 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

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 1:12 PM, norseman wrote: > > BB's, User Lists, all repositories can make these required before > acceptance. > > This is open source. I volunteer my time on the projects that I maintain. If you don't like the quality or lack of documentations, tests, etc. Contribute. Or ju

Re: Presentation software for Python code

2009-04-23 Thread John Reid
Michael Hoffman wrote: Does anyone here have software they would suggest for making a presentation that includes Python code? Other than that it would probably be mainly bullet points. I'm willing to consider TeX- and HTML-based approaches. I like pygments for formatting python code. It can g

Re: Presentation software for Python code

2009-04-23 Thread Scott David Daniels
Michael Hoffman wrote: ... Does anyone here have software they would suggest for making a presentation that includes Python code? Other than that it would probably be mainly bullet points. I'm willing to consider TeX- and HTML-based approaches. You might take a look at Crunchy, and just do up

  1   2   >