Re: Organization of GUIs

2009-12-05 Thread zeph
I highly recommend reading the Cocoa documentation, which has volumes on all sorts of things like this. Here's a link that talks about views in that context, and should give you more ideas about well- designed GUI layouts: http://bit.ly/6b8PYh -- http://mail.python.org/mailman/listinfo/python-lis

Re: Float precision and float equality

2009-12-05 Thread Tim Roberts
Raymond Hettinger wrote: > > if not round(x - y, 6): ... That's a dangerous suggestion. It only works if x and y happen to be roughly in the range of integers. For example, here x and y are within roundoff error of each other, but round doesn't know it: >>> x=1e32 >>> y=x+1e16 >>> x-

execnet-1.0.1: more robust and rapid python deployment

2009-12-05 Thread holger krekel
Hi everybody, Just uploaded execnet-1.0.1 featuring a new motto: execnet is about rapid-python deployment, be it for multiple CPUs, different platforms or python versions. This release brings a bunch of refinements and most importantly more robust termination, handling of CTRL-C and automat

Re: how to debug extended module?

2009-12-05 Thread Yinon Ehrlich
On Dec 3, 8:40 am, junyoung wrote: > On 12월2일, 오전9시54분, junyoung wrote: > > > > > On 12월1일, 오후6시14분, "Diez B. Roggisch" wrote: > > > > junyoung schrieb: > > > > > Hi, I am a newbie who want to implement a extend module to use native > > > > python language with my own shared library. > > > > If

Re: subprocess kill

2009-12-05 Thread Yinon Ehrlich
On Dec 5, 12:13 pm, luca72 wrote: > On 5 Dic, 03:06, Carl Banks wrote: > > > > > On Dec 4, 3:44 pm, luca72 wrote: > > > > On 5 Dic, 00:14, luca72 wrote: > > > > > On 5 Dic, 00:03, luca72 wrote: > > > > > > On 4 Dic, 23:23, Mike Driscoll wrote: > > > > > > > On Dec 4, 3:50 pm, luca72 wrote: >

Re: Socket question

2009-12-05 Thread Tim Roberts
perlsyntax wrote: > >I just want to know could it be done makeing my own socket tool that >connect to two server at the same time.And what link do i need to look at? You can certainly connect to two (or any number) servers at the same time, but you have to create two sockets to do it. -- Tim Ro

Re: Can't print Chinese to HTTP

2009-12-05 Thread Lie Ryan
On 12/6/2009 12:56 PM, Gnarlodious wrote: On Dec 5, 3:54 am, Lie Ryan wrote: Because of the switch to unicode str, a simple print('晉') should've worked flawlessly if your terminal can accept the character, but the problem is your terminal does not. There is nothing wrong with Terminal, Mac OS

Re: Organization of GUIs

2009-12-05 Thread Tim Roberts
Michael Mossey wrote: > >I am now wondering if I should write a GUI so that everything is in a >true hierarchy, rather than a tangle of objects with democratic >relationships---and more specifically, that messages (which may cause >state to be changed in the receiver of the message) should first g

How to create a docstring for a module?

2009-12-05 Thread Dr. Phillip M. Feldman
If I create a module xyz.py with a docstring """xyz does everything you could possibly want.""" at the top, the command ?xyz issued at the IPython prompt does not display this docstring. What am I doing wrong? -- View this message in context: http://old.nabble.com/How-to-create-a-docstring-for-

Re: TDD with nose or py.test

2009-12-05 Thread geremy condra
On Sat, Dec 5, 2009 at 6:37 PM, Paul Rubin wrote: > geremy condra writes: >> I use unittest, but mostly because its so close to junit and cppunit, >> which I also use extensively. Having said that, it *is* in the standard >> library and is a common denominator between all your options. > > What h

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread J
On Sat, Dec 5, 2009 at 23:17, W. eWatson wrote: > J wrote: >> And those are your only options, really.  From what I've been able to >> see, there is no native ability in Linux to actually see who has a >> lock on a file that's been opened.  And I completely understand your >> frustration. Crud..

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread W. eWatson
J wrote: On Sat, Dec 5, 2009 at 21:14, W. eWatson wrote: What I'm trying to do is really simple. In the Win XP NG, I have two suggestions to get rid of the Analysis folder and the empty file in it. One is to use a program like you suggested, and the other is to delete it from DOS. I just tried

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread Tom Pacheco
W. eWatson wrote: I'm trying to store analytic data in a folder called Analysis. If the user doesn't have the folder, I make one for him, and then write a txt file into it. In this case a histogram of values, x and frequency. However, it appears that I made a mistake somewhere and cannot delete

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread Stephen Hansen
On Sat, Dec 5, 2009 at 6:20 PM, W. eWatson wrote: > I'm trying to do a very simple thing. I go to the Analysis folder, and try > to use Win XP Pro to delete the empty and unnamed file in it. One just does > a right-click on the empty file, and then uses Delete. It won't let me > delete it. If I b

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread J
On Sat, Dec 5, 2009 at 21:14, W. eWatson wrote: > What I'm trying to do is really simple. In the Win XP NG, I have two > suggestions to get rid of the Analysis folder and the empty file in it. One > is to use a program like you suggested, and the other is to delete it from > DOS. I just tried cmd

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread W. eWatson
The original program and code are not mine. I have no idea if that specific piece of code has ever been tested. Generally the program works quite well, and when needed creates the Events folder without any difficulty. That folder is used heavily by writing new data files to it thousands of time

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread W. eWatson
J wrote: On Sat, Dec 5, 2009 at 20:32, J wrote: connections eventually. So being able to find who has a lock on a given file or directory if the program dies unexpectedly would be useful. Google tells me that the program Process Explorer from SysInternals will provide most of the functional

Re: Can't print Chinese to HTTP

2009-12-05 Thread Gnarlodious
On Dec 5, 3:54 am, Lie Ryan wrote: > Because of the switch to unicode str, a simple print('晉') should've > worked flawlessly if your terminal can accept the character, but the > problem is your terminal does not. There is nothing wrong with Terminal, Mac OSX supports Unicode from one end to the o

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread J
On Sat, Dec 5, 2009 at 20:32, J wrote: > connections eventually.  So being able to find who has a lock on a > given file or directory if the program dies unexpectedly would be > useful. Google tells me that the program Process Explorer from SysInternals will provide most of the functionality of

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread J
On Sat, Dec 5, 2009 at 17:42, John Machin wrote: > On Dec 6, 2:46 am, "W. eWatson" wrote: >> However, even at >> that, why can't I delete this empty file called Analysis? > > Are you trying to delete the file from another command window while > Python is paused at the interactive prompt? In any c

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-05 Thread Alf P. Steinbach
* Steven D'Aprano: On Sat, 05 Dec 2009 11:26:34 +0100, Alf P. Steinbach wrote: Regarding my terminology, "routine" instead "function" that everybody except you remarked on, it is of course intentional. [...] I think you failed to realise that your use of the term was ambiguous. It wasn't cle

Re: python bijection

2009-12-05 Thread geremy condra
On Sat, Dec 5, 2009 at 7:18 PM, Raymond Hettinger wrote: > On Dec 5, 3:22 pm, geremy condra wrote: >> On Sat, Dec 5, 2009 at 4:39 PM, Raymond Hettinger wrote: >> > [geremy condra] >> >> I actually considered using dependencies as an example on the >> >> "graphine for pythonistas"[1] article, but

Re: Float precision and float equality

2009-12-05 Thread sturlamolden
On 5 Des, 16:37, Anton81 wrote: > I'd like to do calculations with floats and at some point equality of > two number will be checked. > What is the best way to make sure that equality of floats will be > detected, where I assume that mismatches beyond a certain point are > due to truncation errors

Re: python bijection

2009-12-05 Thread Raymond Hettinger
On Dec 5, 3:22 pm, geremy condra wrote: > On Sat, Dec 5, 2009 at 4:39 PM, Raymond Hettinger wrote: > > [geremy condra] > >> I actually considered using dependencies as an example on the > >> "graphine for pythonistas"[1] article, but decided to do the maze > >> run instead. In any event, the uses

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-05 Thread sturlamolden
On 5 Des, 12:55, Andreas Waldenburger wrote: > Can you please elaborate? To me, a function is something that > transforms some input to some output [1]. Which is exactly what Python > functions do, without fail. A mathematical function cannot have side effects. That is what functional languages

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-05 Thread Steven D'Aprano
On Sat, 05 Dec 2009 11:26:34 +0100, Alf P. Steinbach wrote: > Regarding my terminology, "routine" instead "function" that everybody > except you remarked on, it is of course intentional. [...] I think you failed to realise that your use of the term was ambiguous. It wasn't clear that you were us

Re: TDD with nose or py.test

2009-12-05 Thread Paul Rubin
geremy condra writes: > I use unittest, but mostly because its so close to junit and cppunit, > which I also use extensively. Having said that, it *is* in the standard > library and is a common denominator between all your options. What happened to doctest? -- http://mail.python.org/mailman/list

Re: TDD with nose or py.test

2009-12-05 Thread geremy condra
On Mon, Nov 30, 2009 at 8:46 AM, Lacrima wrote: > Hello! > > I am learning TDD with Python and there is not much information about > this topic. Python is shipped with unittest module. That is fine, but > I also discovered other libraries: nose and py.test. They promise to > make life yet easier f

Re: python bijection

2009-12-05 Thread geremy condra
On Sat, Dec 5, 2009 at 4:39 PM, Raymond Hettinger wrote: > [geremy condra] >> I actually considered using dependencies as an example on the >> "graphine for pythonistas"[1] article, but decided to do the maze >> run instead. In any event, the uses of graphs in general computing >> are well enough

Re: TDD with nose or py.test

2009-12-05 Thread Roy Smith
In article <2519ffb0-fd49-4340-857b-62fca5c71...@33g2000vbe.googlegroups.com>, Lacrima wrote: > Hello! > > I am learning TDD with Python and there is not much information about > this topic. Python is shipped with unittest module. That is fine, but > I also discovered other libraries: nose and

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread John Machin
On Dec 6, 2:46 am, "W. eWatson" wrote: [snip] >          f = file( s, "wb" ) >          if not f: >              self.LogError( "File creation error 1" ) >              return False Either you are shadowing the built-in function file() or you haven't tested this code ... file() aka open() retur

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread zeph
Here's what I came up with, though it only asks once question then quits depending on the answer or lack thereof. And while, yes, you can't interrupt a raw_input call from a timer, providing for a blank line (user hitting enter) is a way around it: import threading import Timer from random import

Re: python bijection

2009-12-05 Thread Raymond Hettinger
[geremy condra] > I actually considered using dependencies as an example on the > "graphine for pythonistas"[1] article, but decided to do the maze > run instead. In any event, the uses of graphs in general computing > are well enough established that I don't really think that's where > the majorit

Re: Float precision and float equality

2009-12-05 Thread Raymond Hettinger
On Dec 5, 12:56 pm, Mark Dickinson wrote: > On Dec 5, 8:25 pm, Raymond Hettinger wrote: > > > On Dec 5, 7:37 am, Anton81 wrote: > > > > I'd like to do calculations with floats and at some point equality of > > > two number will be checked. > > > What is the best way to make sure that equality of

Re: Float precision and float equality

2009-12-05 Thread Mark Dickinson
On Dec 5, 8:25 pm, Raymond Hettinger wrote: > On Dec 5, 7:37 am, Anton81 wrote: > > > I'd like to do calculations with floats and at some point equality of > > two number will be checked. > > What is the best way to make sure that equality of floats will be > > detected, where I assume that misma

Re: Question on Python as career

2009-12-05 Thread r0g
TimmyGee wrote: > On Dec 4, 1:08 pm, r0g wrote: >> TimmyGee wrote: >>> On Dec 4, 2:48 am, Grant Edwards wrote: On 2009-12-03, r0g wrote: >>> I have done one MA in Linguistics, did a PhD in Natural >>> Language Processing and doing a Post Doctoral now. ... >>> After I complete my

Re: Float precision and float equality

2009-12-05 Thread Raymond Hettinger
On Dec 5, 7:37 am, Anton81 wrote: > I'd like to do calculations with floats and at some point equality of > two number will be checked. > What is the best way to make sure that equality of floats will be > detected, where I assume that mismatches beyond a certain point are > due to truncation erro

Re: How to tell if you're running on windows?

2009-12-05 Thread r0g
Roy Smith wrote: > I'm using 2.5.1. How can I tell if I'm running on windows? The > obvious answer, platform.system(), gets complicated. On the python > that comes with cygwin, it returns 'CYGWIN_NT-5.2-WOW64', but I've got > a native windows build of python where it returns 'Microsoft'. > > Th

pywin32 question

2009-12-05 Thread yair reshef
i', looking to create a script that will log all data i drag, click or highlight. i dont think its very chalnging, just a matter of finding the right functions. how/can i detect highlighted text mouse events -- http://mail.python.org/mailman/listinfo/python-list

Re: [RELEASED] Python 2.7 alpha 1

2009-12-05 Thread Benjamin Peterson
My apologies. The whatsnew link is actually http://docs.python.org/dev/whatsnew/2.7. 2009/12/5 Benjamin Peterson : > On behalf of the Python development team, I'm pleased to announce the first > alpha release of Python 2.7. -- Regards, Benjamin -- http://mail.python.org/mailman/listinfo/pytho

[RELEASED] Python 2.7 alpha 1

2009-12-05 Thread Benjamin Peterson
On behalf of the Python development team, I'm pleased to announce the first alpha release of Python 2.7. Python 2.7 is scheduled to be the last major version in the 2.x series. It includes many features that were first released in Python 3.1. The faster io module, the new nested with statement s

Re: python bijection

2009-12-05 Thread geremy condra
On Sat, Dec 5, 2009 at 7:06 AM, Lie Ryan wrote: > On 12/5/2009 4:18 PM, Steven D'Aprano wrote: >>> >>> Tree is better than Graph >>> >>> not having Tree and Graph package in the standard library force most >>> people to find List-based solution. >> >> If you have to be *forced* to use a list-based

Re: Specifying an API for a straeming parser

2009-12-05 Thread Nobody
On Fri, 04 Dec 2009 13:51:15 -0800, tyler wrote: > Howdy folks, I'm working on a JSON Python module [1] and I'm struggling with > an appropriate syntax for dealing with incrementally parsing streams of data > as they come in (off a socket or file object). > > The underlying C-level parsing libra

Re: Nested Dicts

2009-12-05 Thread Victor Subervi
On Sat, Dec 5, 2009 at 12:39 PM, Carsten Haese wrote: > Victor Subervi wrote: > > Of course I knew about those indentation errors > > That may be so, but you cleverly disguised this fact by saying the exact > opposite. > I will try not to make such assumptions in the future. Forgive me for leadin

Re: os.remove() permission problem

2009-12-05 Thread Aahz
In article , Christian Heimes wrote: > >You have to set the write and execute permssion on *directory*, not on >the file. unlink (aka remove) requires write permission on the directory >in order to remove the file. > >It's like in the real world. You may be allowed to modify a document (w >permis

Re: Question on class module import

2009-12-05 Thread monkeyboy
Thank you, that clears it for me -- http://mail.python.org/mailman/listinfo/python-list

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread MrJean1
Try using the function timelimited from this recipe An (untested) example with a 60 second timeout would be: try: r = timelimited(60, raw_input, 'enter right or wrong: ') except TimeLimitExpired: except KeyboardInterrupt: /Jean

Re: Nested Dicts

2009-12-05 Thread Carsten Haese
Victor Subervi wrote: > Of course I knew about those indentation errors That may be so, but you cleverly disguised this fact by saying the exact opposite. -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list

Re: [distutils] Install script under a different name

2009-12-05 Thread Nikolaus Rath
Wolodja Wentland writes: > On Fri, Dec 04, 2009 at 19:34 -0500, Nikolaus Rath wrote: >> All my Python files have extension .py. However, I would like to install >> scripts that are meant to be called by the user without the suffix, i.e. >> the file scripts/doit.py should end up as /usr/bin/doit. >

Re: TDD with nose or py.test

2009-12-05 Thread Aahz
In article <2519ffb0-fd49-4340-857b-62fca5c71...@33g2000vbe.googlegroups.com>, Lacrima wrote: > >I am learning TDD with Python and there is not much information about >this topic. Python is shipped with unittest module. That is fine, but >I also discovered other libraries: nose and py.test. They

Re: question about subprocess and shells

2009-12-05 Thread Nobody
On Fri, 04 Dec 2009 13:38:11 -0800, Ross Boylan wrote: > If one uses subprocess.Popen(args, ..., shell=True, ...) > > When args finishes execution, does the shell terminate? Either way > seems problematic. That depends upon what "args" is. On Unix, if args ends with a "&", the shell will termin

Re: Nested Dicts

2009-12-05 Thread Victor Subervi
On Sat, Dec 5, 2009 at 12:01 PM, Carsten Haese wrote: > Victor Subervi wrote: > d = {'cat': {'one':'two'}} > for a, b in d: > > ... > > File "", line 2 > > > > ^ > > IndentationError: expected an indented block > d = {'cat': {}} > for a, b in d: > > ... > > File "", lin

Re: [distutils] Install script under a different name

2009-12-05 Thread Nikolaus Rath
Lie Ryan writes: > On 12/5/2009 11:34 AM, Nikolaus Rath wrote: >> Hello, >> >> All my Python files have extension .py. However, I would like to install >> scripts that are meant to be called by the user without the suffix, i.e. >> the file scripts/doit.py should end up as /usr/bin/doit. >> >> Appa

Re: Nested Dicts

2009-12-05 Thread Carsten Haese
Victor Subervi wrote: d = {'cat': {'one':'two'}} for a, b in d: > ... > File "", line 2 > > ^ > IndentationError: expected an indented block d = {'cat': {}} for a, b in d: > ... > File "", line 2 > > ^ > IndentationError: expected an indented block > > So app

Re: ctypes pointer from offset into array?

2009-12-05 Thread sturlamolden
On 5 Des, 10:13, Carl Banks wrote: > Is there a way to get the pointer to an array offset in ctypes. Could also mention that Cython has pointer arithmetics. Cython can be easier to use than ctypes, but is not a standard module. -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes pointer from offset into array?

2009-12-05 Thread sturlamolden
On 5 Des, 10:13, Carl Banks wrote: > Is there a way to get the pointer to an array offset in ctypes. > Example, say I define an array like so: > > xfer = (c_char*bufsize)() > > How would I get a pointer to then nth byte (equivalient of &xfer[n])? > I guess I would have expected xfer+n to work, but

Re: Float precision and float equality

2009-12-05 Thread Mark Dickinson
On Dec 5, 3:37 pm, Anton81 wrote: > I'd like to do calculations with floats and at some point equality of > two number will be checked. > What is the best way to make sure that equality of floats will be > detected, where I assume that mismatches beyond a certain point are > due to truncation erro

Re: Nested Dicts

2009-12-05 Thread MRAB
Victor Subervi wrote: Hi; I have the following error: /var/www/html/angrynates.com/cart/catTree.py in getChildren(levelDict={'cat3': {}}, level=0) 23 if level > MAXLEVEL: 24 return #possibly the data has a cycle/loop 25 for (nm, dt) i

Re: UnicodeDecodeError? Argh! Nothing works! I'm tired and hurting and...

2009-12-05 Thread Nobody
On Fri, 04 Dec 2009 00:33:57 +, Steven D'Aprano wrote: >>> Just to be contrary, I *like* mbox. >> >> Me too. :-) Me too. > Why? What features or benefits of mbox do you see that make up for it's > disadvantages? Simplicity and performance. Maildir isn't simple when you add in the filesys

Re: Nested Dicts

2009-12-05 Thread D'Arcy J.M. Cain
On Sat, 5 Dec 2009 10:52:10 -0500 Victor Subervi wrote: > Hi; > I have the following error: > > /var/www/html/angrynates.com/cart/catTree.py in > getChildren(levelDict={'cat3': {}}, level=0) >23 if level > MAXLEVEL: >24 return #possibly the data has a cycle/loop >25 for (nm,

Nested Dicts

2009-12-05 Thread Victor Subervi
Hi; I have the following error: /var/www/html/angrynates.com/cart/catTree.py in getChildren(levelDict={'cat3': {}}, level=0) 23 if level > MAXLEVEL: 24 return #possibly the data has a cycle/loop 25 for (nm, dt) in levelDict: ### ERROR HERE 26 cursor.execute('''select c.na

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread W. eWatson
The program code is not mine, but I wanted to modify it to produce an Analysis folder when the user wants histogram file, basically, a txt file to appear in Analysis. Elsewhere in the program this is done for another type of data that is directed to an Events folder. I figured I could copy the

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread Maxim Khitrov
On Sat, Dec 5, 2009 at 9:11 AM, Rune Strand wrote: > On Dec 5, 3:07 pm, Maxim Khitrov wrote: >> >> Doesn't work on Windows. >> >> - Max > > Yes, it does. I've used it a lot, also in Py2Exe apps.  Try the > documentation example yourself > > def hello(): >    print "hello, world" > > t = Timer(30.

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread Rune Strand
On Dec 5, 3:07 pm, Maxim Khitrov wrote: > > Doesn't work on Windows. > > - Max Yes, it does. I've used it a lot, also in Py2Exe apps. Try the documentation example yourself def hello(): print "hello, world" t = Timer(30.0, hello) t.start() # after 30 seconds, "hello, world" will be printed

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread Maxim Khitrov
On Sat, Dec 5, 2009 at 9:01 AM, Rune Strand wrote: > The easiest wasy is to use the Timer object in the threading module. > > > from threading import Timer Doesn't work on Windows. - Max -- http://mail.python.org/mailman/listinfo/python-list

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread Rune Strand
The easiest wasy is to use the Timer object in the threading module. from threading import Timer -- http://mail.python.org/mailman/listinfo/python-list

Re: editor with autocompletion

2009-12-05 Thread Someone Something
If you're actually going to release this, you shouldn't bundle it with a preexisting text editor (IMHO) in case it goes out of development and then you'll end up like DSL (damn small linux) did. In other words either you get a text editor that's basically never going out of development (emacs, not

Re: Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread anand jeyahar
simple when the python program ended, the file handle created by it was still open... so windows will not allow you to delete it (the standard behaviour, when a parent process dies, with a sub-process running is to keep the child running.) try logging off and back on.it will solve the p

Re: editor with autocompletion

2009-12-05 Thread Fabio Zadrozny
On Sat, Dec 5, 2009 at 5:19 AM, Siva B wrote: > Hi All, > Thanks for your reply. > > What I want is An Editor which can support Dynamic Languages with > Autocomplete. > > I have my own language with some file extension (for ex: *.fs ) > I can add few keywords to editor, it should support autocompl

Re: python bijection

2009-12-05 Thread Lie Ryan
On 12/5/2009 4:18 PM, Steven D'Aprano wrote: Tree is better than Graph not having Tree and Graph package in the standard library force most people to find List-based solution. If you have to be *forced* to use a list-based solution, that's a good sign that a list is *not* the right tool for th

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-05 Thread Andreas Waldenburger
On Sat, 05 Dec 2009 11:26:34 +0100 "Alf P. Steinbach" wrote: >* "function" is misleading in itself (due to the hijacking of this > term in mathematics), [...] Can you please elaborate? To me, a function is something that transforms some input to some output [1]. Which is exactly what Python

Re: [distutils] Install script under a different name

2009-12-05 Thread Wolodja Wentland
On Fri, Dec 04, 2009 at 19:34 -0500, Nikolaus Rath wrote: > All my Python files have extension .py. However, I would like to install > scripts that are meant to be called by the user without the suffix, i.e. > the file scripts/doit.py should end up as /usr/bin/doit. > Apparently the scripts= optio

Re: read from standard input

2009-12-05 Thread Bujji
what is the problem you faced in running it on Linux or windows we'll use IDLE only on linux platform like this also you can run see below ubu...@siva:~/Desktop$ python Python 2.6.2 (r262:71600, Oct 7 2009, 11:27:27) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2 Type "help", "copyright", "credits

Re: Can't print Chinese to HTTP

2009-12-05 Thread Alf P. Steinbach
* Lie Ryan: On 12/5/2009 2:57 PM, Gnarlodious wrote: On Dec 1, 3:06 pm, Terry Reedy wrote: def print(s): return sys.stdout.buffer.write(s.encode('utf-8')) Here is a better solution that lets me send any string to the function: def print(html): return sys.stdout.buffer.write(("Content-type:te

Re: can someone explain 'super' to me?

2009-12-05 Thread Lie Ryan
On 12/5/2009 9:27 PM, Michael wrote: It seems like it can return either a class or an instance of a class. Like super( C, self) is like casting self as superclass C. However if you omit the second argument entirely you get a class. Inside a class C: these are all equivalent: super().method(arg)

Why Can't I Delete a File I Created with Win XP?

2009-12-05 Thread W. eWatson
I'm trying to store analytic data in a folder called Analysis. If the user doesn't have the folder, I make one for him, and then write a txt file into it. In this case a histogram of values, x and frequency. However, it appears that I made a mistake somewhere and cannot delete it using the Win

Re: Can't print Chinese to HTTP

2009-12-05 Thread Lie Ryan
On 12/5/2009 2:57 PM, Gnarlodious wrote: On Dec 1, 3:06 pm, Terry Reedy wrote: def print(s): return sys.stdout.buffer.write(s.encode('utf-8')) Here is a better solution that lets me send any string to the function: def print(html): return sys.stdout.buffer.write(("Content-type:text/ plain;cha

can someone explain 'super' to me?

2009-12-05 Thread Michael
>From the docs about the built-in function super: super( type[, object-or-type]) Return the superclass of type. If the second argument is omitted the super object returned is unbound. If the second argument is an object, isinstance(obj, type) must be true. If the seco

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-05 Thread Alf P. Steinbach
* Raymond Hettinger: On Dec 4, 2:03 am, "Alf P. Steinbach" wrote: Is this guaranteed to work in Python 3.x? >>> def foo(): pass ... >>> foo.blah = 222 >>> foo.blah 222 Yes, function attributes are guaranteed to be writable: http://www.python.org/dev/peps/pep-0232/ Thanks to all, especia

Re: subprocess kill

2009-12-05 Thread luca72
On 5 Dic, 03:06, Carl Banks wrote: > On Dec 4, 3:44 pm, luca72 wrote: > > > > > On 5 Dic, 00:14, luca72 wrote: > > > > On 5 Dic, 00:03, luca72 wrote: > > > > > On 4 Dic, 23:23, Mike Driscoll wrote: > > > > > > On Dec 4, 3:50 pm, luca72 wrote: > > > > > > > Hello i'm using subprocess in this w

Re: read from standard input

2009-12-05 Thread Rami Chowdhury
On Saturday 05 December 2009 01:20:12 Siva B wrote: > for the line of code you given, > > print type(sys.stdin), sys.stdin > > the output is: >0x00BE8090> > > there is no change. > I have tried it in python2.6 on windows platform. > > Thanks, > Siva > How did you run this on Linux? How d

Re: question about subprocess and shells

2009-12-05 Thread Floris Bruynooghe
On Dec 4, 9:38 pm, Ross Boylan wrote: > If one uses subprocess.Popen(args, ..., shell=True, ...) > > When args finishes execution, does the shell terminate?  Either way > seems problematic. Essentially this is executing "/bin/sh args" so if you're unsure as to the behaviour just try it on your co

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread northof40
On Dec 5, 6:23 pm, Paul Rubin wrote: > northof40 writes: > > I'm thinking of some logic where a raw_input call is executed and then > > if more than X seconds elapses before the prompt is replied to the > > process writes a message "Sorry too slow" (or similar). > > The simplest way to do this is

Re: How to timeout when waiting for raw_input from user ?

2009-12-05 Thread northof40
On Dec 5, 2:44 pm, Maxim Khitrov wrote: > On Fri, Dec 4, 2009 at 6:55 PM, northof40 wrote: > > On Dec 5, 12:52 pm, northof40 wrote: > >> Hi - I'm writing a *very* simple program for my kids. It asks the user > >> to give it the answer to a maths question and says "right" or "wrong" > > >> They n

Re: Install script under a different name

2009-12-05 Thread Floris Bruynooghe
On Dec 5, 1:52 am, Lie Ryan wrote: > on linux/unix, you need to add the proper #! line to the top of any > executable scripts and of course set the executable bit permission > (chmod +x scriptname). In linux/unix there is no need to have the .py > extension for a file to be recognized as python sc

Re: Are routine objects guaranteed mutable & with dictionary?

2009-12-05 Thread Raymond Hettinger
On Dec 4, 2:03 am, "Alf P. Steinbach" wrote: > Is this guaranteed to work in Python 3.x? > >  >>> def foo(): pass > ... >  >>> foo.blah = 222 >  >>> foo.blah > 222 Yes, function attributes are guaranteed to be writable: http://www.python.org/dev/peps/pep-0232/ Raymond -- http://mail.python.o

Re: read from standard input

2009-12-05 Thread Siva B
for the line of code you given, print type(sys.stdin), sys.stdin the output is: there is no change. I have tried it in python2.6 on windows platform. Thanks, Siva On Sat, Dec 5, 2009 at 12:57 PM, Chris Rebert wrote: > > On Sat, Dec 5, 2009 at 11:54 AM, Chris Rebert wrote: > >> > >> On F

Re: python bijection

2009-12-05 Thread Raymond Hettinger
> >   ...sqlite3 provides another way... > > In many many cases, using a dB (even a lightweight such as sqlite3) is > swatting the fly with a sledgehammer :-) I'm sure it seems that way, but look at the generic description of the problem: "I have a list of n-ary tuples with named fields and would

ctypes pointer from offset into array?

2009-12-05 Thread Carl Banks
Is there a way to get the pointer to an array offset in ctypes. Example, say I define an array like so: xfer = (c_char*bufsize)() How would I get a pointer to then nth byte (equivalient of &xfer[n])? I guess I would have expected xfer+n to work, but it doesn't. Carl Banks -- http://mail.python

Re: python bijection

2009-12-05 Thread Raymond Hettinger
[Me] > > * we've already got one (actually two). > >   The two dictionary approach... [Francis Carr] > Solutions such as bidict just automate the two-dict approach. They do so at the expense of implementing a new API to support it and at the expense with having non-obvious behaviors (i.e. how it