[ANN] Game Microwar 2.0 beta 2

2009-09-17 Thread Pierre-Alain Dorange
MicroWar 2.0 beta 2 --- MicroWar is Space Invaders style arcade game, in the cruel world of micro-compter industry. You're a Macintosh faced to invading Wintel hordes year after year, kill more PC. Bonuses let you improve your Mac performances or restore life... PC Hunt is now

[ANN] python-daemon 1.4.8

2009-09-17 Thread Ben Finney
Howdy all, I'm pleased to announce the release of version 1.4.8 of ‘python-daemon’. What is ‘python-daemon’ === The ‘python-daemon’ library is the reference implementation of PEP 3143 URL:http://www.python.org/dev/peps/pep-3143/, “Standard daemon process library”. The

Python-URL! - weekly Python news and links (Sep 17)

2009-09-17 Thread Gabriel Genellina
QOTW: Python the language doesn't try to satisfy all tastes in language design equally. - Guido van Rossum Is it really necesary to explicitely close open files? http://groups.google.com/group/comp.lang.python/t/d794d426a5bef2c1/ Tips for using Unicode text

Re: Zipped and pickle

2009-09-17 Thread Thomas Lehmann
Briefly: s = cPickle.dumps(obj) z = zipfile.Zipfile(filename.zip,w,zipfile.ZIP_DEFLATED) z.writestr(arcname.pkl,s) Thank you very much. I have not been aware that pickle can also do the job without a file! Here's the complete scenario for writing and reading the data... APPENDIX: import

regex search with a space as the fist character

2009-09-17 Thread Daniel Santos
Hello, print re.compile('u ').search( u box2, 1) _sre.SRE_Match object at 0x7ff1d918 print re.compile(' u ').search( u box2, 1) None Why ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Shebang line problems and python

2009-09-17 Thread Johan Grönqvist
Blaine skrev: I'm not sure if there is a Ctrl+Z in here... but, here's the output: bla...@attila ~/tmp $ hexdump shebang-test 000 2123 752f 7273 622f 6e69 702f 7479 6f68 010 0a6e 6d69 6f70 7472 7320 7379 730a 7379 020 732e 6474 756f 2e74 7277 7469 2865 4822 030 6c65 6f6c 202c

Re: Shebang line problems and python

2009-09-17 Thread Blaine
On Sep 16, 9:25 pm, Blaine brlafreni...@gmail.com wrote: Hello, Scripts that have #!/usr/bin/python at the top do not parse correctly. Bash treats scripts with that shebang as if they are bash scripts. E.g.: bla...@attila ~/apps/rs-mu $ /usr/sbin/env-update /usr/sbin/env-update: line 6:

Re: recommendation for webapp testing?

2009-09-17 Thread S.Selvam
On Thu, Sep 17, 2009 at 7:51 AM, Schif Schaf schifsc...@gmail.com wrote: After some more searching I found Mechanize (a Python version of Perl's WWW::Mechanize): http://wwwsearch.sourceforge.net/mechanize/ Anyone here tried it? Yes,mechanize has all the features and very simple to use.

Re: Are min() and max() thread-safe?

2009-09-17 Thread Miles Kaufmann
On Sep 16, 2009, at 10:39 PM, Steven D'Aprano wrote: On Wed, 16 Sep 2009 22:08:40 -0700, Miles Kaufmann wrote: On Sep 16, 2009, at 9:33 PM, Steven D'Aprano wrote: I have two threads, one running min() and the other running max() over the same list. I'm getting some mysterious results which

Re: Shebang line problems and python

2009-09-17 Thread Diez B. Roggisch
Blaine schrieb: Hello, Scripts that have #!/usr/bin/python at the top do not parse correctly. Bash treats scripts with that shebang as if they are bash scripts. E.g.: bla...@attila ~/apps/rs-mu $ /usr/sbin/env-update /usr/sbin/env-update: line 6: import: command not found /usr/sbin/env-update:

Re: regex search with a space as the fist character

2009-09-17 Thread Diez B. Roggisch
Daniel Santos schrieb: Hello, print re.compile('u ').search( u box2, 1) _sre.SRE_Match object at 0x7ff1d918 print re.compile(' u ').search( u box2, 1) None Why ? because you start searching at the offset 1, which means you try to find u in u box2 - and that's not found. Diez --

Re: Are min() and max() thread-safe?

2009-09-17 Thread Hrvoje Niksic
Steven D'Aprano ste...@remove.this.cybersource.com.au writes: min() and max() don't release the GIL, so yes, they are safe, and shouldn't see a list in an inconsistent state (with regard to the Python interpreter, but not necessarily to your application). But a threaded approach is somewhat

Re: recommendation for webapp testing?

2009-09-17 Thread Michele Simionato
On Sep 17, 4:21 am, Schif Schaf schifsc...@gmail.com wrote: After some more searching I found Mechanize (a Python version of Perl's WWW::Mechanize): http://wwwsearch.sourceforge.net/mechanize/ Anyone here tried it? Twill uses mechanize internally. --

Re: Shebang line problems and python

2009-09-17 Thread Rami Chowdhury
I think I've discovered the problem. Someone from IRC had directed me here: http://bugs.gentoo.org/show_bug.cgi?id=279915 I would suggest testing with the Python binary itself in your shebang line (e.g. #!/usr/bin/python2.6, if it's in /usr/bin) to confirm, but that looks like it :-)

Re: Are min() and max() thread-safe?

2009-09-17 Thread John Nagle
Steven D'Aprano wrote: I have two threads, one running min() and the other running max() over the same list. I'm getting some mysterious results which I'm having trouble debugging. Are min() and max() thread-safe, or am I doing something fundamentally silly by having them walk over the same

Re: Compiler.ast helper function literal_eval in python 2.4

2009-09-17 Thread Gabriel Genellina
En Fri, 04 Sep 2009 18:43:28 -0300, Sean Talts xitr...@gmail.com escribió: I'm trying to parse some python with the compiler module, select a subset of the AST returned, and then evaluate that subset, all in python 2.4. It seems like in python 2.6 the compiler.ast.literal_eval function may

Re: recommendation for webapp testing?

2009-09-17 Thread Simon Brunning
2009/9/17 Schif Schaf schifsc...@gmail.com: What's the difference between WebDriver and Selenium? Selenium runs in a browser, and uses JavaScript to perform all your automated actions. It need a browser running to work. Several are supported, Firefox, Safari, IE and I think others. You are at

[ANN] python-daemon 1.4.8

2009-09-17 Thread Ben Finney
Howdy all, I'm pleased to announce the release of version 1.4.8 of ‘python-daemon’. What is ‘python-daemon’ === The ‘python-daemon’ library is the reference implementation of PEP 3143 URL:http://www.python.org/dev/peps/pep-3143/, “Standard daemon process library”. The

Re: An assessment of the Unicode standard

2009-09-17 Thread alex23
Hendrik van Rooyen hend...@microcorp.co.za wrote: The opposite thing is of course a continual source of trouble - we all have words for stuff we have never  seen, like  dragon,  ghost,  goblin,  leprechaun,  the current King of France, God, Allah, The Holy Trinity, Lucifer, Satan, Griffin -

SQLite or files?

2009-09-17 Thread vlad
Hello, I'm a novice in Python and got one question related to the information storage for my application. I'm currently working on rewriting my own the program that stores everyday information sitting in the system tray. It was written in Delphi some time ago and proved to be durable and fast

Re: Are min() and max() thread-safe?

2009-09-17 Thread Paul McGuire
On Sep 16, 11:33 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: I have two threads, one running min() and the other running max() over the same list. I'm getting some mysterious results which I'm having trouble debugging. Are min() and max() thread-safe, or am I doing

Re: weird str error

2009-09-17 Thread Peter Otten
daved170 wrote: On Sep 15, 6:29 pm, Peter Otten __pete...@web.de wrote: daved170 wrote: Hi everybody, I'm using SPE 0.8.3.c as my python editor. I'm using thestr() function and i got a very odd error. I'm trying to do this: printstr(HI) When i'm writing this line in the shell it

Re: Are min() and max() thread-safe?

2009-09-17 Thread Hendrik van Rooyen
On Thursday 17 September 2009 06:33:05 Steven D'Aprano wrote: I have two threads, one running min() and the other running max() over the same list. I'm getting some mysterious results which I'm having trouble debugging. Are min() and max() thread-safe, or am I doing something fundamentally

Re: Looking for a pure Python chart drawing module

2009-09-17 Thread Giacomo Boffi
Vlastimil Brom vlastimil.b...@gmail.com writes: As for BLT, there is Pmw.Blt, the original is written in Tcl. doesn't work (dumps core) on debian linux bug #525860: python-pmw triggers segmentation fault in blt not that blt itself is really OK bug #524149: blt: zooming in a graph

Re: Looking for a pure Python chart drawing module

2009-09-17 Thread Giacomo Boffi
John Nagle na...@animats.com writes: gerlos wrote: John Nagle ha scritto: I'm looking for something that can draw simple bar and pie charts in Python. I'm trying to find a Python package, not a wrapper for some C library, as this has to run on both Windows and Linux and version clashes

Re: Python C/API Problem

2009-09-17 Thread Gabriel Genellina
En Sat, 12 Sep 2009 07:37:18 -0300, Gianfranco Murador miten...@gmail.com escribió: Ok, I solved the previous error changing the second argument , but i have another question. Does PyNode_Compile function store the object code in the file passed as argument? And it will be execute by python?

Re: VT100 in Python

2009-09-17 Thread Nobody
On Mon, 14 Sep 2009 04:29:57 -0500, Nick Craig-Wood wrote: At a basic level parsing VT100 is quite easy, so you can get rid of the VT100 control. They start with ESC, have other characters in the middle then end with a letter (upper or lowercase), so a regexp will make short work of them.

Re: os.execv Overhead

2009-09-17 Thread Nobody
On Wed, 16 Sep 2009 08:12:50 -0700, mark.mcdow...@gmail.com wrote: I have a script that automates running a program X times by preparing the required files and passing the external program right variables. What I am unsure about though is the overhead of: program = externalScript

Re: SQLite or files?

2009-09-17 Thread Tim Chase
info was stored in the simple RTF files. However now I'd like to rewrite this program in Python (using PyQt) as I want to make it cross-platform and add/remove some features. Now I'm thinking about where to store my information. Would it be better to use files as I used to do or use the

xlrd+excel determine decimal separator

2009-09-17 Thread peter
Hi experts, i want to ask you if somebody knows how can I determine, with a help of xlrd, what kind of decimal separator (. or ,) does the user have. Thx in advance. Rg, Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Are min() and max() thread-safe?

2009-09-17 Thread Carl Banks
On Sep 17, 2:18 am, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Thursday 17 September 2009 06:33:05 Steven D'Aprano wrote: I have two threads, one running min() and the other running max() over the same list. I'm getting some mysterious results which I'm having trouble debugging.

Redirect output on script

2009-09-17 Thread glenn.prin...@gmail.com
I would like to redirect the output of the command below to another file type test.txt test.bak I'm trying to do this as part of a python script running on Windows XP. I'm using os.system('type filepath.txt filepath.bak') but nothing is happening. I was wondering if somebody could enlighten

Re: PyQt QCompleter model

2009-09-17 Thread nusch
On Sep 17, 2:40 am, David Boddie da...@boddie.org.uk wrote: On Thursday 17 September 2009 01:14, nusch wrote: The following code: strings=[asdad, baasd, casd, caxd] completer = QCompleter(strings) model = completer.model() print model.rowCount() model.stringList().append(test)

Re: Are min() and max() thread-safe?

2009-09-17 Thread Carl Banks
On Sep 16, 9:33 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: def minmax(seq):     result = [None, None]     t1 = MMThread(seq, min, result, 0)     t2 = MMThread(seq, max, result, 1)     t1.start()     t2.start()     # Block until all threads are done.     while

Load TTF from pycairo under Windows

2009-09-17 Thread Laszlo Nagy
Hi All, I have a program that works under Ubuntu. It loads a TTF font into pycairo, using libfreetype. The code snippet I used was taken from here: http://cairographics.org/freetypepython/ Now I need to use the same program from Microsoft Windows. But Windows does not have libfreetype.so,

Re: SQLite or files?

2009-09-17 Thread ici
I like shelve for saving small amounts of data, user preferences, recent files etc. http://docs.python.org/library/shelve.html For Qt use QtCore.QCoreApplication.setOrganizationName, QtCore.QCoreApplication.setApplicationName than setValue, value from QtCore.QSettings. --

Re: Debugging with gdb: pystack macro for gdb to show python stack trace

2009-09-17 Thread Timothy Madden
Timothy Madden wrote: Hello [...] Can I get the python stack trace working under gdb ? [...] Ok I found some other gdb macros on linked from the wiki page and I had to change them to get the stack trace work. I had to change the symbol PyEval_EvalFrame to PyEval_EvalFrameEx and then I

Re: Redirect output on script

2009-09-17 Thread MRAB
glenn.prin...@gmail.com wrote: I would like to redirect the output of the command below to another file type test.txt test.bak I'm trying to do this as part of a python script running on Windows XP. I'm using os.system('type filepath.txt filepath.bak') but nothing is happening. Try:

Re: Collection console output

2009-09-17 Thread Esben von Buchwald
MRAB wrote: Esben von Buchwald wrote: Hello Are there any simple ways to collect the data, python prints to the console when running an app? I'm doing som apps for S60 mobile phones and can't see the console, when the UI is running, but i'd like to collect the output, to look for eventual

Re: Redirect output on script

2009-09-17 Thread Michel Claveau - MVP
Hi! import os os.system('cmd /c type L:\\source.fic L:\\destination.txt') @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Are min() and max() thread-safe?

2009-09-17 Thread Hendrik van Rooyen
On Thursday 17 September 2009 12:57:18 Carl Banks wrote: On Sep 17, 2:18 am, Hendrik van Rooyen hend...@microcorp.co.za wrote: When running min or max on a list of ints, there is probably no occasion for the function to release the GIL. If a thread doesn't release the GIL no other Python

Re: xlrd+excel determine decimal separator

2009-09-17 Thread John Machin
On Sep 17, 8:40 pm, peter bori...@gmail.com wrote: i want to ask you if somebody knows how can I determine, with a help of xlrd, what kind of decimal separator (. or ,) does the user have. It's nothing to do with xlrd. It reads files and gives you the numbers as Python floats. Note that a user

Re: Python and 3d

2009-09-17 Thread sturlamolden
On 14 Sep, 00:05, Carl Banks pavlovevide...@gmail.com wrote: Dice3DS works fine with PyOpenGL 3.x. PyOpenGL is a bad idea anyway, due to the overhead of Python function calls and ctypes. Doing 3D in pure Python at least requires NumPy arrays as vertex arrays and/or extensive use of display

Re: An assessment of the Unicode standard

2009-09-17 Thread Tim Rowe
2009/9/15 Hendrik van Rooyen hend...@microcorp.co.za: On Monday 14 September 2009 14:06:36 Christopher Culver wrote: This is the old Sapir-Whorf hypothesis, which fell out of favour among linguists half a century ago already. 1) Language does not constrain human thought, and 2) any two human

Re: An assessment of the Unicode standard

2009-09-17 Thread Tom Morris
On 2009-09-15, r rt8...@gmail.com wrote: Are you telling us people using a language that does not have a word for window somehow cannot comprehend what a window is, are you mad man? Words are simply text attributes attached to objects. the text attribute doesn't change the object in any way.

Python-URL! - weekly Python news and links (Sep 17)

2009-09-17 Thread Gabriel Genellina
QOTW: Python the language doesn't try to satisfy all tastes in language design equally. - Guido van Rossum Is it really necesary to explicitely close open files? http://groups.google.com/group/comp.lang.python/t/d794d426a5bef2c1/ Tips for using Unicode text

Re: SQLite or files?

2009-09-17 Thread J Kenneth King
ici iltch...@gmail.com writes: I like shelve for saving small amounts of data, user preferences, recent files etc. http://docs.python.org/library/shelve.html I like it too, but I hear the great powers that be are going to deprecate it. For Qt use

Re: [ANN] python-daemon 1.4.8

2009-09-17 Thread Ben Finney
Ben Finney ben+pyt...@benfinney.id.au writes: The ‘python-daemon’ library is the reference implementation of PEP 3143 URL:http://www.python.org/dev/peps/pep-3143/, “Standard daemon process library”. The source distribution is available via the PyPI page for this version,

Re: Application-global switches?

2009-09-17 Thread Marius Gedminas
On Sep 4, 9:29 pm, kj no.em...@please.post wrote: The only solution I can come up with is to define a dummy module, say _config.py, which contains only upper-case variables representing these global switches, and is imported by all the other modules in the application with the line from

Re: Passing Variables WITHOUT Dynamic URLs

2009-09-17 Thread Victor Subervi
Right. Bad example on my part. How about if I want to pass a cookie from page to page? Or some data called up from a database query? V On Wed, Sep 16, 2009 at 7:30 PM, Rami Chowdhury rami.chowdh...@gmail.comwrote: I like to pass at least browser information from page to page to make pages

Re: Passing Variables WITHOUT Dynamic URLs

2009-09-17 Thread Carsten Haese
Victor Subervi wrote: Right. Bad example on my part. How about if I want to pass a cookie from page to page? Or some data called up from a database query? Cookies are also passed in the header. Results from a database query are best left on the server rather than passing them back and forth

module metadata variables

2009-09-17 Thread Roland Koebler
Hi, many Python-modules contain metadata-variables, like __author__ etc. But most documentation-tools only support some of these variables, and some tools even define their own metadata-variables. So far, I found: - pydoc (- pydoc.py): __author__ __credits__ __date__ __version__

Re: unpacking vars from list of tuples

2009-09-17 Thread Chris Colbert
if you have numpy installed: ln[12]: import numpy as np In [13]: k = np.array([('a', 'bob', 'c'), ('p', 'joe', 'd'), ('x', 'mary', 'z')]) In [14]: k Out[14]: array([['a', 'bob', 'c'], ['p', 'joe', 'd'], ['x', 'mary', 'z']], dtype='|S4') In [15]: k[:,1] Out[15]:

Re: Looking for a pure Python chart drawing module

2009-09-17 Thread Chris Colbert
by your definitions, Python is just a wrapper around a C library. If none of the solutions work for you, roll your own. On Thu, Sep 17, 2009 at 11:38 AM, Giacomo Boffi giacomo.bo...@polimi.it wrote: John Nagle na...@animats.com writes: gerlos wrote: John Nagle ha scritto: I'm looking for

Re: Passing Variables WITHOUT Dynamic URLs

2009-09-17 Thread Victor Subervi
Session variables, yes. That is what I need. Thanks, V On Thu, Sep 17, 2009 at 11:46 AM, Carsten Haese carsten.ha...@gmail.comwrote: Victor Subervi wrote: Right. Bad example on my part. How about if I want to pass a cookie from page to page? Or some data called up from a database query?

Re: Are min() and max() thread-safe?

2009-09-17 Thread ryles
On Sep 17, 7:02 am, Carl Banks pavlovevide...@gmail.com wrote: On Sep 16, 9:33 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: def minmax(seq):     result = [None, None]     t1 = MMThread(seq, min, result, 0)     t2 = MMThread(seq, max, result, 1)     t1.start()    

WHIFF += Open Flash Charts

2009-09-17 Thread Aaron Watters
WHIFF (WSGI HTTP Integrated Filesystem Frames) 0.5 released. [ WHIFF += Open Flash Charts ] The new WHIFF 0.5 release linked from http://whiff.sourceforge.net includes built in support for Open Flash Charts -- see documentation at

explicit call to __init__(self) in subclass needed?

2009-09-17 Thread Andrew MacKeith
I create a class like this in Python-2.6 class Y(str): ... def __init__(self, s): ... pass ... y = Y('giraffe') y 'giraffe' How does the base class (str) get initialized with the value passed to Y.__init__() ? Is this behavior specific to the str type, or do base classes not need

Re: socket.MSG_WAITALL flag broken on Windows XP in Python 2.5.4?

2009-09-17 Thread Irmen de Jong
Wes McKinney wrote: I am running what is apparently a custom Python 2.5.4 (part of the Enthought Python Distribution) which should be identical to the one on python.org, but is not. I contacted Enthought about the issue-- it can be worked around in the Pyro configuration for the time being.

Re: str.split() with empty separator

2009-09-17 Thread David C Ullrich
On Tue, 15 Sep 2009 14:31:26 +0200, Ulrich Eckhardt wrote: Hi! 'abc'.split('') gives me a ValueError: empty separator. However, ''.join(['a', 'b', 'c']) gives me 'abc'. Why this asymmetry? The docs say If sep is given, consecutive delimiters are not grouped together and are deemed to

Re: unpacking vars from list of tuples

2009-09-17 Thread Ross
Cool - Now that would be some seriously dense, efficient code! Will have to play with numpy sometime. R. On 17-Sep-09, at 12:25 PM, Chris Colbert wrote: if you have numpy installed: ln[12]: import numpy as np In [13]: k = np.array([('a', 'bob', 'c'), ('p', 'joe', 'd'), ('x', 'mary',

elif alternative

2009-09-17 Thread gert
Can anybody show me a better looking alternative for this elif structure ? http://code.google.com/p/appwsgi/source/browse/appwsgi/wsgi/appointment.wsgi -- http://mail.python.org/mailman/listinfo/python-list

Re: Redirect output on script

2009-09-17 Thread Chris Rebert
On Thu, Sep 17, 2009 at 3:58 AM, glenn.prin...@gmail.com glenn.prin...@gmail.com wrote: I would like to redirect the output of the command below to another file type test.txt test.bak I'm trying to do this as part of a python script running on Windows XP. I'm using os.system('type

Re: elif alternative

2009-09-17 Thread Chris Rebert
On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote: Can anybody show me a better looking alternative for this elif structure ? Use a dictionary with functions as values. For example: #untested obviously def admin_remove(db, v, gid): db.execute(DELETE FROM appointments

Re: elif alternative

2009-09-17 Thread MRAB
gert wrote: Can anybody show me a better looking alternative for this elif structure ? http://code.google.com/p/appwsgi/source/browse/appwsgi/wsgi/appointment.wsgi Where you have cascaded ifs based on a single value, one alternative is to use a dict where the test value is the key and

Re: elif alternative

2009-09-17 Thread gert
On Sep 17, 9:48 pm, Chris Rebert c...@rebertia.com wrote: On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote: Can anybody show me a better looking alternative for this elif structure ? Use a dictionary with functions as values. For example: #untested obviously def

Re: explicit call to __init__(self) in subclass needed?

2009-09-17 Thread Ethan Furman
Andrew MacKeith wrote: I create a class like this in Python-2.6 class Y(str): ... def __init__(self, s): ... pass ... y = Y('giraffe') y 'giraffe' How does the base class (str) get initialized with the value passed to Y.__init__() ? Is this behavior specific to the str type,

Re: elif alternative

2009-09-17 Thread r
On Sep 17, 2:38 pm, gert gert.cuyk...@gmail.com wrote: Can anybody show me a better looking alternative for this elif structure ? http://code.google.com/p/appwsgi/source/browse/appwsgi/wsgi/appointme... For starters assign v['cmd'] to a variable instead of looking it up every time! cmd =

Re: Shebang line problems and python

2009-09-17 Thread Blaine
On Sep 16, 9:25 pm, Blaine brlafreni...@gmail.com wrote: Hello, Scripts that have #!/usr/bin/python at the top do not parse correctly. Bash treats scripts with that shebang as if they are bash scripts. E.g.: bla...@attila ~/apps/rs-mu $ /usr/sbin/env-update /usr/sbin/env-update: line 6:

OpenAnything

2009-09-17 Thread kj
In Dive Into Python, Mark Pilgrim offers the function openAnything that can open for reading anything (i.e. local files or URLs). I was wondering if there was already in the standard Python library an official version of this, that could not only open (for reading) regular files and URLs, but

Re: OpenAnything

2009-09-17 Thread TerryP
Read this thread: http://groups.google.com/group/comp.lang.python/browse_thread/thread/445ffc93b0e6a460 and you will likely get the idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: elif alternative

2009-09-17 Thread gert
On Sep 17, 9:48 pm, Chris Rebert c...@rebertia.com wrote: On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote: Can anybody show me a better looking alternative for this elif structure ? Use a dictionary with functions as values. For example: #untested obviously def

Re: OpenAnything

2009-09-17 Thread Paul Boddie
On 17 Sep, 23:24, kj no.em...@please.post wrote: In Dive Into Python, Mark Pilgrim offers the function openAnything that can open for reading anything (i.e. local files or URLs). I was wondering if there was already in the standard Python library an official version of this, that could not

Re: elif alternative

2009-09-17 Thread gert
On Sep 18, 12:09 am, gert gert.cuyk...@gmail.com wrote: On Sep 17, 9:48 pm, Chris Rebert c...@rebertia.com wrote: On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote: Can anybody show me a better looking alternative for this elif structure ? Use a dictionary with

Re: elif alternative

2009-09-17 Thread Chris Rebert
On Thu, Sep 17, 2009 at 3:09 PM, gert gert.cuyk...@gmail.com wrote: On Sep 17, 9:48 pm, Chris Rebert c...@rebertia.com wrote: On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote: Can anybody show me a better looking alternative for this elif structure ? Use a dictionary

Re: elif alternative

2009-09-17 Thread gert
On Sep 18, 12:12 am, gert gert.cuyk...@gmail.com wrote: On Sep 18, 12:09 am, gert gert.cuyk...@gmail.com wrote: On Sep 17, 9:48 pm, Chris Rebert c...@rebertia.com wrote: On Thu, Sep 17, 2009 at 12:38 PM, gert gert.cuyk...@gmail.com wrote: Can anybody show me a better looking

Re: SQLite or files?

2009-09-17 Thread alex23
TerryP bigboss1...@gmail.com wrote: Yeah, I'm sure that is the same kind of thinking that caused 16-bit MS- DOS applications to remain a part of Windows NT so long. So what part of the standard library do you recommend using instead? Or was there no time for advice between snarkiness? --

Re: class initialization problem

2009-09-17 Thread rantingrick
On Sep 17, 11:14 pm, alex23 wuwe...@gmail.com wrote: On Sep 18, 1:27 pm, rantingrick rantingr...@gmail.com wrote: ok i have a class and in it's constructor i want to create a copy of it as an attribute, i have tried super, __new__, and noting seems to work, please help! class A(base):

Re: class initialization problem

2009-09-17 Thread Carl Banks
On Sep 17, 8:27 pm, rantingrick rantingr...@gmail.com wrote: ok i have a class and in it's constructor i want to create a copy of it as an attribute, i have tried super, __new__, and noting seems to work, please help! class A(base):     def __init__(self):         super(A, self).__init__()

Re: SQLite or files?

2009-09-17 Thread Aahz
In article mailman.30.1253183180.2807.python-l...@python.org, Tim Chase python.l...@tim.thechases.com wrote: - I don't know if you're currently keeping the RTF in memory the whole time, or if you repeatedly reload (whether in one go, or streaming it) and reparse the file. This sounds memory

Re: class initialization problem

2009-09-17 Thread rantingrick
On Sep 17, 11:54 pm, Carl Banks pavlovevide...@gmail.com wrote: On Sep 17, 8:27 pm, rantingrick rantingr...@gmail.com wrote: ok i have a class and in it's constructor i want to create a copy of it as an attribute, i have tried super, __new__, and noting seems to work, please help! class

Re: An assessment of the Unicode standard

2009-09-17 Thread alex23
On Sep 18, 2:39 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:         Granted, a proper version would use a class where the two Venus objects have a different description... I think I'd be more inclined to model Venus and treat the others as views :) --

Re: class initialization problem

2009-09-17 Thread alex23
On Sep 18, 3:08 pm, rantingrick rantingr...@gmail.com wrote: ok here is some code. this will cause an infinite recursion. class A():     def __init__(self, *args):         self.nestedA = A(*args) #NO GOOD! there must be a way to create an instance of an object within the same objects

Re: class initialization problem

2009-09-17 Thread OKB (not okblacke)
rantingrick wrote: ok here is some code. this will cause an infinite recursion. class A(): def __init__(self, *args): self.nestedA = A(*args) #NO GOOD! there must be a way to create an instance of an object within the same objects constructor? This is an inherent

Re: class initialization problem

2009-09-17 Thread rantingrick
!SOLVED! Thanks for the help guys! copy.copy did it! Why does me makes life so hard on me? ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: class initialization problem

2009-09-17 Thread rantingrick
On Sep 18, 12:24 am, OKB (not okblacke) brennospamb...@nobrenspambarn.net wrote:         Perhaps you want to cut off the recursion at the first step, so that the nested instance itself does not have a nested instance.  If so, add another parameter to __init__ that flags whether you are creating

Re: class initialization problem

2009-09-17 Thread alex23
On Sep 18, 3:08 pm, rantingrick rantingr...@gmail.com wrote: ok here is some code. this will cause an infinite recursion. class A():     def __init__(self, *args):         self.nestedA = A(*args) #NO GOOD! How about: class A(object): def __init__(self, first=True, *args): if

Re: class initialization problem

2009-09-17 Thread alex23
On Sep 18, 3:31 pm, alex23 wuwe...@gmail.com wrote: On Sep 18, 3:08 pm, rantingrick rantingr...@gmail.com wrote: ok here is some code. this will cause an infinite recursion. class A():     def __init__(self, *args):         self.nestedA = A(*args) #NO GOOD! How about:   class

Re: class initialization problem

2009-09-17 Thread Carl Banks
On Sep 17, 10:08 pm, rantingrick rantingr...@gmail.com wrote: On Sep 17, 11:54 pm, Carl Banks pavlovevide...@gmail.com wrote: On Sep 17, 8:27 pm, rantingrick rantingr...@gmail.com wrote: ok i have a class and in it's constructor i want to create a copy of it as an attribute, i have

[issue6300] encode and decode should accept 'errors' as a keyword argument

2009-09-17 Thread Jeff Bradberry
Jeff Bradberry jeff.bradbe...@gmail.com added the comment: As it turns out, someone had previously made this adjustment to str() and unicode(). My updated patch adds this behavior to unicode.decode and unicode.encode, adds a couple of tests to test_unicode.py, and updates the documentation to

[issue6912] Add 'with' block support to Tools/Scripts/pindent.py

2009-09-17 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Added in r74865. -- nosy: +georg.brandl resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6912 ___

[issue6915] os.listdir inconsistenly releases the GIL on win32

2009-09-17 Thread Georg Brandl
Changes by Georg Brandl ge...@python.org: -- assignee: - loewis nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6915 ___ ___

[issue6300] encode and decode should accept 'errors' as a keyword argument

2009-09-17 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: The patch looks fine, the idea is good as well. I'm just a little worried about the performance impact this might have (not much though). Could you run a quick comparison of before applying the patch compared to after the patch is applied,

[issue6508] expose setresuid

2009-09-17 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Please do try this out on your system. Installing autoconf locally is really not difficult: download 2.61, then do ./configure --prefix=$HOME/ac261 make make install This will give you $HOME/ac261/bin/auto{conf|header}; automake is not

[issue6508] expose setresuid

2009-09-17 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Your patch looks right, although I have a few style issues: - the if chaining looks complicated: we don't usually have an else when the if returns - make sure you use tabs consistently with the rest of the file - it may be better to use

[issue6919] Link CRT Statically

2009-09-17 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: It will seem to work for simple scripts, but many extension modules won't behave properly because: - some API functions (PyFile_AsFile, many PyRun_*functions, PyMarshal_*+FromFile) pass FILE* structures, which differ between instances of

[issue6877] enable compilation of readline module on Mac OS X 10.5 and 10.6

2009-09-17 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Do the remove_history_item and replace_history_item functions also need the off-by-one adjustment? -- nosy: +marketdickinson ___ Python tracker rep...@bugs.python.org

[issue1613573] xmlrpclib ServerProxy uses old httplib interface

2009-09-17 Thread anatoly techtonik
anatoly techtonik techto...@gmail.com added the comment: This bug may be fixed. Unfortunately I do not possess original setup anymore. The primary issue is still issue648658 and that affects bzr + launchpad integration, XML-RPC access to bugzilla and probably more. --

[issue1613573] xmlrpclib ServerProxy uses old httplib interface

2009-09-17 Thread anatoly techtonik
anatoly techtonik techto...@gmail.com added the comment: And I want to add that I am glad that is finally fixed, so I really appreciate the work people done in this direction in their free time. -- ___ Python tracker rep...@bugs.python.org

[issue6877] enable compilation of readline module on Mac OS X 10.5 and 10.6

2009-09-17 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: Mark: yes those functions need to be changed as well. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6877 ___

  1   2   >