parameterized-testcase 0.2

2011-08-16 Thread Austin Bingham
I'm pleased to announce the release of parameterized-testcase 0.2. You can get it here: http://code.google.com/p/parameterized-testcase/downloads/list This is primarily a documentation release, with only minor changes to the API. What is parameterized-testcase?

Re: testing if a list contains a sublist

2011-08-16 Thread ChasBrown
On Aug 15, 4:26 pm, Johannes dajo.m...@web.de wrote: hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] - l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is not contained

Re: testing if a list contains a sublist

2011-08-16 Thread ChasBrown
On Aug 15, 4:26 pm, Johannes dajo.m...@web.de wrote: hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] - l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is not contained

Re: testing if a list contains a sublist

2011-08-16 Thread ChasBrown
On Aug 15, 4:26 pm, Johannes dajo.m...@web.de wrote: hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] - l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is not contained

Re: testing if a list contains a sublist

2011-08-16 Thread Laszlo Nagy
hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] - l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is not contained in l2 l1 = [1,2,3], l2 = [1,3,5,7] - l1 is not

Re: allow line break at operators

2011-08-16 Thread alex23
On Aug 16, 2:37 pm, rantingrick rantingr...@gmail.com wrote: The reading proceeds naturally from right to left. Well, naturally if you're coding in Hebrew or Japanese perhaps :) -- http://mail.python.org/mailman/listinfo/python-list

regular expression

2011-08-16 Thread Danny Wong (dannwong)
Hi All, If I get multiline standard output from a command. How can I retrieve this part of the string (1006) Example: #Committing... #Workspace: (1003) My OS_8.12.0 Work - (1004) OS_8.12.0 # Component: (1005) he-Group - (1004) OS_8.12.0 #Outgoing: # Change sets: #(1006)

subprocess.Popen question

2011-08-16 Thread Danny Wong (dannwong)
Hi All, I'm executing a command which I want to capture the standard/stderr output into a file (which I have with the code below), but I also want the standard output to go into a variable so I can process the information for the next command. Any ideas? Thanks. CMD_OUTPUT =

Re: subprocess.Popen question

2011-08-16 Thread Chris Rebert
On Tue, Aug 16, 2011 at 12:03 AM, Danny Wong (dannwong) dannw...@cisco.com wrote: Hi All,        I'm executing a command which I want to capture the standard/stderr output into a file (which I have with the code below), but I also want the standard output to go into a variable so I can

Re: testing if a list contains a sublist

2011-08-16 Thread alex23
Laszlo Nagy gand...@shopzeus.com wrote: Fastest, error-free and simplest solution is to use sets:   l1 = [1,2]   l2 = [1,2,3,4,5]   set(l1)-set(l2) set([])   set(l2)-set(l1) set([3, 4, 5])   Error-free? Not given the stated requirements: l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is not

Re: testing if a list contains a sublist

2011-08-16 Thread alex23
On Aug 16, 4:51 pm, Laszlo Nagy gand...@shopzeus.com wrote: hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] -  l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] -  l1 is

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread alex23
rantingrick rantingr...@gmail.com wrote: These specific phrases i have pointed out (used to and supposed to) are a result of a mind choosing the easy way out instead of putting in the wee bit more effort required to express one's self in an articulate manner. Also these two phrases are quite

Re: regular expression

2011-08-16 Thread Chris Rebert
On Tue, Aug 16, 2011 at 12:00 AM, Danny Wong (dannwong) dannw...@cisco.com wrote: Hi All,        If I get multiline standard output from a command. How can I retrieve this part of the string (1006) Example: #Committing... #Workspace: (1003) My OS_8.12.0 Work - (1004) OS_8.12.0 #  

Re: testing if a list contains a sublist

2011-08-16 Thread ChasBrown
On Aug 15, 11:51 pm, Laszlo Nagy gand...@shopzeus.com wrote: hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] -  l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] -  l1 is

Re: testing if a list contains a sublist

2011-08-16 Thread Peter Otten
Johannes wrote: what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] - l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is not contained in l2 l1 = [1,2,3], l2 = [1,3,5,7] - l1 is

Linux : create a user if not exists

2011-08-16 Thread smain kahlouch
Hi all, I'm learning the python language and i'm trying to create a user if it is not found in the system. I figured it out by doing the following thing : def finduser(user): ... for line in open('/etc/passwd'): ... if line.startswith(user): ... print user,

Re: Windows service in production?

2011-08-16 Thread Tim Golden
On 16/08/2011 05:32, snorble wrote: Anyone know of a Python application running as a Windows service in production? I'm planning a network monitoring application that runs as a service and reports back to the central server. Sort of a heartbeat type agent to assist with this server is down, go

Re: testing if a list contains a sublist

2011-08-16 Thread Laszlo Nagy
Error free? Consider this stated requirement: l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is not contained in l2 If you look it the strict way, containment relation for lists is meant this way: l1 = [] l2 = [1,l1,2] # l2 CONTAINS l1 But you are right, I was wrong. So let's clarify what the OP

Re: Linux : create a user if not exists

2011-08-16 Thread Chris Rebert
On Tue, Aug 16, 2011 at 12:45 AM, smain kahlouch smain...@gmail.com wrote: Hi all, I'm learning the python language and i'm trying to create a user if it is not found in the system. I figured it out by doing the following thing : def finduser(user): ... for line in open('/etc/passwd'):

Re: Windows service in production?

2011-08-16 Thread alex23
snorble snor...@hotmail.com wrote: If using Visual Studio and C# is the more reliable way, then I'll go that route. I love Python, but everything I read about Python services seems to have workarounds ahoy for various situations (or maybe that's just Windows services in general?). What

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Chris Angelico
On Tue, Aug 16, 2011 at 2:32 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 16 Aug 2011 08:15 am Chris Angelico wrote: It's actually masking, not reassigning. That may make it easier or harder to resolve the issue. The usual term is shadowing builtins, and it's a

Re: testing if a list contains a sublist

2011-08-16 Thread Steven D'Aprano
On Tue, 16 Aug 2011 12:12 pm Steven D'Aprano wrote: On Tue, 16 Aug 2011 09:26 am Johannes wrote: hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? This is not the most efficient algorithm, but for short lists it should be

Re: testing if a list contains a sublist

2011-08-16 Thread Johannes
Am 16.08.2011 09:44, schrieb Peter Otten: Johannes wrote: what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] - l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is not contained in

Re: testing if a list contains a sublist

2011-08-16 Thread Steven D'Aprano
On Tue, 16 Aug 2011 04:14 pm ChasBrown wrote: On Aug 15, 4:26 pm, Johannes dajo.m...@web.de wrote: hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] - l1 is contained in l2 l1 =

Anyone here can do a comparation between Djang and RoR

2011-08-16 Thread smith jack
what is the advantage of Django over RoR:) -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess.Popen question

2011-08-16 Thread Thomas Rachel
Am 16.08.2011 09:03 schrieb Danny Wong (dannwong): Hi All, I'm executing a command which I want to capture the standard/stderr output into a file (which I have with the code below), but I also want the standard output to go into a variable so I can process the information for the next

Re: testing if a list contains a sublist

2011-08-16 Thread Peter Otten
Johannes wrote: Am 16.08.2011 09:44, schrieb Peter Otten: Johannes wrote: what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] - l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is

Re: String concatenation - which is the fastest way ?

2011-08-16 Thread przemolicc
On Fri, Aug 12, 2011 at 11:25:06AM +0200, Stefan Behnel wrote: przemol...@poczta.fm, 11.08.2011 16:39: On Thu, Aug 11, 2011 at 02:48:43PM +0100, Chris Angelico wrote: On Thu, Aug 11, 2011 at 2:46 PM,przemol...@poczta.fm wrote: This is the way I am going to use. But what is the best data type

Messed up Mac installation

2011-08-16 Thread Christopher Brewster
Are there instructions somewhere online as to how to sort out a messed up installation of Python on a Mac? I have a 2 month old Macbook running Snow Leopard, I installed Python 2.7.1 some time ago. Now when I run 'python' this is what it shows. But easy_install and pip are installing modules to

Re: Messed up Mac installation

2011-08-16 Thread aspineux
On Aug 16, 12:03 pm, Christopher Brewster cbrews...@gmail.com wrote: Are there instructions somewhere online as to how to sort out a messed up installation of Python on a Mac? I have a 2 month old Macbook running Snow Leopard, I installed Python 2.7.1 some time ago. Now when I run 'python'

Re: Anyone here can do a comparation between Djang and RoR

2011-08-16 Thread Alex Po
Many things already done in RoR if comparing it with Django. -- http://mail.python.org/mailman/listinfo/python-list

Re: Anyone here can do a comparation between Djang and RoR

2011-08-16 Thread Tim Chase
On 08/16/2011 04:15 AM, smith jack wrote: what is the advantage of Django over RoR:) *THE* advantage is that you get to program in Python instead of Ruby. :) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Application monitoring

2011-08-16 Thread Abhishek Bajpai
I need to monitor applications like apache, mysql etc there live status, errors etc on my LAN is there any tool or lib for this any help will be appreciated thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: testing if a list contains a sublist

2011-08-16 Thread Nobody
On Tue, 16 Aug 2011 01:26:54 +0200, Johannes wrote: what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? Best is subjective. AFAIK, the theoretically-optimal algorithm is Boyer-Moore. But that would require a fair amount of code, and

Re: Application monitoring

2011-08-16 Thread Nitin Pawar
We use nagios for such monitoring On Tue, Aug 16, 2011 at 4:47 PM, Abhishek Bajpai abhib...@gmail.com wrote: I need to monitor applications like apache, mysql etc there live status, errors etc on my LAN is there any tool or lib for this any help will be appreciated thanks in advance --

Re: subprocess.Popen question

2011-08-16 Thread Nobody
On Tue, 16 Aug 2011 02:03:50 -0500, Danny Wong (dannwong) wrote: I'm executing a command which I want to capture the standard/stderr output into a file (which I have with the code below), but I also want the standard output to go into a variable so I can process the information for the

Re: Application monitoring

2011-08-16 Thread smain kahlouch
or shinken ( written in python :) ); Regards, Sam 2011/8/16 Nitin Pawar nitinpawar...@gmail.com We use nagios for such monitoring On Tue, Aug 16, 2011 at 4:47 PM, Abhishek Bajpai abhib...@gmail.comwrote: I need to monitor applications like apache, mysql etc there live status, errors etc

Idea for pure-python templates using AST.

2011-08-16 Thread Paul Wray
Hello all Ive had what I think is a great idea for pure-python templates (I can almost hear the groans, bear with me...) For the impatient, proof of concept is at http://pastie.org/2379978 demonstrating simple substitution, balanced tags using context manager, subtemplates, and template

Re: regular expression

2011-08-16 Thread Roy Smith
In article mailman.41.1313479583.27778.python-l...@python.org, Chris Rebert c...@rebertia.com wrote: pat = re.compile(^ *(\\([^)]+\\)), re.MULTILINE) First rule of regexes in Python is to always use raw strings, to eliminate the doubled backslashes: pat = re.compile(r^ *(\([^)]+\)),

How to install easy_install on windows ?

2011-08-16 Thread smith jack
it needs read registry, but the python i used is extracted from .zip, so there is no record in the registry, what should i do in order to install easy_install for my python environment? -- http://mail.python.org/mailman/listinfo/python-list

Re: testing if a list contains a sublist

2011-08-16 Thread Alain Ketterlin
Roy Smith r...@panix.com writes: what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? [...] import re def sublist(l1, l2): s1 = ''.join(map(str, l1)) s2 = ''.join(map(str, l2)) return re.search(s1, s2) This is complete

Re: Idea for pure-python templates using AST.

2011-08-16 Thread aspineux
On Aug 16, 1:33 pm, Paul Wray paul.w...@det.nsw.edu.au wrote: Hello all Ive had what I think is a great idea for pure-python templates (I can almost hear the groans, bear with me...) For the impatient, proof of concept is athttp://pastie.org/2379978 demonstrating simple substitution,

Re: How to Check Write Access of a Folder on Windows

2011-08-16 Thread Ayaskant Swain
Hi Tim, Thanks for your reply. It seems this issue is related to python bug - http://bugs.python.org/issue2528 But the patch code looks complex to me. I want to make changes only in my python script which will read an user given directory path check it's write access. What is the use of

Re: How to install easy_install on windows ?

2011-08-16 Thread aspineux
On Aug 16, 2:17 pm, smith jack thinke...@gmail.com wrote: it needs read registry, but the python i used is extracted from .zip, so there is no record in the registry, Noone need it, Python dont use any registry key what should i do in order to install easy_install for my python environment?

Re: testing if a list contains a sublist

2011-08-16 Thread Roy Smith
In article 8739h18rzj@dpt-info.u-strasbg.fr, Alain Ketterlin al...@dpt-info.u-strasbg.fr wrote: Roy Smith r...@panix.com writes: what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? [...] import re def sublist(l1, l2):

Re: Windows service in production?

2011-08-16 Thread aspineux
On Aug 16, 6:32 am, snorble snor...@hotmail.com wrote: Anyone know of a Python application running as a Windows service in production? I'm planning a network monitoring application that runs as a service and reports back to the central server. Sort of a heartbeat type agent to assist with this

Re: Application monitoring

2011-08-16 Thread Miki Tebeka
http://www.nagios.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use python environment created using virtualenv?

2011-08-16 Thread Fabio Zadrozny
On Tue, Aug 16, 2011 at 2:15 AM, smith jack thinke...@gmail.com wrote: I have created a python environment using virtualenv, but when i want to import such environment to PyDev, error just appears, it tells there should be a Libs dir, but there is no Libs DIr in the virtual envronment created

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Philip Semanchuk
On Aug 16, 2011, at 1:15 AM, Steven D'Aprano wrote: On Tue, 16 Aug 2011 01:23 pm Philip Semanchuk wrote: On Aug 15, 2011, at 9:32 PM, Steven D'Aprano wrote: On Tue, 16 Aug 2011 08:15 am Chris Angelico wrote: If you want a future directive that deals with it, I'd do it the other way

Re: Linux : create a user if not exists

2011-08-16 Thread Christian Heimes
Am 16.08.2011 10:04, schrieb Chris Rebert: You can replace the /etc/passwd parsing with a call to pwd.getpwnam(): http://docs.python.org/library/pwd.html#pwd.getpwnam You should replace it. /etc/passwd is not the only source for users. /etc/nsswitch.conf may list more user and group sources

Failed to create virtual environment when using --relocatable option, what's wrong?

2011-08-16 Thread smith jack
all things works well without --relocatable option, the error info when using --relocatable option is as follows : F:\PythonEnv\djangoEnvvirtualenv f:\PythonEnv\djangoEnv2 --relocatable PYTHONHOME is set. You *must* activate the virtualenv before using it The environment doesn't have a file

Re: testing if a list contains a sublist

2011-08-16 Thread John Posner
On 2:59 PM, Nobody wrote: On Tue, 16 Aug 2011 01:26:54 +0200, Johannes wrote: what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? Best is subjective. AFAIK, the theoretically-optimal algorithm is Boyer-Moore. But that would require a

Re: testing if a list contains a sublist

2011-08-16 Thread John Posner
On 2:59 PM, Nobody wrote: On Tue, 16 Aug 2011 01:26:54 +0200, Johannes wrote: what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? Best is subjective. AFAIK, the theoretically-optimal algorithm is Boyer-Moore. But that would require a

Re: Windows service in production?

2011-08-16 Thread snorble
On Aug 16, 2:52 am, Tim Golden m...@timgolden.me.uk wrote: On 16/08/2011 05:32, snorble wrote: Anyone know of a Python application running as a Windows service in production? I'm planning a network monitoring application that runs as a service and reports back to the central server. Sort

why i cannot import djang?

2011-08-16 Thread smith jack
this package is already in the site-packages directory, but i cannot import it , it's really confusing ... -- http://mail.python.org/mailman/listinfo/python-list

Re: testing if a list contains a sublist

2011-08-16 Thread nn
On Aug 16, 8:23 am, Alain Ketterlin al...@dpt-info.u-strasbg.fr wrote: Roy Smith r...@panix.com writes: what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? [...] import re def sublist(l1, l2):     s1 = ''.join(map(str, l1))  

Re: Linux : create a user if not exists

2011-08-16 Thread smain kahlouch
Ok than you. You're right but it doesn't help me : I replaced it : def finduser(user): ... if pwd.getpwnam(user): ... print user, user exists ... return True ... return False ... finduser('realuser') realuser user exists True finduser('blabla') Traceback (most

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread rantingrick
On Aug 16, 2:07 am, alex23 wuwe...@gmail.com wrote: All the way down indeed. Can you pick who said these? Obviously your grep skills are superb however you need to brush up on those reading and comprehension skills a bit. There are noobs watching and we to provide code that can be used to

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Chris Angelico
On Tue, Aug 16, 2011 at 3:13 PM, Philip Semanchuk phi...@semanchuk.com wrote: I am an example. I know enough to turn the theoretical warning on, and I would if I could. I have never shadowed a builtin deliberately. I've done it accidentally plenty of times. There are 84 builtins in my version

Re: testing if a list contains a sublist

2011-08-16 Thread Laszlo Nagy
That can be easily fixed: def sublist(lst1, lst2): s1 = ','.join(map(str, lst1)) s2 = ','.join(map(str, lst2)) return False if s2.find(s1)==-1 else True I don't know about best, but it works for the examples given. For numbers, it will always work. But what about

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Ethan Furman
Philip Semanchuk wrote: On Aug 16, 2011, at 1:15 AM, Steven D'Aprano wrote: Protecting n00bs from their own errors is an admirable aim, but have you considered that warnings for something which may be harmless could do more harm than good? Isn't the whole point of a warning to highlight

Re: testing if a list contains a sublist

2011-08-16 Thread Johannes
Am 16.08.2011 10:00, schrieb Laszlo Nagy: Error free? Consider this stated requirement: l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is not contained in l2 If you look it the strict way, containment relation for lists is meant this way: l1 = [] l2 = [1,l1,2] # l2 CONTAINS l1 But you are

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Philip Semanchuk
On Aug 16, 2011, at 11:12 AM, Chris Angelico wrote: On Tue, Aug 16, 2011 at 3:13 PM, Philip Semanchuk phi...@semanchuk.com wrote: One need look no further than the standard library to see a strong counterexample. grep through the Python source for file =. I see dozens of examples of

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Philip Semanchuk
On Aug 16, 2011, at 11:41 AM, Ethan Furman wrote: Philip Semanchuk wrote: On Aug 16, 2011, at 1:15 AM, Steven D'Aprano wrote: Protecting n00bs from their own errors is an admirable aim, but have you considered that warnings for something which may be harmless could do more harm than good?

Re: testing if a list contains a sublist

2011-08-16 Thread Alain Ketterlin
Laszlo Nagy gand...@shopzeus.com writes: def sublist(lst1, lst2): s1 = ','.join(map(str, lst1)) s2 = ','.join(map(str, lst2)) return False if s2.find(s1)==-1 else True I don't know about best, but it works for the examples given. For numbers, it will always work. I'm not

Re: Idea for pure-python templates using AST.

2011-08-16 Thread Terry Reedy
On 8/16/2011 7:33 AM, Paul Wray wrote: Hello all Ive had what I think is a great idea for pure-python templates (I can almost hear the groans, bear with me...) For the impatient, proof of concept is at http://pastie.org/2379978 demonstrating simple substitution, balanced tags using context

Re: Linux : create a user if not exists

2011-08-16 Thread Terry Reedy
On 8/16/2011 10:57 AM, smain kahlouch wrote: Ok than you. You're right but it doesn't help me : I replaced it : def finduser(user): ... if pwd.getpwnam(user): ... print user, user exists ... return True ... return False ... finduser('realuser') realuser user

Re: Linux : create a user if not exists

2011-08-16 Thread Alexander Kapps
On 16.08.2011 16:57, smain kahlouch wrote: Ok than you. You're right but it doesn't help me : I replaced it : def finduser(user): ... if pwd.getpwnam(user): ... print user, user exists ... return True ... return False ... finduser('realuser') realuser user

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Ethan Furman
Philip Semanchuk wrote: On Aug 16, 2011, at 11:41 AM, Ethan Furman wrote: Philip Semanchuk wrote: If we are to eschew warnings in cases where they might be highlighting something harmless, then we would have no warnings at all. Sounds good to me. ;) Keep such things in the IDE's, and then

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Tim Chase
On 08/16/2011 10:31 AM, Philip Semanchuk wrote: On Aug 16, 2011, at 11:12 AM, Chris Angelico wrote: There are several types of shadowing: 1) Deliberate shadowing because you want to change the behavior of the name. Extremely rare. 2) Shadowing simply by using the name of an unusual builtin

Re: Idea for pure-python templates using AST.

2011-08-16 Thread anand jeyahar
Hi all, I did it. Finally managed to port mysqltuner.pl to python. Was a real pain in the butt doing it from bottom up manually, without ever really learing perl syntax. But i finally got it done. Now i need help testing it. find it here. g...@github.com:anandjeyahar/mysqlDbAdmin-python.git.

Re: Idea for pure-python templates using AST.

2011-08-16 Thread Chris Angelico
On Tue, Aug 16, 2011 at 12:33 PM, Paul Wray paul.w...@det.nsw.edu.au wrote: The idea is simply to use python ASTs to transform this code so that it accumulates the values of the bare expressions. That'd be similar to what the interactive loop does. Are you aware, though, that docstrings are

Re: why i cannot import djang?

2011-08-16 Thread John Gordon
In mailman.66.1313506232.27778.python-l...@python.org smith jack thinke...@gmail.com writes: this package is already in the site-packages directory, but i cannot import it , it's really confusing ... Is it in the site-packages directory for the particular version of python you're using? For

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Philip Semanchuk
On Aug 16, 2011, at 12:19 PM, Ethan Furman wrote: Philip Semanchuk wrote: On Aug 16, 2011, at 11:41 AM, Ethan Furman wrote: Philip Semanchuk wrote: If we are to eschew warnings in cases where they might be highlighting something harmless, then we would have no warnings at all. Sounds

Re: why i cannot import djang?

2011-08-16 Thread Gennadiy Zlobin
import sys print sys.path # All directories where Python looks for packages - Gennadiy gennad.zlo...@gmail.com On Tue, Aug 16, 2011 at 11:12 PM, John Gordon gor...@panix.com wrote: In mailman.66.1313506232.27778.python-l...@python.org smith jack thinke...@gmail.com writes: this package

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread rantingrick
On Aug 16, 9:13 am, Philip Semanchuk phi...@semanchuk.com wrote: Sometimes X is safe and sometimes it isn't can be said of many, many things, from taking a walk down the street to juggling with knives. But it has little to do with whether or not Python should issue a warning in the specific

Re: testing if a list contains a sublist

2011-08-16 Thread MRAB
On 16/08/2011 00:26, Johannes wrote: hi list, what is the best way to check if a given list (lets call it l1) is totally contained in a second list (l2)? for example: l1 = [1,2], l2 = [1,2,3,4,5] - l1 is contained in l2 l1 = [1,2,2,], l2 = [1,2,3,4,5] - l1 is not contained in l2 l1 = [1,2,3],

python mysqltuner port

2011-08-16 Thread anand jeyahar
Hi all, Sorry for the repeat post. Had posted earlier in between an irrelevant thread by accident. Hi all,   I did it. Finally managed to port mysqltuner.pl to python. Was a real pain in the butt doing it from bottom up manually, without ever really learing perl syntax. But i finally got it

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Ethan Furman
Philip Semanchuk wrote: I think Python does lots of beneficial hand-holding. Garbage collection is a good example. $DIETY knows, people have been struggling with manual memory management in C and its ilk for a long time. Even though there are good tools to help, memory leaks still happen.

Re: Anyone here can do a comparation between Djang and RoR

2011-08-16 Thread Seebs
On 2011-08-16, smith jack thinke...@gmail.com wrote: what is the advantage of Django over RoR:) This question is pretty much... I mean, you're not gonna get useful answers. They're based on such different languages that I think any comparison past that is likely going to be uninteresting to a

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Seebs
On 2011-08-16, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 16 Aug 2011 01:23 pm Philip Semanchuk wrote: Why should built-ins be treated as more sacred than your own objects? Because built-ins are described in the official documentation as having a specific behavior,

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Seebs
On 2011-08-16, Ethan Furman et...@stoneleaf.us wrote: I think warnings should be reserved for language changes and such (like DeprecationWarning, RuntimeWarning, and FutureWarning), not for possible programmer mistakes. I disagree, on the basis of the following: The quality of C code I have

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Seebs
On 2011-08-16, Ethan Furman et...@stoneleaf.us wrote: What makes you think it's unintentional? Programming experience. People *often* do things unintentionally. Seems to me the real issue is somebody using a builtin, such as str or int, and that they somehow manage to do this without

RE: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Gerrat Rickert
On Aug 16, 2011, at 1:15 AM, Steven D'Aprano wrote: ... A warning that is off by default won't help the people who need it, because they don't know enough to turn the warning on. A warning that is on by default will be helpful to the newbie programmer for the first week or so, and then will

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Andrew Berg
On 2011.08.16 10:44 AM, rantingrick wrote: One word: SYNTAX HILIGHT And I had thought your troll skills had disappeared. Good one. -- CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0 PGP/GPG Public Key ID: 0xF88E034060A78FCB -- http://mail.python.org/mailman/listinfo/python-list

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Ethan Furman
Seebs wrote: On 2011-08-16, Ethan Furman et...@stoneleaf.us wrote: I think warnings should be reserved for language changes and such (like DeprecationWarning, RuntimeWarning, and FutureWarning), not for possible programmer mistakes. I disagree, on the basis of the following: The quality of

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Ethan Furman
Seebs wrote: On 2011-08-16, Ethan Furman et...@stoneleaf.us wrote: What makes you think it's unintentional? Programming experience. People *often* do things unintentionally. Seems to me the real issue is somebody using a builtin, such as str or int, and that they somehow manage to do this

Re: Linux : create a user if not exists

2011-08-16 Thread Smaine Kahlouch
Le 16/08/2011 17:56, Alexander Kapps a écrit : On 16.08.2011 16:57, smain kahlouch wrote: Ok than you. You're right but it doesn't help me : I replaced it : def finduser(user): ... if pwd.getpwnam(user): ... print user, user exists ... return True ... return

Re: testing if a list contains a sublist

2011-08-16 Thread Neil Cerutti
On 2011-08-16, nn prueba...@latinmail.com wrote: That can be easily fixed: def sublist(lst1, lst2): s1 = ','.join(map(str, lst1)) s2 = ','.join(map(str, lst2)) return False if s2.find(s1)==-1 else True sublist([1,2,3],[1,2,3,4,5]) True sublist([1,2,2],[1,2,3,4,5])

RE: Ten rules to becoming a Python community member.

2011-08-16 Thread Prasad, Ramit
Incorrect past tense usage of used to: I used to wear wooden shoes Incorrect description using used to: I have become used to wearing wooden shoes Correct usage of used to: Wooden shoes can be used to torture someone Double you tee eff? Maybe this is a cultural language difference, but

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Chris Angelico
On Tue, Aug 16, 2011 at 6:43 PM, Ethan Furman et...@stoneleaf.us wrote: Seebs wrote: On 2011-08-16, Ethan Furman et...@stoneleaf.us wrote: I think warnings should be reserved for language changes and such (like DeprecationWarning, RuntimeWarning, and FutureWarning), not for possible

Python 2.7.2 on AIX 6.1: Unable to compile with ctypes

2011-08-16 Thread eroussel
Hello, I'm trying to figure out the recipe to compile Python 2.7.2 on AIX 6.1 with the ctypes module. I'm using the xlc_r compiler V9.0. I am currently able to generate an interpreter that works, but lacks the ctypes module because of compilation errors. From looking at the newgroup posts and

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread Martin P. Hellwig
On 16/08/2011 18:51, Prasad, Ramit wrote: Incorrect past tense usage of used to: I used to wear wooden shoes Incorrect description using used to: I have become used to wearing wooden shoes Correct usage of used to: Wooden shoes can be used to torture someone Double you tee eff?

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Tim Chase
On 08/16/2011 12:11 PM, Seebs wrote: Under which circumstance will you have more problems? 1. There is not a single shadowed built-in in the entire project. 2. There are dozens of shadowed built-ins based on when the original programmer felt there wasn't going to be a need for a given

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread Chris Angelico
On Tue, Aug 16, 2011 at 7:37 PM, Martin P. Hellwig martin.hell...@butterfly.uk.com wrote: With the second sentence meaning: in the past I was not used to (i.e. uncomfortable, hey bonus points!) wearing wooden shoes, but presently I am used to it (although not necessarily comfortable, but at

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
def wait_for_keystroke(): char=0 while not char==0x1B: char=msvcrt.getch() That freezes the process. Am I using the right code for the escape key, or doing anything else wrong? Again, I know it could be my system. But I must find a way to do this from within Windows. I use a keyboard

Re: Wait for a keypress before continuing?

2011-08-16 Thread John Doe
def wait_for_keystroke(): char=0 while not char==0x1B: char=msvcrt.getch() I tried using while not char==chr(27): -- http://mail.python.org/mailman/listinfo/python-list

Re: Why no warnings when re-assigning builtin names?

2011-08-16 Thread Seebs
On 2011-08-16, Ethan Furman et...@stoneleaf.us wrote: Seebs wrote: The quality of C code I have to deal with has increased dramatically as gcc's aggressive use of warnings has spread. With gcc you pay the cost once, with Python you would pay it with every run. A linter would be more along

Re: allow line break at operators

2011-08-16 Thread rantingrick
On Aug 16, 1:49 am, alex23 wuwe...@gmail.com wrote: On Aug 16, 2:37 pm, rantingrick rantingr...@gmail.com wrote: The reading proceeds naturally from right to left. Well, naturally if you're coding in Hebrew or Japanese perhaps :) Yes :). I typo-ed that one. It was getting late when i sent

Re: Ten rules to becoming a Python community member.

2011-08-16 Thread MRAB
On 16/08/2011 19:37, Martin P. Hellwig wrote: On 16/08/2011 18:51, Prasad, Ramit wrote: Incorrect past tense usage of used to: I used to wear wooden shoes Incorrect description using used to: I have become used to wearing wooden shoes Correct usage of used to: Wooden shoes can be

  1   2   3   >