Re: Unable to see os.environ['COLUMNS']

2008-09-14 Thread Grant Edwards
On 2008-09-13, Tim Chase <[EMAIL PROTECTED]> wrote: > Not sure what's going on here and hoping for some insight: > >[EMAIL PROTECTED]:~$ echo $COLUMNS >129 >[EMAIL PROTECTED]:~$ python2.5 >Python 2.5.2 (r252:60911, May 28 2008, 08:35:32) >[GCC 4.2.4 (Debian 4.2.4-1)] on linux2 >

Re: Good programming style

2008-09-14 Thread Ben Finney
Adelle Hartley <[EMAIL PROTECTED]> writes: > I'm looking at porting a library that was written for COM and .Net > to work as a Python module, and was wondering whether it would be > better to stick to the library's current naming convention so that > the API is as similar as possible on each platf

Re: RELEASED Python 2.6rc1

2008-09-14 Thread Mensanator
On Sep 12, 8:28�pm, Barry Warsaw <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On behalf of the Python development team and the Python community, I � > am happy to announce the first release candidate for Python 2.6. > > This is a release candidate, so while it is

Re: Good programming style

2008-09-14 Thread Sean DiZazzo
On Sep 14, 7:10 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-09-15, Ben Finney <[EMAIL PROTECTED]> wrote: > > > > > Grant Edwards <[EMAIL PROTECTED]> writes: > >> On 2008-09-14, Ben Finney <[EMAIL PROTECTED]> wrote: > > >>> Second: please do yourself a favour and drop the > >>> camelCaseN

Re: Recognizing the email package

2008-09-14 Thread Marcus.CM
Hi, Actually i think its the email package that needs to be "redefined", using lazyimporter is a bad decision and a lousy one. Even py2exe could not handle it correctly. Marcus. Wingware Support wrote: Marcus.CM wrote: Is there any reason why the IDE cant recognize the uppercase attribute n

Re: Good programming style

2008-09-14 Thread Ben Finney
Grant Edwards <[EMAIL PROTECTED]> writes: > On 2008-09-14, Ben Finney <[EMAIL PROTECTED]> wrote: > > Second: please do yourself a favour and drop the camelCaseNames. > > Follow PEP 8 http://www.python.org/dev/peps/pep-0008> for style > > and naming in your Python code. > > If he finds camelcase m

Re: Good programming style

2008-09-14 Thread Grant Edwards
On 2008-09-14, Ben Finney <[EMAIL PROTECTED]> wrote: > Astley Le Jasper <[EMAIL PROTECTED]> writes: > >> Is it best to have it all in one script or split it into per >> site scripts that can then be called by a manager script? If >> everything is in one script would you have per site functions >> t

Re: Matching horizontal white space

2008-09-14 Thread Ben Finney
[EMAIL PROTECTED] writes: > multipleSpaces = re.compile(u'\\h+') > > importantTextString = '\n \n \n \t\t ' > importantTextString = multipleSpaces.sub("M", importantTextString) Please get into the habit of following the Python coding style guide http://www.python.org/dev/peps/pep-0008>. For

Re: Good programming style

2008-09-14 Thread Ben Finney
Astley Le Jasper <[EMAIL PROTECTED]> writes: > Is it best to have it all in one script or split it into per site > scripts that can then be called by a manager script? If everything > is in one script would you have per site functions to extract the > data or generic function that contain vary sli

Re: How to marshal objects to readable files?

2008-09-14 Thread Gabriel Genellina
En Sun, 14 Sep 2008 15:09:52 -0300, Aaron "Castironpi" Brady <[EMAIL PROTECTED]> escribió: On Sep 14, 10:28 am, nielinjie <[EMAIL PROTECTED]> wrote: Hi list: I just want to marshal objects (instance of custom classes)to a human *READABEL *file/string, and also, I want unmarshal it back. in xm

Re: Python platform.

2008-09-14 Thread primeq
On Sep 11, 8:56 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello all; > > I wonder if there is a platform written in python. The equivalent of > the Netbeans platformhttp://platform.netbeans.org/in the Python > world. Do you know such a thing? > > Thanks a lot. > > Jonathan. Check out Er

Re: PyMarshal Commands crash on Windows

2008-09-14 Thread spammaster . 10 . webmaster
Hi! I shortened the quode. Everything should be all right and nothing is a NULL Pointer. What about PyMarshal_ReadObjectFromFile(FILE* p), this crashs too :-/ hm... the problem is, on mac everything is all right.. thanks... -- http://mail.python.org/mailman/listinfo/python-list

Re: Abstract class

2008-09-14 Thread Stephen Horne
On Sun, 14 Sep 2008 18:03:23 +0200, Mr.SpOOn <[EMAIL PROTECTED]> wrote: >I have to manage many elements of music such as notes, intervals, >scales, chords and so on. All these elements share properties and >behavior, so what I want to do is an abstract class "Note" and other >subclasses, for examp

Re: Is there any nice way to unpack a list of unknown size??

2008-09-14 Thread Fredrik Lundh
srinivasan srinivas wrote: I want to do something like below: 1. first, second, third, *rest = foo 2. for (a,b,c,*rest) in list_of_lists: update to Python 3.0 (as others have pointed out), or just do first, second, third = foo[:3] rest = foo[3:] for item in list_of_lists:

Re: PyMarshal Commands crash on Windows

2008-09-14 Thread Gabriel Genellina
En Sun, 14 Sep 2008 08:28:01 -0300, <[EMAIL PROTECTED]> escribió: int main (int argc, char * const argv[]) { Py_Initialize(); FILE* fp = fopen("/Users/test/Desktop/123.pyc","wb"); PyCodeObject* op = (PyCodeObject*)Py_CompileString("import sys \nprint 'hello'","",Py_file_input);

Re: Is there any nice way to unpack a list of unknown size??

2008-09-14 Thread Tim Chase
I want to do something like below: 1. first, second, third, *rest = foo Python 3.0 has exactly this feature. No current Python 2.x version has it. I asked something similar[1] on c.l.p a while back and Diez Roggisch gave this nice workaround/hack[2] It's a bit ugly in the implementation (s

Re: PyGUI as a standard GUI API for Python?

2008-09-14 Thread David Trem
On 10 sep, 20:36, Fred Pacquier <[EMAIL PROTECTED]> wrote: > Todd Whiteman <[EMAIL PROTECTED]> said : > > > Personally, I believe XULRunner has a lot to offer for Python GUI > > development, I'm currently finishing up some documentation steps to show > > off how to use it specifically for Python (I

Re: PyGUI as a standard GUI API for Python?

2008-09-14 Thread David Trem
On 10 sep, 20:36, Fred Pacquier <[EMAIL PROTECTED]> wrote: > Todd Whiteman <[EMAIL PROTECTED]> said : > > > Personally, I believe XULRunner has a lot to offer for Python GUI > > development, I'm currently finishing up some documentation steps to show > > off how to use it specifically for Python (I

Re: Function getting a reference to its own module

2008-09-14 Thread Arnaud Delobelle
On Sep 14, 5:10 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 14, 4:43 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > > > > On Sep 14, 10:29 am, Steven D'Aprano <[EMAIL PROTECTED] > > > cybersource.com.au> wrote: > > > I have a function that needs a reference to the modu

Re: How to marshal objects to readable files?

2008-09-14 Thread Aaron "Castironpi" Brady
On Sep 14, 10:28 am, nielinjie <[EMAIL PROTECTED]> wrote: > Hi list: > I just want to marshal objects (instance of custom classes)to a human > *READABEL *file/string, and also, I want unmarshal it back. in xml > format or any other format. > Any advice? Which lib should I use? > Thanks a lot. Niel

Re: How to emit Cyrillic and Chinese via unicode from console mode?

2008-09-14 Thread Martin v. Löwis
> Can someone point me to an example of a little program that emits non-ascii > Unicode characters (Russian or Chinese perhaps)? The unicode > Russian/Cyrillic alphabet starts at 0x410. Is this possible to do in a > console mode program? If not, I guess I would want to use pywin32 to create > a

Re: Is there any nice way to unpack a list of unknown size??

2008-09-14 Thread Arnaud Delobelle
On Sep 14, 4:08 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > srinivasan srinivas wrote: > > I want to do something like below: > > > 1. first, second, third, *rest = foo > > Python 3.0 has exactly this feature.  No current Python 2.x version has it. > > Gary Herron > > >  2. for (a,b,c,*rest) in li

Re: ctypes: Get full contents of character array

2008-09-14 Thread overdrigzed
On Sep 13, 6:45 am, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 12, 6:38 pm, [EMAIL PROTECTED] wrote: > > > > > > > > > Hello! > > > I wanted to get the full contents of a character array stored in a > > struct, i.e. > > _fields_ = [...("array", c_char * 12)...] > > however,cty

Re: max(), sum(), next()

2008-09-14 Thread Odalrick
[EMAIL PROTECTED] wrote in news:240454f2-14ee-496a-9078-1abbf80a4e64 @m45g2000hsb.googlegroups.com: > castironpi: >> For max and min, why can't you just add your argument to the set >> itself? > > Sometimes that can be done, but in many other situations it's less > easy, like in the example I hav

Re: Function getting a reference to its own module

2008-09-14 Thread Aaron "Castironpi" Brady
On Sep 14, 4:43 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Sep 14, 10:29 am, Steven D'Aprano <[EMAIL PROTECTED] > > > > cybersource.com.au> wrote: > > I have a function that needs a reference to the module object it is > > defined in. (For the reason why, if you care, see the thread "doct

How to marshal objects to readable files?

2008-09-14 Thread nielinjie
Hi list: I just want to marshal objects (instance of custom classes)to a human *READABEL *file/string, and also, I want unmarshal it back. in xml format or any other format. Any advice? Which lib should I use? Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyMarshal Commands crash on Windows

2008-09-14 Thread spammaster . 10 . webmaster
Hi! Please remember, that the script crashs on Line PyMarshal_WriteObjectToFile. :-( -- http://mail.python.org/mailman/listinfo/python-list

Re: how to exclude specific things when pickling?

2008-09-14 Thread Michael Palmer
On Sep 14, 10:53 am, "inhahe" <[EMAIL PROTECTED]> wrote: > If I gather correctly pickling an object will pickle its entire hierarchy, > but what if there are certain types of objects anywhere within the hierarchy > that I don't want included in the serialization? What do I do to exclude > them?

Re: Is there any nice way to unpack a list of unknown size??

2008-09-14 Thread Gary Herron
srinivasan srinivas wrote: I want to do something like below: 1. first, second, third, *rest = foo Python 3.0 has exactly this feature. No current Python 2.x version has it. Gary Herron 2. for (a,b,c,*rest) in list_of_lists: Please suggest. Thanks, Srini Bring your gang toget

Re: cjson 1.0.5 keyword argument

2008-09-14 Thread Guilherme Polo
On Sun, Sep 14, 2008 at 11:50 AM, Clodoaldo <[EMAIL PROTECTED]> wrote: > On Sep 14, 11:45 am, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: >> On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <[EMAIL PROTECTED]> wrote: >> > I have installed cjson 1.05 in Fedora 8 (python 2.5.1). >> >> > The cjson home pag

Re: How does python call OS?

2008-09-14 Thread Grant Edwards
On 2008-09-14, Siegfried Heintze <[EMAIL PROTECTED]> wrote: > I just finished reading a chapter in "Python Programming on Win32" and tried > out the pythonwin scribble application. I'm not sure if I got it right > because I could not open a new document. I tried to download the source code > as

Re: How does python call OS?

2008-09-14 Thread Gary Herron
Siegfried Heintze wrote: I just finished reading a chapter in "Python Programming on Win32" and tried out the pythonwin scribble application. I'm not sure if I got it right because I could not open a new document. I tried to download the source code as referenced in the chm file but it is corru

Is there any nice way to unpack a list of unknown size??

2008-09-14 Thread srinivasan srinivas
I want to do something like below: 1. first, second, third, *rest = foo  2. for (a,b,c,*rest) in list_of_lists: Please suggest. Thanks, Srini Bring your gang together. Do your thing. Find your favourite Yahoo! group at http://in.promos.yahoo.com/groups/ -- http://mail.python.org/mailma

Re: cjson 1.0.5 keyword argument

2008-09-14 Thread Clodoaldo
On Sep 14, 11:45 am, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <[EMAIL PROTECTED]> wrote: > > I have installed cjson 1.05 in Fedora 8 (python 2.5.1). > > > The cjson home page shows a keyword argument "encoding". > >http://python.cx.hu/python-cjson/ >

Re: cjson 1.0.5 keyword argument

2008-09-14 Thread Clodoaldo
On Sep 14, 10:33 am, Clodoaldo <[EMAIL PROTECTED]> wrote: > I have installed cjson 1.05 in Fedora 8 (python 2.5.1). > > The cjson home page shows a keyword argument > "encoding".http://python.cx.hu/python-cjson/ > > When i use it i get an error: > > >>> cjson.encode('é', encoding='utf8') > > Trace

Re: cjson 1.0.5 keyword argument

2008-09-14 Thread Guilherme Polo
On Sun, Sep 14, 2008 at 10:33 AM, Clodoaldo <[EMAIL PROTECTED]> wrote: > I have installed cjson 1.05 in Fedora 8 (python 2.5.1). > > The cjson home page shows a keyword argument "encoding". > http://python.cx.hu/python-cjson/ > The latest python-cjson on that page is 1.0.3, which accepts keywords

Re: Windows / Tkinter - problem with grid - not able to place widgets at desired places

2008-09-14 Thread Guilherme Polo
On Sun, Sep 14, 2008 at 7:32 AM, Francesco Bochicchio <[EMAIL PROTECTED]> wrote: > Il Mon, 18 Aug 2008 12:15:10 +0100, dudeja.rajat ha scritto: > > >>>Hi, >>> >>>I'm learning Python and Tkinter. I've started programming in Eclipse >>>with PyDev. I'm intending to create a GUI. I'm not able to unders

Re: How to emit Cyrillic and Chinese via unicode from console mode?

2008-09-14 Thread pataphor
On Sun, 14 Sep 2008 01:02:39 -0700 (PDT) rs387 <[EMAIL PROTECTED]> wrote: > On Sep 14, 2:03 am, "Siegfried Heintze" <[EMAIL PROTECTED]> wrote: > > Can someone point me to an example of a little program that emits > > non-ascii Unicode characters (Russian or Chinese perhaps)? > > The following doe

Re: testing if another instance of a script is already running

2008-09-14 Thread skip
Aaron> Would it suffice to call 'os.open' with flags= _O_CREAT| _O_EXCL Aaron> ? Would that be platform-independent? I suspect it would be platform-independent but not NFS-safe. (The other solutions in lockfile might have NFS problems as well. In any case, lockfile provides a bit more

Re: Stuck connection in Python 3.0b2 http.server

2008-09-14 Thread Fredrik Lundh
rs387 wrote: I've encountered a weird issue when migrating a web server to Python 3 - the browser would wait forever without showing a page, displaying "Transferring data" in the status bar. I tracked it down to a reference cycle in my BaseHTTPRequestHandler descendant - one of the attributes st

Re: How to emit Cyrillic and Chinese via unicode from console mode?

2008-09-14 Thread rs387
On Sep 14, 11:51 am, Gertjan Klein <[EMAIL PROTECTED]> wrote: > Interesting. On my system (Windows XP) the console codepage does not > change, and hence the characters don't print properly (I get some of the > CP437 line drawing characters, for example). I have never been able to > convince windows

Re: Why some blog entries at MSN Space support rss feed while others don't?

2008-09-14 Thread Fredrik Lundh
liuyuprc wrote: Not sure if this is the place this question should even be raised it isn't. -- http://mail.python.org/mailman/listinfo/python-list

PyMarshal Commands crash on Windows

2008-09-14 Thread spammaster . 10 . webmaster
Hi! Can anyone help me with this issue? int main (int argc, char * const argv[]) { Py_Initialize(); FILE* fp = fopen("/Users/test/Desktop/123.pyc","wb"); PyCodeObject* op = (PyCodeObject*)Py_CompileString("import sys \nprint 'hello'","",Py_file_input); PyMarshal_WriteObjectToFile

Why some blog entries at MSN Space support rss feed while others don't?

2008-09-14 Thread liuyuprc
Not sure if this is the place this question should even be raised, but I am deeply troubled by this problem for days. I am now desperate. When i tried to add the blogs at MSN Space of my friends' to google reader, some of them don't support rss feed, so i cannot add them. You guys have any idea how

Re: How to emit Cyrillic and Chinese via unicode from console mode?

2008-09-14 Thread Gertjan Klein
rs387 wrote: >sys.stdout = encodings.utf_8.StreamWriter(sys.stdout) > >win32console.SetConsoleCP(65001) >win32console.SetConsoleOutputCP(65001) [...] >If redirected to file, all is well, this prints everything properly in >UTF-8. If ran on the console, this also prints everything correctly, >but

Re: Windows / Tkinter - problem with grid - not able to place widgets at desired places

2008-09-14 Thread Francesco Bochicchio
Il Mon, 18 Aug 2008 12:15:10 +0100, dudeja.rajat ha scritto: >>Hi, >> >>I'm learning Python and Tkinter. I've started programming in Eclipse >>with PyDev. I'm intending to create a GUI. I'm not able to understand >>the Grid manager perhaps because there is quite a less documentation >>available f

Re: noob: subprocess clarification

2008-09-14 Thread Chris Rebert
On Sun, Sep 14, 2008 at 2:29 AM, <[EMAIL PROTECTED]> wrote: > Hi, > > I generally use csh scripts for generally scripting (controlling > simulations). Basically the script processing options, generates the > command line, executes it and then processes the results. > > I would usually use the -f o

Re: Function getting a reference to its own module

2008-09-14 Thread Arnaud Delobelle
On Sep 14, 10:29 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I have a function that needs a reference to the module object it is > defined in. (For the reason why, if you care, see the thread "doctest not > seeing any of my doc tests" from a week ago.) I know of two ways to

Re: recursion gotcha?

2008-09-14 Thread Boris Borcic
cnb wrote: this recursive definition of sum thrumped me, is this some sort of gotcha or am I just braindead today? and yes i know this is easy a a for x in xs acc += x or just using the builtin. def suma(xs, acc=0): if len(xs) == 0: acc else: suma(

Re: recursion gotcha?

2008-09-14 Thread Arnaud Delobelle
On Sep 14, 9:44 am, "Marco Bizzarri" <[EMAIL PROTECTED]> wrote: > On Sun, Sep 14, 2008 at 10:08 AM, Marco Bizzarri > > > > <[EMAIL PROTECTED]> wrote: > > On Sun, Sep 14, 2008 at 10:01 AM, cnb <[EMAIL PROTECTED]> wrote: > >> this recursive definition of sum thrumped me, is this some sort of > >> got

Function getting a reference to its own module

2008-09-14 Thread Steven D'Aprano
I have a function that needs a reference to the module object it is defined in. (For the reason why, if you care, see the thread "doctest not seeing any of my doc tests" from a week ago.) I know of two ways to deal with this problem, both of which feel unsatisfactory to me. Assume the name of t

noob: subprocess clarification

2008-09-14 Thread moogyd
Hi, I generally use csh scripts for generally scripting (controlling simulations). Basically the script processing options, generates the command line, executes it and then processes the results. I would usually use the -f option on the shebang line to ensure that the environment from the current

Re: recursion gotcha?

2008-09-14 Thread Marco Bizzarri
On Sun, Sep 14, 2008 at 10:08 AM, Marco Bizzarri <[EMAIL PROTECTED]> wrote: > On Sun, Sep 14, 2008 at 10:01 AM, cnb <[EMAIL PROTECTED]> wrote: >> this recursive definition of sum thrumped me, is this some sort of >> gotcha or am I just braindead today? >> and yes i know this is easy a a for x in xs

Re: recursion gotcha?

2008-09-14 Thread rs387
On Sep 14, 9:01 am, cnb <[EMAIL PROTECTED]> wrote: > def suma(xs, acc=0): >         if len(xs) == 0: >                 acc >         else: >                 suma(xs[1:], acc+xs[0]) > > it returns none. Yep, that's because there is no "return" statement anywhere. Python doesn't return expressions "

Re: recursion gotcha?

2008-09-14 Thread Marco Bizzarri
On Sun, Sep 14, 2008 at 10:01 AM, cnb <[EMAIL PROTECTED]> wrote: > this recursive definition of sum thrumped me, is this some sort of > gotcha or am I just braindead today? > and yes i know this is easy a a for x in xs acc += x or just using the > builtin. > > def suma(xs, acc=0): >if len(x

Re: How to emit Cyrillic and Chinese via unicode from console mode?

2008-09-14 Thread rs387
On Sep 14, 2:03 am, "Siegfried Heintze" <[EMAIL PROTECTED]> wrote: > Can someone point me to an example of a little program that emits non-ascii > Unicode characters (Russian or Chinese perhaps)? The following doesn't quite work, but I'll post it anyway since it actually ends up printing the chara

recursion gotcha?

2008-09-14 Thread cnb
this recursive definition of sum thrumped me, is this some sort of gotcha or am I just braindead today? and yes i know this is easy a a for x in xs acc += x or just using the builtin. def suma(xs, acc=0): if len(xs) == 0: acc else: suma(xs[1:], acc+x

Re: How does python call OS?

2008-09-14 Thread Steven D'Aprano
On Sat, 13 Sep 2008 23:51:39 -0700, Siegfried Heintze wrote: > I see the next sub-chapter on wxWindows for python and the previous > sub-chapter on TK. This is looking a lot like other scripting languages > (such as perl and groovy and even java). Can python call anything > directly or does someon