Re: argparse -- mutually exclusive sets of arguments?

2012-11-23 Thread Ian Kelly
On Fri, Nov 23, 2012 at 11:46 AM, Roy Smith wrote: > My command either takes two positional arguments (in which case, both > are required): > > $ command foo bar > > or the name of a config file (in which case, the positional arguments > are forbidden): > > $ command --config file > > How can I re

Re: argparse -- mutually exclusive sets of arguments?

2012-11-23 Thread Joshua Landau
On 23 November 2012 18:46, Roy Smith wrote: > My command either takes two positional arguments (in which case, both > are required): > > $ command foo bar > > or the name of a config file (in which case, the positional arguments > are forbidden): > > $ command --config file > > How can I represen

RE: Problem with subprocess.call and windows schtasks

2012-11-23 Thread Prasad, Ramit
Dave Angel wrote: > > On 11/20/2012 06:41 PM, Tom Borkin wrote: > > (Please don't top-post. Now we lose all the context) > > Using shlex, I now have this: > > #!\Python27\python > > import os, subprocess > > path = os.path.join("C:\\", "Program Files", "Apache Group", "Apache2", > > "htdocs", "c

Re: 10 sec poll - please reply!

2012-11-23 Thread Steven D'Aprano
On Fri, 23 Nov 2012 05:42:22 -0800, Michael Herrmann wrote: > Dear all, > > the emails are getting kind of long so to ask you briefly: What do you > think of splitting `type` into two functions `press` and `enter`? This invites confusion as to the rules of when you can call `press` and when you

Re: Getting a seeded value from a list

2012-11-23 Thread Chris Angelico
On Sat, Nov 24, 2012 at 3:27 AM, Prasad, Ramit wrote: > Steven D'Aprano wrote: >> >> On Wed, 21 Nov 2012 14:41:24 +1100, Chris Angelico wrote: >> >> > However, this still means that the player will see the exact same level >> > regenerated every time, absolutely fresh. As previously stated in this

Re: Is it bad style to override the built-in function `type`?

2012-11-23 Thread Cameron Simpson
On 23Nov2012 10:41, Michael Herrmann wrote: [...] | I know it's a common beginner's mistake to incautiously override | built-in functions. However, we put in a lot of research and have come to | the conclusion that, if Python had not already defined it, `type` would | be the best name. We are now

Re: Why queue.empty() returns False even after put() is called?

2012-11-23 Thread Cameron Simpson
On 23Nov2012 11:53, Ian Kelly wrote: | On Fri, Nov 23, 2012 at 9:57 AM, Peng Yu wrote: | > The empty() returns True even after put() has been called. Why it is | > empty when there some items in it? Could anybody help me understand | > it? Thanks! | > | > ~/linux/test/python/man/library/multiproc

Re: argparse -- mutually exclusive sets of arguments?

2012-11-23 Thread Terry Reedy
On 11/23/2012 1:46 PM, Roy Smith wrote: My command either takes two positional arguments (in which case, both are required): $ command foo bar or the name of a config file (in which case, the positional arguments are forbidden): $ command --config file How can I represent this with argparse;

Re: Why queue.empty() returns False even after put() is called?

2012-11-23 Thread Ian Kelly
On Fri, Nov 23, 2012 at 9:57 AM, Peng Yu wrote: > Hi, > > The empty() returns True even after put() has been called. Why it is > empty when there some items in it? Could anybody help me understand > it? Thanks! > > ~/linux/test/python/man/library/multiprocessing/Queue/empty$ cat > main.py > #!/usr

Re: Why queue.empty() returns False even after put() is called?

2012-11-23 Thread MRAB
On 2012-11-23 16:57, Peng Yu wrote: Hi, The empty() returns True even after put() has been called. Why it is empty when there some items in it? Could anybody help me understand it? Thanks! ~/linux/test/python/man/library/multiprocessing/Queue/empty$ cat main.py #!/usr/bin/env python import mul

argparse -- mutually exclusive sets of arguments?

2012-11-23 Thread Roy Smith
My command either takes two positional arguments (in which case, both are required): $ command foo bar or the name of a config file (in which case, the positional arguments are forbidden): $ command --config file How can I represent this with argparse; add_mutually_exclusive_group() isn't qu

Re: Is it bad style to override the built-in function `type`?

2012-11-23 Thread Terry Reedy
On 11/23/2012 11:22 AM, Joel Goldstick wrote: On Fri, Nov 23, 2012 at 11:12 AM, Michael Herrmann mailto:michael.herrm...@getautoma.com>> wrote: Hi, do you think it's bad style to override the built-in function `type`? I'm co-developing a GUI automation library called Automa (

Re: 10 sec poll - please reply!

2012-11-23 Thread Michael Herrmann
Hi, I see your concern with having two functions that have to be separately remembered... I personally would also be fine with type(), however some people are violently against it. I opened a new thread (https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.python/GjZ2hAS1Wyk) to ask j

Why queue.empty() returns False even after put() is called?

2012-11-23 Thread Peng Yu
Hi, The empty() returns True even after put() has been called. Why it is empty when there some items in it? Could anybody help me understand it? Thanks! ~/linux/test/python/man/library/multiprocessing/Queue/empty$ cat main.py #!/usr/bin/env python import multiprocessing queue = multiprocessing.

Re: Is it bad style to override the built-in function `type`?

2012-11-23 Thread Roy Smith
In article , Michael Herrmann wrote: > do you think it's bad style to override the built-in function `type`? I'm > co-developing a GUI automation library called Automa > (http://www.getautoma.com) and 'type' would be a very fitting name for a > function that generates artificial key strokes.

Re: 10 sec poll - please reply!

2012-11-23 Thread Kwpolska
On Fri, Nov 23, 2012 at 2:42 PM, Michael Herrmann wrote: > Dear all, > > the emails are getting kind of long so to ask you briefly: What do you think > of splitting `type` into two functions `press` and `enter`? Their use cases > are: > press(CTRL + 'a') > press(ENTER) >

RE: Getting a seeded value from a list

2012-11-23 Thread Prasad, Ramit
Steven D'Aprano wrote: > > On Wed, 21 Nov 2012 14:41:24 +1100, Chris Angelico wrote: > > > However, this still means that the player will see the exact same level > > regenerated every time, absolutely fresh. As previously stated in this > > thread, that's not usually a good thing for encounters,

ANN : occmodel v0.1.0

2012-11-23 Thread Runar Tenfjord
I am pleased to announce the first official release of occmodel (v0.1.0) and the releated libraries geotools/gltools. Description -- occmodel is a small library which gives a high level access to the OpenCASCADE modelling kernel. For most users a direct use of the OpenCASCADE modelling k

Re: 10 sec poll - please reply!

2012-11-23 Thread Michael Herrmann
Hi again, Steven's points and the "feeling" for `type` are very good and maybe the problems I mentioned can be ramified. I therefore opened a new thread to find out what the general public thinks about overwriting built-in functions such as `type` here: https://groups.google.com/forum/?fromgro

who is that...?!!

2012-11-23 Thread BV BV
who is that...?!! http://www.youtube.com/watch?v=SIADfS030qg&feature=BFa&list=PLB95C1C59E12FBA96 thank you -- http://mail.python.org/mailman/listinfo/python-list

Re: python3.3 - tk_setPalette bug?

2012-11-23 Thread Peter Otten
Helmut Jarausch wrote: > Hi, > > AFAIK, this should work: > > import tkinter as Tk > root= Tk.Tk() > root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue') > > but python-3.3:0e4574595674+ gives > > Traceback (most recent call last): > File "Matr_Select.py", line 174, in >

Re: 10 sec poll - please reply!

2012-11-23 Thread Michael Herrmann
Dear all, the emails are getting kind of long so to ask you briefly: What do you think of splitting `type` into two functions `press` and `enter`? Their use cases are: press(CTRL + 'a') press(ENTER) press(ALT + 'f', 's') enter("Hello World!") enter("te

python3.3 - tk_setPalette bug?

2012-11-23 Thread Helmut Jarausch
Hi, AFAIK, this should work: import tkinter as Tk root= Tk.Tk() root.tk_setPalette(background = 'AntiqueWhite1', foreground = 'blue') but python-3.3:0e4574595674+ gives Traceback (most recent call last): File "Matr_Select.py", line 174, in root.tk_setPalette(background = 'AntiqueWhite1',

Re: method that can be called from a class and also from an instance

2012-11-23 Thread Steven D'Aprano
On Fri, 23 Nov 2012 09:52:25 +0100, Peter Otten wrote: > Steven D'Aprano wrote: >> http://code.activestate.com/recipes/577030/ > > Am I reading that right that you don't invoke method() as > MyClass.method()? No. I give an example and explicitly state: You can use this class without instan

Re: Pass parameters/globals to eval

2012-11-23 Thread Chris Angelico
On Fri, Nov 23, 2012 at 11:14 PM, wrote: > Why isn't 'a' defined? > Shouldn't you be able to define the global variables with a dict passed to > eval? > Is there an other way to do this, beside the two obvious: defining 'a' before > calling gp_function and using a as an argument in gp_function?

Pass parameters/globals to eval

2012-11-23 Thread esandin
I am trying to set the parameter 'a' below so that it can be used when I call eval: >>> def gp_function(): ... return 1+a ... >>> print eval("gp_function()", {'a':123, 'gp_function':gp_function}) Traceback (most recent call last): File "", line 1, in File "", line 1, in File "", lin

Re: Print value from array

2012-11-23 Thread Hans Mulder
On 22/11/12 19:44:02, Mike wrote: > Hello, > I am noob en python programing, i wrote a perl script for read from csv but > now i wish print value but the value must be within double quote and I can > not do this. > > For example now the output is: > > ma user@domain displayName Name SecondNam

Re: Migrate from Access 2010 / VBA

2012-11-23 Thread Peter Otten
kgard wrote: > Greetings: > > I am the lone developer of db apps at a company of 350+ employees. > Everything is done in MS Access 2010 and VBA. I'm frustrated with the > limitations of this platform and have been considering switching to > Python. I've been experimenting with the language for a

Re: method that can be called from a class and also from an instance

2012-11-23 Thread Peter Otten
Steven D'Aprano wrote: > On Thu, 22 Nov 2012 16:51:27 +0100, Peter Otten wrote: > >> Marc Aymerich wrote: >> >>> Hi, >>> >>> I want to create a method within a class that is able to accept either >>> a class or an instance. > [...] >> Why would you overload a method that way? > > > The use-ca