ANN: v0.2 of PipeController released; now supports running pipes incrementally

2012-09-28 Thread vasudevram
I've released v0.2 of PipeController, my experimental tool to simulate pipes in Python. It can be downloaded here: http://dancingbison.com/pipe_controller-v0.2.zip Changes in v0.2: - module name changed to avoid clashes with pipes module in the standard Python library; the module is now

Re: Stop feeding the trolls (Was: which a is used?)

2012-09-28 Thread rusi
On Sep 28, 10:21 am, Dwight Hutto dwightdhu...@gmail.com wrote: On Fri, Sep 28, 2012 at 1:12 AM, Littlefield, Tyler ty...@tysdomain.com wrote: On 9/27/2012 10:50 PM, Dwight Hutto wrote: On Fri, Sep 28, 2012 at 12:40 AM, Chris Angelico ros...@gmail.com wrote: On Fri, Sep 28, 2012 at 1:47

Re: Stop feeding the trolls (Was: which a is used?)

2012-09-28 Thread Dwight Hutto
On Fri, Sep 28, 2012 at 1:51 AM, rusi rustompm...@gmail.com wrote: On Sep 28, 10:21 am, Dwight Hutto dwightdhu...@gmail.com wrote: On Fri, Sep 28, 2012 at 1:12 AM, Littlefield, Tyler ty...@tysdomain.com wrote: On 9/27/2012 10:50 PM, Dwight Hutto wrote: On Fri, Sep 28, 2012 at 12:40 AM,

Re: Article on the future of Python

2012-09-28 Thread Bob Martin
in 681910 20120927 131113 Devin Jeanpierre jeanpierr...@gmail.com wrote: On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 25 Sep 2012 09:15:00 +0100, Mark Lawrence wrote: And a response: http://data.geek.nz/python-is-doing-just-fine Summary

Re: Article on the future of Python

2012-09-28 Thread Dwight Hutto
Summary of that article: Sure, you have all these legitimate concerns, but look, cake! Quote : This piece argues that Python is an easy-to-learn language that where you can be almost immediately productive in. It is, but so is every other language. hello world is the standard... follow the

Re: REST code-golf: How concisely can you expose and consume services?

2012-09-28 Thread Chris Angelico
On Fri, Sep 28, 2012 at 3:41 PM, Alec Taylor alec.tayl...@gmail.com wrote: web2py (7 lines): https://gist.github.com/3798093 I love the idea, even though I shan't be entering. Code golf is awesome fun! My latest golf game involved importing code comments and text-file annotations into autodoc

how to run shell command like EOT .... EOT

2012-09-28 Thread 叶佑群
Hi, all, I have the shell command like this: sfdisk -uM /dev/sdb EOT ,1000,83 ,,83 EOT I have tried subprocess.Popen, pexpect.spawn and os.popen, but none of these works, but when I type this shell command in shell, it is works fine. I wonder how to emulate this type of

Re: Reducing cache/buffer for faster display

2012-09-28 Thread Chris Angelico
On Fri, Sep 28, 2012 at 10:05 AM, Rikishi42 skunkwo...@rikishi42.net wrote: The scripts in question only increase numbers. But should that not be the case, solutions are simple enough. The numbers can be formatted to have a fixed size. In the case of random line contents (a list of filesnames,

Re: how to run shell command like EOT .... EOT

2012-09-28 Thread Kushal Kumaran
On Fri, Sep 28, 2012 at 1:15 PM, 叶佑群 ye.you...@eisoo.com wrote: Hi, all, I have the shell command like this: sfdisk -uM /dev/sdb EOT ,1000,83 ,,83 EOT I have tried subprocess.Popen, pexpect.spawn and os.popen, but none of these works, but when I type this shell command in

Re: Article on the future of Python

2012-09-28 Thread Mark Lawrence
On 27/09/2012 20:08, Terry Reedy wrote: On 9/27/2012 5:33 AM, Steven D'Aprano wrote: Nevertheless, I think there is something here. The consequences are nowhere near as dramatic as jmf claims, but it does seem that replace() has taken a serious performance hit. Perhaps it is unavoidable, but

#!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Gilles
Hello I've seen both shebang lines to run a Python script on a *nix host: #!/usr/bin/env python #!/usr/bin/python What's the difference? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Jussi Piitulainen
Gilles writes: #!/usr/bin/env python #!/usr/bin/python What's the difference? Not much if your python is /usr/bin/python: env looks for python and finds the same executable. When python is not /usr/bin/python but something else that is still found by your system, /usr/bin/env still finds

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Roy Smith
In article 34va6856ocuas7jpueujscf3kdt7k44...@4ax.com, Gilles nos...@nospam.com wrote: Hello I've seen both shebang lines to run a Python script on a *nix host: #!/usr/bin/env python #!/usr/bin/python What's the difference? The first one looks through your PATH to find the right

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Gilles
On Fri, 28 Sep 2012 06:57:28 -0400, Roy Smith r...@panix.com wrote: The first one looks through your PATH to find the right python interpreter to run. The second one is hard-wired to run /usr/bin/python. If you only have a single copy of python installed, it doesn't really matter which you

How to investigate web script not running?

2012-09-28 Thread Gilles
Hello I'm trying to run my very first FastCGI script on an Apache shared host that relies on mod_fcgid: == #!/usr/bin/python from fcgi import WSGIServer import cgitb # enable debugging cgitb.enable() def myapp(environ, start_response): start_response('200 OK',

Re: Article on the future of Python

2012-09-28 Thread rusi
On Sep 27, 5:11 pm, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 25 Sep 2012 09:15:00 +0100, Mark Lawrence wrote: And a response: http://data.geek.nz/python-is-doing-just-fine Summary

Re: Python source code easy to hack?

2012-09-28 Thread Mark Lawrence
On 28/09/2012 12:57, Jayden wrote: Dear All, I have a concern in developing commercial code with Python. Someone told me that its program can be easily hacked to get its source code. Is it really the case? Any way to protect your source code? Thanks a lot! Jayden This question has been

Re: How to investigate web script not running?

2012-09-28 Thread Gilles
On Fri, 28 Sep 2012 13:37:36 +0200, Gilles nos...@nospam.com wrote: == Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. == Looks like fcgi.py doesn't support WSGI: Traceback (most recent call

Re: Python source code easy to hack?

2012-09-28 Thread zig-zag
On 09/28/2012 02:17 PM, Mark Lawrence wrote: On 28/09/2012 12:57, Jayden wrote: Dear All, I have a concern in developing commercial code with Python. Someone told me that its program can be easily hacked to get its source code. Is it really the case? Any way to protect your source code?

Re: How to investigate web script not running?

2012-09-28 Thread Michael Ross
On Fri, 28 Sep 2012 13:37:36 +0200, Gilles nos...@nospam.com wrote: Hello I'm trying to run my very first FastCGI script on an Apache shared host that relies on mod_fcgid: == #!/usr/bin/python from fcgi import WSGIServer import cgitb # enable debugging cgitb.enable() def

Re: py2exe deal with python command line inside a program

2012-09-28 Thread Miki Tebeka
sys.executable was printed out as ''C:\\Python25\\python.exe'', how can I make this work in executable package through py2exe? Does http://www.py2exe.org/index.cgi/WhereAmI help? -- http://mail.python.org/mailman/listinfo/python-list

Re: Article on the future of Python

2012-09-28 Thread Steven D'Aprano
On Fri, 28 Sep 2012 05:08:24 -0700, rusi wrote: On Sep 27, 5:11 pm, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 25 Sep 2012 09:15:00 +0100, Mark Lawrence wrote: And a response:

what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change' and

2012-09-28 Thread 陈伟
-- http://mail.python.org/mailman/listinfo/python-list

Re: Article on the future of Python

2012-09-28 Thread rusi
On Sep 28, 5:54 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Fri, 28 Sep 2012 05:08:24 -0700, rusi wrote: On Sep 27, 5:11 pm, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread D'Arcy Cain
On Fri, 28 Sep 2012 06:57:28 -0400 Roy Smith r...@panix.com wrote: I've seen both shebang lines to run a Python script on a *nix host: #!/usr/bin/env python #!/usr/bin/python What's the difference? The first one looks through your PATH to find the right python interpreter to

Re: How to investigate web script not running?

2012-09-28 Thread Gilles
On Fri, 28 Sep 2012 14:16:22 +0200, Michael Ross g...@ross.cx wrote: Do it the other way around: # cgitb before anything else import cgitb cgitb.enable() # so this error will be caught from fcgi import WSGIServer Thanks much for the tip. The error isn't displayed when calling the script from a

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Gilles
On Fri, 28 Sep 2012 09:19:54 -0400, D'Arcy Cain da...@druid.net wrote: Not just flexible but portable. On various systems I have Python in /usr/bin, /usr/local/bin and /usr/pkg/bin. #!/usr/bin/env python finds it in each case so I only need one version of the script. Good to know. --

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Demian Brecht
On 12-09-28 06:19 AM, D'Arcy Cain wrote: Not just flexible but portable. On various systems I have Python in /usr/bin, /usr/local/bin and /usr/pkg/bin. #!/usr/bin/env python finds it in each case so I only need one version of the script. +1. This also resolves correctly on Cygwin, even if

Re: REST code-golf: How concisely can you expose and consume services?

2012-09-28 Thread Demian Brecht
(A little OT so my apologies up front) On 12-09-28 12:39 AM, Chris Angelico wrote: I love the idea, even though I shan't be entering. Code golf is awesome fun! Code golf is indeed awesome fun and I usually enjoy taking part as well. However, I'm not a fan of code golf such as this, that uses

Re: Python source code easy to hack?

2012-09-28 Thread sturla
kl. 13:57:14 UTC+2 fredag 28. september 2012 skrev Jayden følgende: Dear All, I have a concern in developing commercial code with Python. Someone told me that its program can be easily hacked to get its source code. Is it really the case? Any way to protect your source code? Thanks a lot!

Re: Python source code easy to hack?

2012-09-28 Thread Jerry Hill
On Fri, Sep 28, 2012 at 10:18 AM, stu...@molden.no wrote: Python bytecode is not easier to hack than Java or .NET bytecodes. This is true, but both java and .net are also relatively easy to decompile. In general though, why does it matter? What are you trying to protect yourself against? If

howto handle nested for

2012-09-28 Thread Neal Becker
I know this should be a fairly basic question, but I'm drawing a blank. I have code that looks like: for s0 in xrange (n_syms): for s1 in xrange (n_syms): for s2 in xrange (n_syms): for s3 in xrange (n_syms): for s4 in range (n_syms):

Re: howto handle nested for

2012-09-28 Thread Alister
On Fri, 28 Sep 2012 10:39:32 -0400, Neal Becker wrote: I know this should be a fairly basic question, but I'm drawing a blank. I have code that looks like: for s0 in xrange (n_syms): for s1 in xrange (n_syms): for s2 in xrange (n_syms): for s3 in

Re: howto handle nested for

2012-09-28 Thread Wojtek
W dniu 2012-09-28 16:42, Alister pisze: On Fri, 28 Sep 2012 10:39:32 -0400, Neal Becker wrote: I know this should be a fairly basic question, but I'm drawing a blank. I have code that looks like: for s0 in xrange (n_syms): for s1 in xrange (n_syms): for s2 in xrange

Re: Article on the future of Python

2012-09-28 Thread Chris Angelico
On Sat, Sep 29, 2012 at 12:31 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Fri, 28 Sep 2012 14:37:21 +1000, Chris Angelico ros...@gmail.com declaimed the following in gmane.comp.python.general: For further details, poke around on the web; I'm sure you'll find plenty of good blog

Re: howto handle nested for

2012-09-28 Thread Laszlo Nagy
On 2012-09-28 16:39, Neal Becker wrote: I know this should be a fairly basic question, but I'm drawing a blank. I have code that looks like: for s0 in xrange (n_syms): for s1 in xrange (n_syms): for s2 in xrange (n_syms): for s3 in xrange (n_syms):

Re: what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change'

2012-09-28 Thread Chris Angelico
On Fri, Sep 28, 2012 at 11:12 PM, 陈伟 chenwei.addr...@gmail.com wrote: -- http://mail.python.org/mailman/listinfo/python-list In future, can you put the body of your message into the body please? :) ctime is creation time, not change time. mtime is modification time, as you have. But I can

Re: Article on the future of Python

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 8:58 AM, Chris Angelico ros...@gmail.com wrote: Yes, MySQL has definitely improved. There was a time when its unreliability applied to all your data too, but now you can just click in InnoDB and have mostly-real transaction support etc. But there's still a lot of work

Re: what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change'

2012-09-28 Thread Christian Heimes
Am 28.09.2012 17:07, schrieb Chris Angelico: On Fri, Sep 28, 2012 at 11:12 PM, 陈伟 chenwei.addr...@gmail.com wrote: -- http://mail.python.org/mailman/listinfo/python-list In future, can you put the body of your message into the body please? :) ctime is creation time, not change time.

Re: Python source code easy to hack?

2012-09-28 Thread sturla
kl. 16:38:10 UTC+2 fredag 28. september 2012 skrev Jerry Hill følgende: This is true, but both java and .net are also relatively easy to decompile. Neither of them are very obfuscated. In general though, why does it matter? Paranoia among managers? What are you trying to protect

Re: Article on the future of Python

2012-09-28 Thread Chris Angelico
On Sat, Sep 29, 2012 at 1:14 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, Sep 28, 2012 at 8:58 AM, Chris Angelico ros...@gmail.com wrote: Yes, MySQL has definitely improved. There was a time when its unreliability applied to all your data too, but now you can just click in InnoDB and

Re: what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change'

2012-09-28 Thread Chris Angelico
On Sat, Sep 29, 2012 at 1:18 AM, Christian Heimes christ...@python.org wrote: Am 28.09.2012 17:07, schrieb Chris Angelico: In the future please read the manual before replying! ;) You are wrong, ctime is *not* the creation time. It's the change time of the inode. It's updated whenever the

Re: howto handle nested for

2012-09-28 Thread Tim Chase
On 09/28/12 09:39, Neal Becker wrote: I know this should be a fairly basic question, but I'm drawing a blank. I have code that looks like: for s0 in xrange (n_syms): for s1 in xrange (n_syms): for s2 in xrange (n_syms): for s3 in xrange (n_syms):

Re: howto handle nested for

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 8:39 AM, Neal Becker ndbeck...@gmail.com wrote: I know this should be a fairly basic question, but I'm drawing a blank. I have code that looks like: for s0 in xrange (n_syms): for s1 in xrange (n_syms): for s2 in xrange (n_syms):

Re: howto handle nested for

2012-09-28 Thread Neal Becker
Neal Becker wrote: I know this should be a fairly basic question, but I'm drawing a blank. I have code that looks like: for s0 in xrange (n_syms): for s1 in xrange (n_syms): for s2 in xrange (n_syms): for s3 in xrange (n_syms):

Re: Article on the future of Python

2012-09-28 Thread rurpy
On 09/27/2012 10:37 PM, Chris Angelico wrote:[...] * MySQL is designed for dynamic web sites, with lots of reading and not too much writing. Its row and table locking system is pretty rudimentary, and it's quite easy for performance to suffer really badly if you don't think about it. But if

Re: howto handle nested for

2012-09-28 Thread Peter Otten
Neal Becker wrote: I know this should be a fairly basic question, but I'm drawing a blank. I have code that looks like: for s0 in xrange (n_syms): for s1 in xrange (n_syms): for s2 in xrange (n_syms): for s3 in xrange (n_syms):

Re: Python source code easy to hack?

2012-09-28 Thread Littlefield, Tyler
On 9/28/2012 9:19 AM, stu...@molden.no wrote: kl. 16:38:10 UTC+2 fredag 28. september 2012 skrev Jerry Hill følgende: This is true, but both java and .net are also relatively easy to decompile. Neither of them are very obfuscated. In general though, why does it matter? Paranoia among

Re: howto handle nested for

2012-09-28 Thread Ian Kelly
On Sep 28, 2012 9:49 AM, Ian Kelly ian.g.ke...@gmail.com wrote: levels = 6 for combination in itertools.product(xrange(n_syms), levels): # do stuff Sorry, that should have read product(xrange(n_syms), repeat=levels). The repeat argument is keyword-only. --

How to get progress in python script.

2012-09-28 Thread Rolando Cañer Roblejo
Hi all, Please, I need you suggest me a way to get statistics about a progress of my python script. My python script could take a lot of time processing a file, so I need a way that an external program check the progress of the script. My first idea was that the python script write a temp

Re: REST code-golf: How concisely can you expose and consume services?

2012-09-28 Thread Alec Taylor
On Sat, Sep 29, 2012 at 12:17 AM, Demian Brecht demianbre...@gmail.com wrote: (A little OT so my apologies up front) On 12-09-28 12:39 AM, Chris Angelico wrote: I love the idea, even though I shan't be entering. Code golf is awesome fun! Code golf is indeed awesome fun and I usually

Re: How to get progress in python script.

2012-09-28 Thread John Gordon
In mailman.1571.1348849432.27098.python-l...@python.org =?ISO-8859-1?Q?Rolando_Ca=F1er_Roblejo?= rolando.ca...@gmail.com writes: Hi all, Please, I need you suggest me a way to get statistics about a progress of my python script. My python script could take a lot of time processing a file,

Re: How to get progress in python script.

2012-09-28 Thread Jean-Michel Pichavant
- Original Message - Hi all, Please, I need you suggest me a way to get statistics about a progress of my python script. My python script could take a lot of time processing a file, so I need a way that an external program check the progress of the script. My first idea was that

Re: what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change'

2012-09-28 Thread Nobody
On Fri, 28 Sep 2012 06:12:35 -0700, 陈伟 wrote: what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change' and 'modification'. st_mtime is updated when the

Re: Python source code easy to hack?

2012-09-28 Thread 88888 Dihedral
Jayden於 2012年9月28日星期五UTC+8下午7時57分14秒寫道: Dear All, I have a concern in developing commercial code with Python. Someone told me that its program can be easily hacked to get its source code. Is it really the case? Any way to protect your source code? Thanks a lot! Jayden

Re: what is the difference between st_ctime and st_mtime one is the time of last change and the other is the time of last modification, but i can not understand what is the difference between 'change'

2012-09-28 Thread Kristen J. Webb
The Windows stat() call treats things differently, FROM: http://msdn.microsoft.com/en-us/library/14h5k7ff%28v=vs.80%29.aspx st_ctime Time of creation of file. Valid on NTFS but not on FAT formatted disk drives. I don't think that Windows has a concept of a change time for meta data

RE: data attributes override method attributes?

2012-09-28 Thread Prasad, Ramit
Terry Reedy wrote: On 9/25/2012 4:07 PM, Ian Kelly wrote: On Tue, Sep 25, 2012 at 1:58 PM, Terry Reedy tjre...@udel.edu wrote: On 9/25/2012 11:03 AM, Chris Angelico wrote: Instance attributes override (shadow) class attributes. except for (some? all?) special methods Those names

RE: regular expression : the dollar sign ($) work with re.match() or re.search() ?

2012-09-28 Thread Prasad, Ramit
iMath wrote: Sent: Wednesday, September 26, 2012 2:39 AM To: python-list@python.org Subject: regular expression : the dollar sign ($) work with re.match() or re.search() ? I only know the dollar sign ($) will match a pattern from the end of a string,but which method does it work with

Re: data attributes override method attributes?

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 12:02 PM, Prasad, Ramit ramit.pra...@jpmorgan.com wrote: Just to make sure I am following, if you call foo.__len__() it goes to the instance code while if you do len(foo) it will go to class.__len__()? Yes: class Foo(object): ... def __len__(self): ...

Re: data attributes override method attributes?

2012-09-28 Thread Terry Reedy
On 9/28/2012 2:02 PM, Prasad, Ramit wrote: Just to make sure I am following, if you call foo.__len__() it goes to the instance code while if you do len(foo) it will go to class.__len__()? len(foo) calls someclass.__len__(foo) where someclass is foo.__class__or some superclass. If so, why?

Re: regular expression : the dollar sign ($) work with re.match() or re.search() ?

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 12:07 PM, Prasad, Ramit ramit.pra...@jpmorgan.com wrote: I guess you can consider re.match's pattern to be prefixed with '^'. You can in this case, but they're not equivalent in multi-line mode: re.match('^two', 'one\ntwo', re.M) re.search('^two', 'one\ntwo', re.M)

print or write on a text file ?

2012-09-28 Thread Franck Ditter
Hi ! Here is Python 3.3 Is it better in any way to use print(x,x,x,file='out') or out.write(x) ? Any reason to prefer any of them ? There should be a printlines, like readlines ? Thanks, franck -- http://mail.python.org/mailman/listinfo/python-list

Re: Article on the future of Python

2012-09-28 Thread Devin Jeanpierre
On Thu, Sep 27, 2012 at 8:59 PM, alex23 wuwe...@gmail.com wrote: On Sep 28, 2:17 am, Devin Jeanpierre jeanpierr...@gmail.com wrote: Uncharitably, it's just a way of hiding one's head in the sand, ignoring any problems Python has by focusing on what problems it doesn't have. But isn't that

RE: [python-list] python application file format

2012-09-28 Thread Prasad, Ramit
Benjamin Jessup wrote: Hello all, What do people recommend for a file format for a python desktop application? Data is complex with 100s/1000s of class instances, which reference each other. Write the file with struct module? (Rebuild object pointers, safe, compact, portable, not

Re: howto handle nested for

2012-09-28 Thread Neil Cerutti
On 2012-09-28, Laszlo Nagy gand...@shopzeus.com wrote: In your example, it seem that the iterable of the for loop is always the same: range(n_sysms). It seems to be a number. Is that true? If that is so, then here is something useful: import copy class MultiLevelIterator(object): def

Re: print or write on a text file ?

2012-09-28 Thread Wayne Werner
On Fri, 28 Sep 2012, Franck Ditter wrote: Hi ! Here is Python 3.3 Is it better in any way to use print(x,x,x,file='out') or out.write(x) ? Any reason to prefer any of them ? There should be a printlines, like readlines ? Thanks, The print function automatically appends newlines to the end of

How to pass FILE *

2012-09-28 Thread xDog Walker
The function I am trying to call wants a FILE *: dlg_progressbox(const char *title, const char *cprompt, int height, int width, int pauseopt, FILE *fp) I can open the file to be referenced: fp =

[fcgi.py] Force cache upgrade?

2012-09-28 Thread Gilles
Hello Does someone know if something must be done after editing a FastCGI + WSGI script so that the changes will show in the browser immediately instead of having to wait X minutes? === #!/usr/bin/env python2.6 def myapp(environ, start_response): start_response('200 OK',

creating an artificial last element in sort list

2012-09-28 Thread dave
a = ['a', 'b', x] b = sorted(a) What does x need to be to always be last on an ascending sort no matter what 'a' and 'b' are within reason... I am expecting 'a' and 'b' will be not longer than 10 char's long I tried making x = '' and believe it or not, this appears

Re: [fcgi.py] Force cache upgrade?

2012-09-28 Thread Demian Brecht
If you don't have access to restart Apache (or `x` server), then touch fcgi.py *should* work. On Fri, Sep 28, 2012 at 2:57 PM, Gilles nos...@nospam.com wrote: Hello Does someone know if something must be done after editing a FastCGI + WSGI script so that the changes will show in the browser

Re: creating an artificial last element in sort list

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 5:39 PM, dave davidrey...@gmail.com wrote: a = ['a', 'b', x] b = sorted(a) What does x need to be to always be last on an ascending sort no matter what 'a' and 'b' are within reason... I am expecting 'a' and 'b' will be not longer than 10 char's long I

Re: creating an artificial last element in sort list

2012-09-28 Thread dave
more clearer, this is a more realistic use case: ['awefawef', 'awefawfsf', 'awefsdf', 'zz', 'zz', 'zz'] and the quantity of ''zz'' would be dynamic. On Friday, September 28, 2012 4:46:15 PM UTC-7, Ian wrote: a = ['a', 'b', x] b =

Re: creating an artificial last element in sort list

2012-09-28 Thread Demian Brecht
Maybe l = filter(a, lambda v: v == a[-1]) sorted(a[:-len(l)]) + l ? On Fri, Sep 28, 2012 at 4:51 PM, dave davidrey...@gmail.com wrote: more clearer, this is a more realistic use case: ['awefawef', 'awefawfsf', 'awefsdf', 'zz', 'zz', 'zz'] and the

Re: [fcgi.py] Force cache upgrade?

2012-09-28 Thread Gilles
On Fri, 28 Sep 2012 23:57:14 +0200, Gilles nos...@nospam.com wrote: I guess the FastCGI server (Flup) only updates its cache every so often. Do I need to type a command to force Flup to recompile the Python script? Turns out that, yes, mod_fcgid is configured to reload a script only after some

Re: creating an artificial last element in sort list

2012-09-28 Thread 88888 Dihedral
dave於 2012年9月29日星期六UTC+8上午7時51分10秒寫道: more clearer, this is a more realistic use case: ['awefawef', 'awefawfsf', 'awefsdf', 'zz', 'zz', 'zz'] and the quantity of ''zz'' would be dynamic. On Friday, September 28, 2012 4:46:15

write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread iMath
write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. -- http://mail.python.org/mailman/listinfo/python-list

Re: creating an artificial last element in sort list

2012-09-28 Thread Demian Brecht
Apparently gmail hates me and my last response didn't get through: a = ['awefawef', 'awefawfsf', 'awefsdf', 'zz', 'zz', 'zz'] f = filter(lambda s: s == a[-1], a) l = sorted(lst[:-len(f)]) + f Now, not 100% sure about efficiency over large sizes of a, but

Re: print or write on a text file ?

2012-09-28 Thread Terry Reedy
On 9/28/2012 2:42 PM, Franck Ditter wrote: Hi ! Here is Python 3.3 Is it better in any way to use print(x,x,x,file='out') or out.write(x) ? Any reason to prefer any of them ? print converts objects to strings and adds separators and terminators. If you have a string s and want to output it as

Re: how to run shell command like EOT .... EOT

2012-09-28 Thread 叶佑群
于 2012-9-28 16:16, Kushal Kumaran 写道: On Fri, Sep 28, 2012 at 1:15 PM, 叶佑群ye.you...@eisoo.com wrote: Hi, all, I have the shell command like this: sfdisk -uM /dev/sdb EOT ,1000,83 ,,83 EOT I have tried subprocess.Popen, pexpect.spawn and os.popen, but none of these works, but

Re: how to run shell command like EOT .... EOT

2012-09-28 Thread 叶佑群
于 2012-9-28 16:16, Kushal Kumaran 写道: On Fri, Sep 28, 2012 at 1:15 PM, 叶佑群ye.you...@eisoo.com wrote: Hi, all, I have the shell command like this: sfdisk -uM /dev/sdb EOT ,1000,83 ,,83 EOT I have tried subprocess.Popen, pexpect.spawn and os.popen, but none of these works, but

Re: creating an artificial last element in sort list

2012-09-28 Thread Demian Brecht
f = filter(lambda s: s == a[-1], a) That line's assuming that the last element may also be found in arbitrary locations in the list. If it's guaranteed that they're all contiguous at the upper bounds, I'd just walk the list backwards until I found one that wasn't matching rather than

Re: Reducing cache/buffer for faster display

2012-09-28 Thread Rikishi42
On 2012-09-28, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Thu, 27 Sep 2012 22:25:39 + (UTC), John Gordon gor...@panix.com declaimed the following in gmane.comp.python.general: Isn't terminal output line-buffered? I don't understand why there would be an output delay. (Unless

Re: Reducing cache/buffer for faster display

2012-09-28 Thread Rikishi42
On 2012-09-28, Chris Angelico ros...@gmail.com wrote: On Fri, Sep 28, 2012 at 10:05 AM, Rikishi42 skunkwo...@rikishi42.net wrote: The scripts in question only increase numbers. But should that not be the case, solutions are simple enough. The numbers can be formatted to have a fixed size. In

Re: howto handle nested for

2012-09-28 Thread Peter Pearson
On Fri, 28 Sep 2012 09:49:36 -0600, Ian Kelly ian.g.ke...@gmail.com wrote: levels = 6 for combination in itertools.product(xrange(n_syms), levels): # do stuff n_syms = 3 levels = 6 for combination in itertools.product(xrange(n_syms), levels): ... print combination ... Traceback

Re: creating an artificial last element in sort list

2012-09-28 Thread duncan smith
On 29/09/12 00:51, dave wrote: more clearer, this is a more realistic use case: ['awefawef', 'awefawfsf', 'awefsdf', 'zz', 'zz', 'zz'] and the quantity of ''zz'' would be dynamic. Maybe, class Greatest: def __lt__(self, other):

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Tim Chase
On 09/28/12 19:31, iMath wrote: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Okay, that was pretty easy. Thanks for the challenge :-) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: creating an artificial last element in sort list

2012-09-28 Thread Paul Rubin
dave davidrey...@gmail.com writes: What does x need to be to always be last on an ascending sort no matter what 'a' and 'b' are within reason... Why are you trying to do that? It sounds ugly. Just sort the list with the a's and b's. If you absolutely have to, you could make a class with

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Paul Rubin
iMath redstone-c...@163.com writes: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. And then you have two problems. -- http://mail.python.org/mailman/listinfo/python-list

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Mark Lawrence
On 29/09/2012 02:35, Tim Chase wrote: On 09/28/12 19:31, iMath wrote: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Okay, that was pretty easy. Thanks for the challenge :-) -tkc What's the run time speed like? How much memory does it use? Shouldn't you be

Re: QThread.terminate in Python 3

2012-09-28 Thread Lee Harr
I understand that use of QThread.terminate is discouraged, but it has worked well previously and I would like to continue this use if possible.       And now you've encountered the reason it is discouraged. Ok. Point taken. What I hear you saying is that once I use .terminate anything

Re: creating an artificial last element in sort list

2012-09-28 Thread Steven D'Aprano
On Fri, 28 Sep 2012 16:39:33 -0700, dave wrote: a = ['a', 'b', x] b = sorted(a) What does x need to be to always be last on an ascending sort no matter what 'a' and 'b' are within reason... How about this? a = ['a', 'b'] b = sorted(a) + ['whatever you want'] You could also do this:

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Tim Chase
On 09/28/12 20:58, Mark Lawrence wrote: On 29/09/2012 02:35, Tim Chase wrote: On 09/28/12 19:31, iMath wrote: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Okay, that was pretty easy. Thanks for the challenge :-) What's the run time speed like? O(1) r =

Missing library path (WIndows)

2012-09-28 Thread FPEFPE
Hello -- I am running python from an application, starting it with a call to the python31.dll I think I am missing something in my path -- any help would be appreciated -- thanks Here is the script and the output --- # this is a test import sys print('hello from python') print('Number of

Re: Article on the future of Python

2012-09-28 Thread Steven D'Aprano
On Fri, 28 Sep 2012 14:50:14 -0400, Devin Jeanpierre wrote: I'm pretty sure nobody thinks Python is on a death march. Don't be so sure. There's always *someone* complaining about something, and they're usually convinced that (Language X) is on it's last legs because (feature Y) is missing or

Re: data attributes override method attributes?

2012-09-28 Thread Steven D'Aprano
On Fri, 28 Sep 2012 18:02:04 +, Prasad, Ramit wrote: Just to make sure I am following, if you call foo.__len__() it goes to the instance code while if you do len(foo) it will go to class.__len__()? If you call foo.__len__, the attribute lookup of __len__ will use the exact same search

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 8:17 PM, Tim Chase python.l...@tim.thechases.com wrote: On 09/28/12 20:58, Mark Lawrence wrote: On 29/09/2012 02:35, Tim Chase wrote: On 09/28/12 19:31, iMath wrote: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. Okay, that was pretty easy.

Re: creating an artificial last element in sort list

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 6:59 PM, Demian Brecht demianbre...@gmail.com wrote: f = filter(lambda s: s == a[-1], a) That line's assuming that the last element may also be found in arbitrary locations in the list. If it's guaranteed that they're all contiguous at the upper bounds, I'd just walk

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Steven D'Aprano
On Fri, 28 Sep 2012 21:25:35 -0600, Ian Kelly wrote: Mine is simpler and faster. r = re.compile() The OP doesn't say that you have to compile it, so just: '' wins. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Tim Chase
On 09/28/12 22:25, Ian Kelly wrote: On Fri, Sep 28, 2012 at 8:17 PM, Tim Chase On 09/28/12 19:31, iMath wrote: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. r = re.compile( 800-555-1212| 555-1212| r\(800\) 555-1212 ) Mine is simpler and faster.

Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212.

2012-09-28 Thread Tim Chase
On 09/28/12 22:30, Steven D'Aprano wrote: On Fri, 28 Sep 2012 21:25:35 -0600, Ian Kelly wrote: Mine is simpler and faster. r = re.compile() The OP doesn't say that you have to compile it, so just: '' wins. OP doesn't say it even has to be a string, so I guess wins. :-P

  1   2   3   >