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

2012-09-28 Thread Fg Nu
- Original Message - From: Tim Chase To: Ian Kelly Cc: Python Sent: Saturday, September 29, 2012 9:12 AM Subject: Re: write a regex matches 800-555-1212, 555-1212, and also (800) 555-1212. On 09/28/12 22:25, Ian Kelly wrote: > On Fri, Sep 28, 2012 at 8:17 PM, Tim Chase On 09/2

Re: How to pass FILE *

2012-09-28 Thread Chris Rebert
On Fri, Sep 28, 2012 at 2:55 PM, xDog Walker wrote: > > 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 *

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

2012-09-28 Thread Devin Jeanpierre
On Fri, Sep 28, 2012 at 9:58 PM, Mark Lawrence wrote: > What's the run time speed like? How much memory does it use? Shouldn't you > be using the regex module from pypi instead of the standard library re? > Guess who's borrowed the time machine? O(n), O(1), and I used RE2. -- Devin -- http://

Re: creating an artificial "last element" in sort list

2012-09-28 Thread Demian Brecht
On Fri, Sep 28, 2012 at 8:29 PM, Ian Kelly wrote: > The slicing operation in the second line assumes that they're all > collected at the end of the list anyway. > True enough. Hadn't considered otherwise when I first whipped that off with the first example (thinking/trying it out *before* posti

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

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

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: 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 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 the list backwar

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 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. Thanks for the c

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

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 ar

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

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 thi

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 anyth

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 using

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

2012-09-28 Thread Paul Rubin
iMath 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: creating an artificial "last element" in sort list

2012-09-28 Thread Paul Rubin
dave 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 comparison methods

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 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): r

Re: howto handle nested for

2012-09-28 Thread Peter Pearson
On Fri, 28 Sep 2012 09:49:36 -0600, Ian Kelly 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 (most recent

Re: Reducing cache/buffer for faster display

2012-09-28 Thread Rikishi42
On 2012-09-28, Chris Angelico wrote: > On Fri, Sep 28, 2012 at 10:05 AM, Rikishi42 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

Re: Reducing cache/buffer for faster display

2012-09-28 Thread Rikishi42
On 2012-09-28, Dennis Lee Bieber wrote: > On Thu, 27 Sep 2012 22:25:39 + (UTC), John Gordon > 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 the "\r" is messing things up..

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 filterin

Re: how to run shell command like "<

2012-09-28 Thread 叶佑群
于 2012-9-28 16:16, Kushal Kumaran 写道: On Fri, Sep 28, 2012 at 1:15 PM, 叶佑群 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 shel

Re: how to run shell command like "<

2012-09-28 Thread 叶佑群
于 2012-9-28 16:16, Kushal Kumaran 写道: On Fri, Sep 28, 2012 at 1:15 PM, 叶佑群 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 shel

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

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

Re: [fcgi.py] Force cache upgrade?

2012-09-28 Thread Gilles
On Fri, 28 Sep 2012 23:57:14 +0200, Gilles 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 time or some numb

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 wrote: > more clearer, this is a more realistic use case: > > ['awefawef', 'awefawfsf', 'awefsdf', 'zz', 'zz', > 'zz'] > > and the quantity of ''zzz

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] > > > > > >

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 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 tried making x = 'z

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 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 immediately >

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 FIRS

[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', [('Conte

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 = os.fdopen(self.pipef

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 w

Re: howto handle nested for

2012-09-28 Thread Neil Cerutti
On 2012-09-28, Laszlo Nagy 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 __init__(self

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: Article on the future of Python

2012-09-28 Thread Devin Jeanpierre
On Thu, Sep 27, 2012 at 8:59 PM, alex23 wrote: > On Sep 28, 2:17 am, Devin Jeanpierre 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 what counterpoint is all about?

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: 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 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) <_sre.SRE_Match obje

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: data attributes override method attributes?

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 12: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__()? Yes: >>> class Foo(object): ... def __len__(self): ... return 42 ... >>> foo =

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 wi

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 wrote: > >> On 9/25/2012 11:03 AM, Chris Angelico wrote: > >>> Instance attributes override (shadow) class attributes. > >> > >> > >> except for (some? all?) special methods > > > > Those n

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 (th

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! > > >

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 th

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 t

Re: How to get progress in python script.

2012-09-28 Thread John Gordon
In =?ISO-8859-1?Q?Rolando_Ca=F1er_Roblejo?= 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, so I need a way that an external program check the > progress of the s

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 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 enjoy taking p

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 fil

Re: howto handle nested for

2012-09-28 Thread Ian Kelly
On Sep 28, 2012 9:49 AM, "Ian Kelly" 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. -- http://mail.python.org/mailman/listinfo/python-

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 man

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

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: howto handle nested for

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 8:39 AM, 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 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_sy

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 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 inode is modified, e.

Re: Article on the future of Python

2012-09-28 Thread Chris Angelico
On Sat, Sep 29, 2012 at 1:14 AM, Ian Kelly wrote: > On Fri, Sep 28, 2012 at 8:58 AM, Chris Angelico 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 suppo

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 y

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, 陈伟 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 modificati

Re: Article on the future of Python

2012-09-28 Thread Ian Kelly
On Fri, Sep 28, 2012 at 8:58 AM, Chris Angelico 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 that by requir

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, 陈伟 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 understand where the confu

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: Article on the future of Python

2012-09-28 Thread Chris Angelico
On Sat, Sep 29, 2012 at 12:31 AM, Dennis Lee Bieber wrote: > On Fri, 28 Sep 2012 14:37:21 +1000, Chris Angelico > 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 posts etc. But as for me and my h

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

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: Python source code easy to hack?

2012-09-28 Thread Jerry Hill
On Fri, Sep 28, 2012 at 10:18 AM, 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 you're including

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! J

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: "#!/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: "#!/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 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. -- http://mail.python.o

Re: How to investigate web script not running?

2012-09-28 Thread Gilles
On Fri, 28 Sep 2012 14:16:22 +0200, "Michael Ross" 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 we

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 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 run

Re: Article on the future of Python

2012-09-28 Thread rusi
On Sep 28, 5:54 pm, Steven D'Aprano wrote: > On Fri, 28 Sep 2012 05:08:24 -0700, rusi wrote: > > On Sep 27, 5:11 pm, Devin Jeanpierre wrote: > >> On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano > > >> 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 Steven D'Aprano
On Fri, 28 Sep 2012 05:08:24 -0700, rusi wrote: > On Sep 27, 5:11 pm, Devin Jeanpierre wrote: >> On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano >> >> 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 >

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: How to investigate web script not running?

2012-09-28 Thread Michael Ross
On Fri, 28 Sep 2012 13:37:36 +0200, Gilles 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 myapp(environ, start_respo

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? Thanks

Re: How to investigate web script not running?

2012-09-28 Thread Gilles
On Fri, 28 Sep 2012 13:37:36 +0200, Gilles 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 last): File "he

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 as

Re: Article on the future of Python

2012-09-28 Thread rusi
On Sep 27, 5:11 pm, Devin Jeanpierre wrote: > On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano > > 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 of that article: > > "Sure, you have all these

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', [('Content-Type

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 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 use. But, yo

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

2012-09-28 Thread Roy Smith
In article <34va6856ocuas7jpueujscf3kdt7k44...@4ax.com>, Gilles 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 python inte

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 find

"#!/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: 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 pe

Re: how to run shell command like "<

2012-09-28 Thread Kushal Kumaran
On Fri, Sep 28, 2012 at 1:15 PM, 叶佑群 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 shell, it

Re: Reducing cache/buffer for faster display

2012-09-28 Thread Chris Angelico
On Fri, Sep 28, 2012 at 10:05 AM, Rikishi42 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, say) > it's enough to

how to run shell command like "<

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 o

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 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 markup... with two one-

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

  1   2   >