pypiserver 0.1.3 - minimal pypi server

2011-08-02 Thread Ralf Schmitt
Hi, I've just uploaded pypiserver 0.1.3 to the python package index. pypiserver is a minimal PyPI compatible server. It can be used to serve a set of packages and eggs to easy_install or pip. pypiserver is easy to install (i.e. just easy_install pypiserver). It doesn't have any external

Announcing Python Tools for Visual Studio - RC2

2011-08-02 Thread Dino Viehland
We're pleased to announce the release of Python Tools for Visual Studio - RC 2. Python Tools for Visual Studio (PTVS) is an open-source plug-in for Visual Studio which supports programming with the Python programming language. PTVS is released under the Apache License, 2.0. This release

Re: python reading file memory cost

2011-08-02 Thread Chris Rebert
On Mon, Aug 1, 2011 at 8:22 PM, Tony Zhang warriorla...@gmail.com wrote: Thanks! Actually, I used .readline() to parse file line by line, because I need to find out the start position to extract data into list, and the end point to pause extracting, then repeat until the end of file. My file

range() vs xrange() Python2|3 issues for performance

2011-08-02 Thread harrismh777
The following is intended as a helpful small extension to the xrange() range() discussion brought up this past weekend by Billy Mays... With Python2 you basically have two ways to get a range of numbers: range() , which returns a list, and xrange() , which returns an iterator. With

Re: Notifications when process is killed

2011-08-02 Thread AndDM
On Aug 1, 5:39 pm, Andrea Di Mario anddima...@gmail.com wrote: Thanks Thomas, it is what i'm looking for. Regards -- Andrea Di Mario Hi, i've a little problem, here the code that i use: def receive_signal(signum, stack): logging.info('Received: %s' % signum)

Re: range() vs xrange() Python2|3 issues for performance

2011-08-02 Thread garabik-news-2005-05
harrismh777 har...@member.fsf.org wrote: these will run on either Python2 or Python3... except that if you substitute xrange() for range() for Python2 they will throw an exception on Python3... doh. if 'xrange' not in dir(__builtins__): xrange = range at the beginning of your program

Re: python reading file memory cost

2011-08-02 Thread Peter Otten
Chris Rebert wrote: The running result was that read a 500M file consume almost 2GB RAM, I cannot figure it out, somebody help! If you could store the floats themselves, rather than their string representations, that would be more space-efficient. You could then also use the `array`

Re: Notifications when process is killed

2011-08-02 Thread Thomas Rachel
Am 02.08.2011 09:30 schrieb AndDM: The function works for SIGHUP and SIGINT, but it doesn't work for SIGTERM. I've tried with simple killall and with -15 option. Have you some ideas? SIGTERM cannot be caught - it kills the process the hard way. HTH, Thomas --

Re: Notifications when process is killed

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 8:30 AM, AndDM anddima...@gmail.com wrote:        def receive_signal(signum, stack):                logging.info('Received: %s' % signum)                reactor.stop()        signal.signal(signal.SIGTERM, receive_signal)        signal.signal(signal.SIGHUP,

Re: range() vs xrange() Python2|3 issues for performance

2011-08-02 Thread Peter Otten
harrismh777 wrote: The following is intended as a helpful small extension to the xrange() range() discussion brought up this past weekend by Billy Mays... With Python2 you basically have two ways to get a range of numbers: range() , which returns a list, and xrange() , which

Re: range() vs xrange() Python2|3 issues for performance

2011-08-02 Thread Stefan Behnel
harrismh777, 02.08.2011 09:12: With Python2 you basically have two ways to get a range of numbers: range() , which returns a list, and xrange() , which returns an iterator. With Python3 you must use range(), which produces an iterator; while xrange() does not exist at all (at least not on 3.2).

Re: range() vs xrange() Python2|3 issues for performance

2011-08-02 Thread Thomas Rachel
Am 02.08.2011 09:12 schrieb harrismh777: The following is intended as a helpful small extension to the xrange() range() discussion brought up this past weekend by Billy Mays... With Python2 you basically have two ways to get a range of numbers: range() , which returns a list, and xrange() ,

Hardlink sub-directories and files

2011-08-02 Thread loial
I am trying to hardlink all files in a directory structure using os.link. This works fine for files, but the directory also contains sub- directories (which themselves contain files and sub-directories). However I do not think it is possible to hard link directories ? So presumably I would need

Re: range() vs xrange() Python2|3 issues for performance

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 10:20 AM, Stefan Behnel stefan...@behnel.de wrote: What version of Py3 were you using? If you used the latest, maybe even the latest hg version, you will notice that that's substantially faster for integers than, e.g. 3.1.x. I just tried this out, using a slightly

Re: Hardlink sub-directories and files

2011-08-02 Thread Peter Otten
loial wrote: I am trying to hardlink all files in a directory structure using os.link. This works fine for files, but the directory also contains sub- directories (which themselves contain files and sub-directories). However I do not think it is possible to hard link directories ? So

Re: Hardlink sub-directories and files

2011-08-02 Thread Thomas Jollans
On 02/08/11 11:32, loial wrote: I am trying to hardlink all files in a directory structure using os.link. This works fine for files, but the directory also contains sub- directories (which themselves contain files and sub-directories). However I do not think it is possible to hard link

Re: range() vs xrange() Python2|3 issues for performance

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 10:05 AM, Peter Otten __pete...@web.de wrote: i/2 returns a float in Python 3; you should use i//2 for consistency. And I forgot to make this change before doing my tests. Redoing the Python 3 ones with // quite drastically changes things! 3.2 (r32:88445, Feb 20 2011,

Re: Deeply nested dictionaries - should I look into a database or am I just doing it wrong?

2011-08-02 Thread BlueBird
I love named tuples, they rock for this kind of task: storing complicated structure in a python compatible way, without too much hassle. And as far as load/save on disk is concerned, I simply use regular python structure with safe eval [1]. I get all the flexibility that I need for the file

Re: Complex sort on big files

2011-08-02 Thread Alistair Miles
Hi Dan, Thanks for the reply. On Mon, Aug 1, 2011 at 5:45 PM, Dan Stromberg drsali...@gmail.com wrote: Python 2.x, or Python 3.x? Currently Python 2.x. What are the types of your sort keys? Both numbers and strings. If you're on 3.x and the key you need reversed is numeric, you can

Notifications when process is killed

2011-08-02 Thread Andrea Di Mario
You won't be able to catch SIGTERM, as Thomas said, but if you need to know what caused a process to end, the best way is to have code in the parent process to catch SIGCHLD. When the child ends, for any reason, its parent is sent SIGCHLD with some parameters, including the signal number that

Re: Notifications when process is killed

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 11:36 AM, Andrea Di Mario anddima...@gmail.com wrote: If i use SIGCHLD, i will have difficult when parent receive a SIGTERM, or not? What you would do is create two processes. Set up your signal handlers, then fork; in the parent, just watch for the child's death - in the

RE: python reading file memory cost

2011-08-02 Thread 张彤
Thanks Peter! Your explanation is great! And one more question: Why it is still keeping the memory even when I del the large array in interactive python mode? -Original Message- From: Peter Otten [mailto:__pete...@web.de] Sent: Tuesday, August 02, 2011 4:26 PM To: python-list@python.org

Re: python reading file memory cost

2011-08-02 Thread Thomas Jollans
On 02/08/11 13:00, 张彤 wrote: Thanks Peter! Your explanation is great! And one more question: Why it is still keeping the memory even when I del the large array in interactive python mode? This is an optimisation of the way the Python interpreter allocates memory: it holds on to memory it's

Re: how to solve it?

2011-08-02 Thread TheSaint
守株待兔 wrote: from matplotlib.matlab import * maybe you didn't install it http://matplotlib.sourceforge.net/ BTW you haven't mention what version of python you're running. -- http://mail.python.org/mailman/listinfo/python-list

Re: Notifications when process is killed

2011-08-02 Thread Kushal Kumaran
On Tue, Aug 2, 2011 at 1:56 PM, Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de wrote: Am 02.08.2011 09:30 schrieb AndDM: The function works for SIGHUP and SIGINT, but it doesn't work for SIGTERM. I've tried with simple killall and with -15 option. Have you

Re: Notifications when process is killed

2011-08-02 Thread Thomas Rachel
Am 02.08.2011 10:26 schrieb Thomas Rachel: Am 02.08.2011 09:30 schrieb AndDM: The function works for SIGHUP and SIGINT, but it doesn't work for SIGTERM. I've tried with simple killall and with -15 option. Have you some ideas? SIGTERM cannot be caught - it kills the process the hard way.

Please code review.

2011-08-02 Thread Karim
Hello, I need a generator to create the cellname in a excell (using pyuno) document to assign value to the correct cell. The following code does this but do you have some optimizations on it, for instance to get the alphabetic chars instead of hard-coding it. Cheers karim Python 2.7.1+

Re: Please code review.

2011-08-02 Thread Paul Kölle
Am 02.08.2011 13:45, schrieb Karim: Hello, I need a generator to create the cellname in a excell (using pyuno) document to assign value to the correct cell. The following code does this but do you have some optimizations on it, for instance to get the alphabetic chars instead of hard-coding

Re: Please code review.

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 12:45 PM, Karim kliat...@gmail.com wrote: ...         for char in cellnames.replace('', ' ').split()[:cols]: for char in cellnames[:cols]: Strings are iterable over their characters. Alternatively, you could use chr and ord, but it's probably cleaner and simpler to have

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Billy Mays
On 08/01/2011 06:06 PM, Steven D'Aprano wrote: Does your definition of fixed mean gives wrong results for n= 4 ? fibo(4) == 3 False Well, I don't know if you're trolling or just dumb: http://en.wikipedia.org/wiki/Fibonacci_number In [2]: for i in range(10): ...: print fibo(i)

Re: Please code review.

2011-08-02 Thread Martin Gracik
On Tue, Aug 2, 2011 at 1:45 PM, Karim kliat...@gmail.com wrote: Hello, I need a generator to create the cellname in a excell (using pyuno) document to assign value to the correct cell. The following code does this but do you have some optimizations on it, for instance to get the

Re: Please code review.

2011-08-02 Thread Peter Otten
Karim wrote: I need a generator to create the cellname in a excell (using pyuno) document to assign value to the correct cell. Isn't there a way to use a (row, column) tuple directly? If so I'd prefer that. Also, there used to be an alternative format to address a spreadsheet cell with

Re: Hardlink sub-directories and files

2011-08-02 Thread Tim Chase
On 08/02/2011 04:32 AM, loial wrote: I am trying to hardlink all files in a directory structure using os.link. Or is there an easier way to hardlink everything in a directory structure?. The requirement is for hard links, not symbolic links While Peter Thomas gave good answers, also be aware

Re: Please code review.

2011-08-02 Thread Karim
Thanks Paul, I never used string module. In fact, cellnames.split('') gives a syntax error w/ empty string. That's why I use the intermediate replace() which accept that. Cheers Karim On 08/02/2011 02:04 PM, Paul Kölle wrote: Am 02.08.2011 13:45, schrieb Karim: Hello, I need a generator

Re: Please code review.

2011-08-02 Thread Karim
Thanks Chris! It seems I am blind I should have seen it... In fact I started with the need (imaginary) to use enumerate() to get some indices but ended in a more simple code. Indeed, your's is simpler. For the double chars extension I will see if I need it in the future. Cheers Karim On

Re: Please code review.

2011-08-02 Thread Karim
On 08/02/2011 02:27 PM, Peter Otten wrote: Karim wrote: I need a generator to create the cellname in a excell (using pyuno) document to assign value to the correct cell. Isn't there a way to use a (row, column) tuple directly? If so I'd prefer that. Also, there used to be an alternative

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Alain Ketterlin
Billy Mays 81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com writes: On 08/01/2011 06:06 PM, Steven D'Aprano wrote: Does your definition of fixed mean gives wrong results for n= 4 ? Well, I don't know if you're trolling or just dumb: Steven is right, and you look dumb. fibo(4)

Re: Please code review.

2011-08-02 Thread Karim
Thanks Martin, This is the generator expression version. I can use both function generator or generator expression version correction. Cheers Karim On 08/02/2011 02:47 PM, Martin Gracik wrote: def get_cellnames2(rows, cols): rows = range(1, rows + 1) cols =

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Billy Mays
On 08/02/2011 08:45 AM, Alain Ketterlin wrote: produce integers. And it will fail with overflow for big values. If it would make you feel better I can use decimal. Also, perhaps I can name my function billy_fibo(n), which is defined as billy_fibo(n) +error(n) = fibo(n), where error(n) can be

Re: Please code review.

2011-08-02 Thread Peter Otten
Karim wrote: values = ( (22.5,21.5,121.5), (5615.3,615.3,-615.3), (-2315.7,315.7,415.7) ) it = _xrange_cellnames(rows=len(value), cols=len(values[0])) table.getCellByName(it.next()).setValue(22.5) table.getCellByName(it.next()).setValue(5615.3)

Re: Please code review.

2011-08-02 Thread Karim
On 08/02/2011 03:59 PM, Peter Otten wrote: Karim wrote: values = ( (22.5,21.5,121.5), (5615.3,615.3,-615.3), (-2315.7,315.7,415.7) ) it = _xrange_cellnames(rows=len(value), cols=len(values[0])) table.getCellByName(it.next()).setValue(22.5) table.getCellByName(it.next()).setValue(5615.3)

'Use-Once' Variables and Linear Objects

2011-08-02 Thread Neal Becker
I thought this was an interesting article http://www.pipeline.com/~hbaker1/Use1Var.html -- http://mail.python.org/mailman/listinfo/python-list

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Steven D'Aprano
Billy Mays wrote: On 08/02/2011 08:45 AM, Alain Ketterlin wrote: produce integers. And it will fail with overflow for big values. If it would make you feel better I can use decimal. Also, perhaps I can name my function billy_fibo(n), which is defined as billy_fibo(n) +error(n) = fibo(n),

Require information on python API for Subversion related work

2011-08-02 Thread Shambhu Rajak
Hi , I need an api that can be used to do following operations on Subversion repository tool: 1. Create branch 2. Check out 3. Check in 4. Merge Regards, Shambhu -- http://mail.python.org/mailman/listinfo/python-list

Re: where the function has problem? n = 900 is OK , but n = 1000 is ERROR

2011-08-02 Thread Billy Mays
On 08/02/2011 10:15 AM, Steven D'Aprano wrote: So you say, but I don't believe it. Given fibo, the function you provided earlier, the error increases with N: fibo(82) - fib(82) # fib returns the accurate Fibonacci number 160.0 fibo(182) - fib(182) 2.92786721937918e+23 Hardly arbitrarily

Re: What Programing Language are the Largest Website Written In?

2011-08-02 Thread ccc31807
On Jul 31, 2:38 pm, gavino gavcom...@gmail.com wrote: facebook is php myspace is microsoft aol was tcl and aolserver c embedding tcl interp priceline is lisp reddit is python was lisp orig amazon was perl livejournal was perl Most of these are tech companies. Tech companies are very

Re: Require information on python API for Subversion related work

2011-08-02 Thread Tim Golden
On 02/08/2011 14:02, Shambhu Rajak wrote: I need an api that can be used to do following operations on Subversion repository tool: 1.Create branch 2.Check out 3.Check in 4.Merge http://pysvn.tigris.org/ (which is, by the way, the first Google hit for Python Subversion bindings) TJG --

Re: range() vs xrange() Python2|3 issues for performance

2011-08-02 Thread Steven D'Aprano
harrismh777 wrote: The following is intended as a helpful small extension to the xrange() range() discussion brought up this past weekend by Billy Mays... With Python2 you basically have two ways to get a range of numbers: range() , which returns a list, and xrange() , which

Re: Notifications when process is killed

2011-08-02 Thread Hansmeet Singh
you shouldn't have anything to worry about SIGTERM if you send out a SIGCHLD On Tue, Aug 2, 2011 at 3:44 AM, Chris Angelico ros...@gmail.com wrote: On Tue, Aug 2, 2011 at 11:36 AM, Andrea Di Mario anddima...@gmail.com wrote: If i use SIGCHLD, i will have difficult when parent receive a

Re: [ANN] IPython 0.11 is officially out

2011-08-02 Thread Robert Kern
On 8/1/11 8:54 AM, Thorsten Kampe wrote: The documentation[1] says If you are upgrading to version 0.11 of IPython, you will need to migrate your old ipythonrc or ipy_user_conf.py configuration files to the new system. Read on for information on how to do this. Unfortunately there is no more

python import error, what's wrong?

2011-08-02 Thread smith jack
I am using pydev plugin in eclipse, all things works just as well but now i have confronted with a confusing problem, that is i can import a module write by myself successfully, but when i try to run this program, error just shows up, what's wrong? the directory structure is as follows: src

Re: range() vs xrange() Python2|3 issues for performance

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 3:45 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: (But don't make the mistake of doing what I did, which was to attempt to produce range(29000) in Python 2. After multiple *hours* of swapping, I was finally able to kill the Python process and get

Re: PyWart: os.path needs immediate attention!

2011-08-02 Thread rantingrick
On Aug 1, 3:19 am, Teemu Likonen tliko...@iki.fi wrote: * 2011-07-30T10:57:29+10:00 * Steven D'Aprano wrote: Teemu Likonen wrote: Pathnames and the separator for pathname components should be abstracted away, to a pathname object. Been there, done that, floundered on the inability of

Re: python import error, what's wrong?

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 4:52 PM, smith jack thinke...@gmail.com wrote: from org.test.A import A This is going to look for org/test/A.py but not for org.test/A.py - are you able to rename your directories to not have dots? ChrisA -- http://mail.python.org/mailman/listinfo/python-list

How to define repeated string when using the re module?

2011-08-02 Thread smith jack
if it's for a single character, this should be very easy, such as c{m,n} the occurrence of c is between m and n, if i want to define the occurrence of (.*?)/div how should make it done? ((.*?)/div){1,3} seems not work, any method to define repeat string using python regex? --

Re: PyWart: os.path needs immediate attention!

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 5:03 PM, rantingrick rantingr...@gmail.com wrote: This thread was intended to expose another PyWart and get the community juices flowing. os.path is broken and cannot be repaired because os.path was an improper API to begin with. The only way to solve this problem is to

Early binding as an option

2011-08-02 Thread Chris Angelico
As I understand it, Python exclusively late-binds names; when you define a function, nothing is ever pre-bound. This allows a huge amount of flexibility (letting you reach into someone else's function and change its behaviour), but it's flexibility that most programs use seldom if at all. First

Re: Complex sort on big files

2011-08-02 Thread Dan Stromberg
On Tue, Aug 2, 2011 at 3:25 AM, Alistair Miles aliman...@googlemail.comwrote: Hi Dan, Thanks for the reply. On Mon, Aug 1, 2011 at 5:45 PM, Dan Stromberg drsali...@gmail.com wrote: Python 2.x, or Python 3.x? Currently Python 2.x. So it sounds like you may want to move this code to

Re: How to define repeated string when using the re module?

2011-08-02 Thread MRAB
On 02/08/2011 17:20, smith jack wrote: if it's for a single character, this should be very easy, such as c{m,n} the occurrence of c is between m and n, if i want to define the occurrence of (.*?)/div how should make it done? ((.*?)/div){1,3} seems not work, any method to define repeat

Re: Early binding as an option

2011-08-02 Thread Thomas Jollans
On 02/08/11 18:55, Chris Angelico wrote: As I understand it, Python exclusively late-binds names; when you define a function, nothing is ever pre-bound. This allows a huge amount of flexibility (letting you reach into someone else's function and change its behaviour), but it's flexibility that

Re: How to define repeated string when using the re module?

2011-08-02 Thread Chris Rebert
On Tue, Aug 2, 2011 at 9:20 AM, smith jack thinke...@gmail.com wrote: if it's for a single character, this should be very easy, such as c{m,n}   the occurrence of c is between m and n, if i want to define the occurrence of (.*?)/div  how should make it done?  ((.*?)/div){1,3}  seems not work,

Re: 'Use-Once' Variables and Linear Objects

2011-08-02 Thread Chris Rebert
On Tue, Aug 2, 2011 at 7:19 AM, Neal Becker ndbeck...@gmail.com wrote: I thought this was an interesting article http://www.pipeline.com/~hbaker1/Use1Var.html See also: http://en.wikipedia.org/wiki/Uniqueness_type Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Early binding as an option

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 6:18 PM, Thomas Jollans t...@jollybox.de wrote: I suppose it would be possible to introduce a kind of constant globals namespace that a JIT compiler could then use to optimise, but how much would this help? Surely it must help a lot; looking up names is string

how to sort a hash list without generating a new object?

2011-08-02 Thread smith jack
the source code is as follows x={} x['a'] = 11 x['c'] = 19 x['b'] = 13 print x tmp = sorted(x.items(), key = lambda x:x[0])# increase order by default, if i want to have a descending order, what should i do? # after sorted is called, a list will be generated, and the hash list x is not

Re: Early binding as an option

2011-08-02 Thread Chris Rebert
On Tue, Aug 2, 2011 at 9:55 AM, Chris Angelico ros...@gmail.com wrote: As I understand it, Python exclusively late-binds names; when you define a function, nothing is ever pre-bound. This allows a huge amount of flexibility (letting you reach into someone else's function and change its

Re: Early binding as an option

2011-08-02 Thread Thomas Jollans
On 02/08/11 19:42, Chris Angelico wrote: On Tue, Aug 2, 2011 at 6:18 PM, Thomas Jollans t...@jollybox.de wrote: I suppose it would be possible to introduce a kind of constant globals namespace that a JIT compiler could then use to optimise, but how much would this help? Surely it must help

Re: how to sort a hash list without generating a new object?

2011-08-02 Thread Thomas Jollans
On 02/08/11 20:02, smith jack wrote: the source code is as follows x={} x['a'] = 11 x['c'] = 19 x['b'] = 13 print x tmp = sorted(x.items(), key = lambda x:x[0])# increase order by default, if i want to have a descending order, what should i do? # after sorted is called, a list

Re: Spam

2011-08-02 Thread David
If you click the more options link, there is an option in the sub- menu to report a post as spam. You can also forward it along with the offending e-mail address to s...@uce.gov -- http://mail.python.org/mailman/listinfo/python-list

Re: Early binding as an option

2011-08-02 Thread Alain Ketterlin
Chris Angelico ros...@gmail.com writes: As I understand it, Python exclusively late-binds names; when you define a function, nothing is ever pre-bound. This allows a huge amount of flexibility (letting you reach into someone else's function and change its behaviour), but it's flexibility that

ANN: eGenix mx Base Distribution 3.2.1 (mxDateTime, mxTextTools, etc.)

2011-08-02 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mx Base Distribution Version 3.2.1 for Python 2.4 - 2.7 Open Source Python extensions providing important and useful services

Re: Early binding as an option

2011-08-02 Thread Teemu Likonen
* 2011-08-02T11:03:24-07:00 * Chris Rebert wrote: Smart enough JITers can infer that late binding is not being exploited for certain variables and thus optimize them accordingly. Look how fast some of the JavaScript VMs are, despite JavaScript also being highly dynamic. Or Common Lisp. It

what is the advantage of Django when comparing with LAMP and J2EE platform?

2011-08-02 Thread smith jack
There are so many choice to do the same thing, so is there any special advantage Django brings to user? -- http://mail.python.org/mailman/listinfo/python-list

Re: what is the advantage of Django when comparing with LAMP and J2EE platform?

2011-08-02 Thread Redcat
On Wed, 03 Aug 2011 03:28:14 +0800, smith jack wrote: There are so many choice to do the same thing, so is there any special advantage Django brings to user? The ability to code in Python instead of Java is the biggest one to me. -- http://mail.python.org/mailman/listinfo/python-list

Re: Early binding as an option

2011-08-02 Thread Terry Reedy
On 8/2/2011 12:55 PM, Chris Angelico wrote: As I understand it, Python exclusively late-binds names; when you define a function, nothing is ever pre-bound. By 'pre-bound' you presumably mean bound at definition time rather than call time. Default arg objects *are* pre-computed and pre-bound

m2crypto https, xmlrpc, keep_alive

2011-08-02 Thread Gelonida N
Hi, Just started playing with m2cryptos xmlrpc The code I'm is: import xmlrpclib from M2Crypto.m2xmlrpclib import Server, SSL_Transport from M2Crypto.SSL.Context import Context ctx = Context() # modify context svr = Server(rpc_url, SSL_Transport(ctx), encoding='utf-8') svr.mymethod1(1)

Re: what is the advantage of Django when comparing with LAMP and J2EE platform?

2011-08-02 Thread Tim Johnson
* smith jack thinke...@gmail.com [110802 11:37]: There are so many choice to do the same thing, so is there any special advantage Django brings to user? Django is a python framework, J2EE is a java platform (my apologies if I use 'framework' incorrectly). Our customers want PHP,perl or python,

m2crypto https, xmlrpc, and cookies

2011-08-02 Thread Gelonida N
Hi, Just started playing with m2cryptos xmlrpc The code I'm using is: import xmlrpclib from M2Crypto.m2xmlrpclib import Server, SSL_Transport from M2Crypto.SSL.Context import Context ctx = Context() # modify context svr = Server(rpc_url, SSL_Transport(ctx), encoding='utf-8') svr.mymethod1(1)

m2crypto https, xmlrpc and ignore server name mismatch

2011-08-02 Thread Gelonida N
Hi, Just started playing with m2crypto's xmlrpc The code I'm using is: import xmlrpclib from M2Crypto.m2xmlrpclib import Server, SSL_Transport from M2Crypto.SSL.Context import Context ctx = Context() # modify context svr = Server(rpc_url, SSL_Transport(ctx), encoding='utf-8') svr.mymethod1(1)

Re: Early binding as an option

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 9:23 PM, Terry Reedy tjre...@udel.edu wrote: On 8/2/2011 12:55 PM, Chris Angelico wrote: As I understand it, Python exclusively late-binds names; when you define a function, nothing is ever pre-bound. By 'pre-bound' you presumably mean bound at definition time rather

Re: Early binding as an option

2011-08-02 Thread Gelonida N
On 08/03/2011 12:08 AM, Chris Angelico wrote: With the local-variable-snapshot technique (len = len), can anything be optimized, since the parser can guarantee that nothing ever reassigns to it? If not, perhaps this would be a place where something might be implemented: @const(len,max) #

Re: Early binding as an option

2011-08-02 Thread Chris Angelico
On Tue, Aug 2, 2011 at 11:21 PM, Gelonida N gelon...@gmail.com wrote: On the other hand: It might be interesting, that the early binding would just take place when python is invoked with -O This could be an excellent safety catch, but on the other hand, it might destroy all value of the

Re: Early binding as an option

2011-08-02 Thread Gelonida N
On 08/03/2011 12:26 AM, Chris Angelico wrote: On Tue, Aug 2, 2011 at 11:21 PM, Gelonida N gelon...@gmail.com wrote: On the other hand: It might be interesting, that the early binding would just take place when python is invoked with -O This could be an excellent safety catch, but on the

Re: Early binding as an option

2011-08-02 Thread Gelonida N
On 08/03/2011 12:26 AM, Chris Angelico wrote: On Tue, Aug 2, 2011 at 11:21 PM, Gelonida N gelon...@gmail.com wrote: On the other hand: It might be interesting, that the early binding would just take place when python is invoked with -O This could be an excellent safety catch, but on the

Re: What Programing Language are the Largest Website Written In?

2011-08-02 Thread Xah Lee
On Jul 31, 11:38 am, gavino gavcom...@gmail.com wrote: On Jul 13, 1:04 pm, ccc31807 carte...@gmail.com wrote: On Jul 12, 7:54 am, Xah Lee xah...@gmail.com wrote: maybe this will be of interest. 〈What Programing Language Are the Largest Website Written

pygtk

2011-08-02 Thread 守株待兔
please see my attachment ,which widget the region1,region2 is? how to make it?? re2 Description: Binary data -- http://mail.python.org/mailman/listinfo/python-list

Re: Spam

2011-08-02 Thread Steven D'Aprano
David wrote: If you click the more options link, there is an option in the sub- menu to report a post as spam. You can also forward it along with the offending e-mail address to s...@uce.gov What more options link? Are you referring to a specific program? If so, which? Remember, people are

Re: how to sort a hash list without generating a new object?

2011-08-02 Thread Chris Rebert
On Tue, Aug 2, 2011 at 11:02 AM, smith jack thinke...@gmail.com wrote: the source code is as follows x={} x['a'] = 11 x['c'] = 19 x['b'] = 13 print x tmp = sorted(x.items(), key = lambda x:x[0])    #  increase order by default, if i want to have a descending order, what should i do?

Syntactic sugar for assignment statements: one value to multiple targets?

2011-08-02 Thread gc
Hi everyone! Longtime lurker, hardly an expert, but I've been using Python for various projects since 2007 and love it. I'm looking for either (A) suggestions on how to do a very common operation elegantly and Pythonically, or (B) input on whether my proposal is PEP-able, assuming there's no

Re: Hardlink sub-directories and files

2011-08-02 Thread Dan Stromberg
On Tue, Aug 2, 2011 at 3:13 AM, Thomas Jollans t...@jollybox.de wrote: On 02/08/11 11:32, loial wrote: I am trying to hardlink all files in a directory structure using os.link. However I do not think it is possible to hard link directories ? That is pretty true. I've heard of

Re: Syntactic sugar for assignment statements: one value to multiple targets?

2011-08-02 Thread Chris Angelico
On Wed, Aug 3, 2011 at 2:45 AM, gc gc1...@gmail.com wrote: Anyway, I frequently need to initialize several variables to the same value, as I'm sure many do. Sometimes the value is a constant, often zero; sometimes it's more particular, such as defaultdict(list). I use dict() below. If it's an

with statement and context managers

2011-08-02 Thread Steven D'Aprano
I'm not greatly experienced with context managers and the with statement, so I would like to check my logic. Somebody (doesn't matter who, or where) stated that they frequently use this idiom: spam = MyContextManager(*args) for ham in my_iter: with spam: # do stuff but to me that

Re: how to sort a hash list without generating a new object?

2011-08-02 Thread Dan Stromberg
On Tue, Aug 2, 2011 at 5:53 PM, Chris Rebert c...@rebertia.com wrote: On Tue, Aug 2, 2011 at 11:02 AM, smith jack thinke...@gmail.com wrote: the source code is as follows x={} x['a'] = 11 x['c'] = 19 x['b'] = 13 print x If you /really/ need a sorted mapping datatype, google for

Re: with statement and context managers

2011-08-02 Thread Jack Diederich
On Tue, Aug 2, 2011 at 10:15 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'm not greatly experienced with context managers and the with statement, so I would like to check my logic. Somebody (doesn't matter who, or where) stated that they frequently use this idiom: spam

code generation

2011-08-02 Thread Rita
Hello, This isn't much of a python question but a general algorithm question. I plan to input the following string and I would like to generate something like this. input: a-(b,c)-d output: parent a, child b c parent b c child d Are there any libraries or tools which will help me evaluate

Re: code generation

2011-08-02 Thread Dan Stromberg
Perhaps: http://code.google.com/p/python-graph/ On Tue, Aug 2, 2011 at 8:03 PM, Rita rmorgan...@gmail.com wrote: Hello, This isn't much of a python question but a general algorithm question. I plan to input the following string and I would like to generate something like this. input:

Re: with statement and context managers

2011-08-02 Thread Nobody
On Wed, 03 Aug 2011 12:15:44 +1000, Steven D'Aprano wrote: I'm not greatly experienced with context managers and the with statement, so I would like to check my logic. Somebody (doesn't matter who, or where) stated that they frequently use this idiom: spam = MyContextManager(*args) for

[issue12679] ThreadError is not in threading.__all__

2011-08-02 Thread Matt Joiner
New submission from Matt Joiner anacro...@gmail.com: from threading import * ThreadError Traceback (most recent call last): File stdin, line 1, in module NameError: name 'ThreadError' is not defined -- components: Library (Lib) files: export-thread-error.patch keywords: patch

[issue10639] reindent.py should not convert newlines

2011-08-02 Thread Scott Dial
Scott Dial sc...@scottdial.com added the comment: I haven't seen anyone use a side-effect-less statement (a string) as a comment before, but I doubt that is an approved style for the CPython codebase. Please change the string preceeding the spec_line definition into a proper comment.

[issue12680] cPickle.loads is not thread safe due to non-thread-safe imports

2011-08-02 Thread Sagiv Malihi
New submission from Sagiv Malihi sagivmal...@gmail.com: When trying to cPickle.loads() from several threads at once, there is a race condition when threads try to import modules. An example will explain it best: suppose I have module foo.py which takes some time to load: import time class

[issue12680] cPickle.loads is not thread safe due to non-thread-safe imports

2011-08-02 Thread Sagiv Malihi
Sagiv Malihi sagivmal...@gmail.com added the comment: OK, digging deeper reveals that there are actually two bugs here, one is conceptual in the python importing mechanism, and the other is technical in cPickle. The first bug: PyImport_ExecCodeModuleEx adds the module to sys.modules *before*

  1   2   >