Spawn a process, then exit, whilst leaving process running?

2013-02-08 Thread Victor Hooi
Hi, I have a Python script that I'd like to spawn a separate process (SSH client, in this case), and then have the script exit whilst the process continues to run. I looked at Subprocess, however, that leaves the script running, and it's more for spawning processes and then dealing with their

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Chris Angelico
On Sat, Feb 9, 2013 at 12:29 PM, Ian Kelly wrote: > On Fri, Feb 8, 2013 at 5:49 PM, Rick Johnson > wrote: >> What the hell? Oh yeah, you must be using pike again. No, if it were pike >> the list would look like this: >> >> ({({"q"}), ({"w","e"}), ({"r","t","u"}), ({"i","o","p"})}) >> >> Folks, i

Re: best way to share an instance of a class among modules?

2013-02-08 Thread Michael Torrie
On 02/07/2013 07:14 PM, Rick Johnson wrote: > So if you want to use "global variables" , (bka: Module level > variables), then simply declare them with a None value like this: > > globalVariable = None This is a nice convention, but at best it's just a helpful notation that helps a programmer kn

Re: LangWart: Method congestion from mutate multiplicty

2013-02-08 Thread Chris Angelico
On Sat, Feb 9, 2013 at 12:50 PM, Rick Johnson wrote: > I really don't like to read docs when learning a language, especially a > "so-called" high level language. I prefer to learn the language by > interactive sessions and object introspection. Then, when i have exhausted > all abilities to int

Re: PyWart: Namespace asinitiy and the folly of the global statement

2013-02-08 Thread Michael Torrie
On 02/08/2013 04:45 AM, Steven D'Aprano wrote: > Rick Johnson wrote: >> Of course in this simplistic example we can see that count is @ module >> level > > But it isn't. It is a local variable. > > Rick, I appreciate your honesty in telling us that you have no idea how to > read Python code and r

Re: LangWart: Method congestion from mutate multiplicty

2013-02-08 Thread Steven D'Aprano
Rick Johnson wrote: > The solution is simple. Do not offer the "copy-mutate" methods and force > all mutation to happen in-place: > > py> l = [1,2,3] > py> l.reverse > py> l > [3,2,1] > > If the user wants a "mutated copy" he should explicitly create a new > object and then apply the correct mut

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Steven D'Aprano
Rick Johnson wrote: > On Friday, February 8, 2013 9:16:42 AM UTC-6, Steven D'Aprano wrote: >> Rick Johnson wrote: >> >> > GvR has always been reluctant to incorporate full OOP machinery for >> > some reason. >> >> Python is a fully object oriented language. It is *more* object oriented >> than, sa

Re: Opinion on best practice...

2013-02-08 Thread John Ladasky
On Tuesday, February 5, 2013 5:55:50 PM UTC-8, Steven D'Aprano wrote: > To do anything meaningful in bash, you need to be an expert on > passing work off to other programs... [snip] > If you took the Zen of Python, > and pretty much reversed everything, you might have the Zen of Bash: I have to

Re: Jinja2 installation help

2013-02-08 Thread Wayne Werner
On Fri, 8 Feb 2013, Robert Iulian wrote: Hello, I recently started learning Python. Just finished learning the basis of it, and now I think I'm ready to start working on a simple website but I am having some difficulties installing Jinja2. Can anyone post a dummy guide on how to install it, a

LangWart: Method congestion from mutate multiplicty

2013-02-08 Thread Rick Johnson
DISCLAIMER: This post covers a universal programming language design flaw using both Python and Ruby code examples to showcase the issue. I really don't like to read docs when learning a language, especially a "so-called" high level language. I prefer to learn the language by interactive sess

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Ian Kelly
On Fri, Feb 8, 2013 at 5:49 PM, Rick Johnson wrote: > On Friday, February 8, 2013 6:05:54 PM UTC-6, Chris Angelico wrote: >> The sum builtin works happily on any sequence of objects >> that can be added together. It works as an excellent >> flatten() method: >> >> >>> nested_list = [["q"], ["w","e

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Chris Angelico
On Sat, Feb 9, 2013 at 11:49 AM, Rick Johnson wrote: > On Friday, February 8, 2013 6:05:54 PM UTC-6, Chris Angelico wrote: >> The sum builtin works happily on any sequence of objects >> that can be added together. It works as an excellent >> flatten() method: >> >> >>> nested_list = [["q"], ["w","

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Ian Kelly
On Fri, Feb 8, 2013 at 12:58 PM, Rick Johnson wrote: > I'm a bit unnerved by the sum function. Summing a sequence only makes sense > if the sequence in question contains /only/ numeric types. For that reason i > decided to create a special type for holding Numerics. This will probably > result

Re: Monitoring updating directory for image for GUI

2013-02-08 Thread Oscar Benjamin
On 8 February 2013 17:09, wrote: >> So you have a thread that updates the image and then checks the stack >> to see if a new image is available? Can you not just have it only try >> to load the newest image? > > That is what I am trying to figure out how to do. I have a counter that > updates w

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Rick Johnson
On Friday, February 8, 2013 6:05:54 PM UTC-6, Chris Angelico wrote: > The sum builtin works happily on any sequence of objects > that can be added together. It works as an excellent > flatten() method: > > >>> nested_list = [["q"], ["w","e"], ["r","t","u"], ["i","o","p"]] > >>> sum(nested_list,[])

Re: Opinion on best practice...

2013-02-08 Thread Chris Angelico
On Sat, Feb 9, 2013 at 5:29 AM, Dennis Lee Bieber wrote: > If you want the real nightmare -- look into the IBM "queue" scheme > (not many REXX implementations except on IBM mainframes support that). > One can push lines onto the queue, such that when the script exits, the > command proces

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Chris Angelico
On Sat, Feb 9, 2013 at 6:58 AM, Rick Johnson wrote: > I'm a bit unnerved by the sum function. Summing a sequence only makes sense > if the sequence in question contains /only/ numeric types. For that reason i > decided to create a special type for holding Numerics. This will probably > result i

Re: pxssh sendline() cmd

2013-02-08 Thread Piet van Oostrum
rajesh kumar writes: > Hi > > I need help in pxssh. > > Steps : > 1) I was login into remote machine usning pxssh and the prompt is '$'. > 2) After successful login running some command and the prompt is '>'. > 3) Here onwards I want to execute cli commands by using sendline(). > > My requirement

Glade + GTK.Builder() | Missing Handlers | Handler for multiple objects

2013-02-08 Thread ciscorucinski
Here is my code in PasteBin... http://pastebin.com/ZubyV8RT If you go to the very bottom of the paste, you will see the error messages that I get, but here it is again. --- Warning (from warnings module): File "C:\Users\rucinskic

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Steven D'Aprano
MRAB wrote: > On 2013-02-08 07:22, Steven D'Aprano wrote: >> Prior to Python 3, the special method __bool__ was spelled __nonempty__, >> which demonstrates Python's philosophy towards duck-typing bools. >> > Incorrect, it was spelled __nonzero__. Oops, so it was. Sorry for the brain-fart. __non

Re: Improve reduce functions of SQLite3 request

2013-02-08 Thread Steffen Mutter
Dennis Lee Bieber wrote: > If you use separate tables you make it more difficult to generate > the SQL (as you have to create the SQL with the season specific table > name, instead of just using a "where " clause to restrict data), and > lose the potential to produce reports covering mul

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Rick Johnson
On Friday, February 8, 2013 11:48:43 AM UTC-6, Rick Johnson wrote: > > [...] > > So using a /real/ OOP paridigm we would do the following: > > ## START TRUE OOP PARIDIGM ## > > [...snip naive example...] Actually my example API is littered with artifacts of a python "global function architect

Re: Is Python programming language?

2013-02-08 Thread Mark Lawrence
On 08/02/2013 13:38, rusi wrote: On Feb 8, 6:03 pm, gmspro wrote: Hello all, One said, Python is not programming language, rather scripting language, is that true? Thanks. One said: English is the language spoken in England. Wrong, English is spoken in some parts of England but I've no i

Re: Is Python programming language?

2013-02-08 Thread Grant Edwards
On 2013-02-08, Stephane Wirtel wrote: > * gmspro [2013-02-08 05:03:51 -0800]: > >> Hello all, >> >> One said, Python is not programming language, rather scripting language, is >> that true? >> >> Thanks. >> > >> -- >> http://mail.python.org/mailman/listinfo/python-list > > What's the differe

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Roy Smith
In article , Rick Johnson wrote: > The best way to describe Python is as promiscuous language who secretly > longs to be 100% OOP, and to fulfill this fantasy it cross-dresses in OOP > lingerie on the weekends. +1 QOTD :-) -- http://mail.python.org/mailman/listinfo/python-list

Jinja2 installation help

2013-02-08 Thread Robert Iulian
Hello, I recently started learning Python. Just finished learning the basis of it, and now I think I'm ready to start working on a simple website but I am having some difficulties installing Jinja2. Can anyone post a dummy guide on how to install it, and what to do step by step? I am using the l

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Rick Johnson
On Friday, February 8, 2013 9:16:42 AM UTC-6, Steven D'Aprano wrote: > Rick Johnson wrote: > > > GvR has always been reluctant to incorporate full OOP machinery for some > > reason. > > Python is a fully object oriented language. It is *more* object oriented > than, say, Java. Oh really? *chuckles

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread MRAB
On 2013-02-08 07:22, Steven D'Aprano wrote: Rick Johnson wrote: Why even have a damn bool function if you're never going to use it? bool is for converting arbitrary objects into a canonical True or False flag. E.g. one use-case is if you wish to record in permanent storage a flag, and don't w

Re: Monitoring updating directory for image for GUI

2013-02-08 Thread ciscorucinski
> Who/what are you responding to here? You haven't included any context > from what you're replying to. Sorry, never really used Google Groups, or anything like this before. That I was responding to only Chris Angelico with his question of how real-time it needed to be...since it takes some ti

Re: Curious to see alternate approach on a search/replace via regex

2013-02-08 Thread Ian Kelly
On Fri, Feb 8, 2013 at 4:43 AM, Steven D'Aprano wrote: > Ian Kelly wrote: > Surely that depends on the size of the pattern, and the size of the data > being worked on. Natually. > Compiling the pattern "s[ai]t" doesn't take that much work, it's only six > characters and very simple. Applying it

Re: Is Python programming language?

2013-02-08 Thread Chris Angelico
On Sat, Feb 9, 2013 at 2:58 AM, Dave Angel wrote: > On 02/08/2013 10:46 AM, Kwpolska wrote: >> >> On Fri, Feb 8, 2013 at 4:40 PM, Chris Angelico wrote: >>> >>> On Sat, Feb 9, 2013 at 2:28 AM, Albert Hopkins >>> wrote: ... one could say that C++ is a "scripting language" if one wer

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Steven D'Aprano
Rick Johnson wrote: > GvR has always been reluctant to incorporate full OOP machinery for some > reason. Python is a fully object oriented language. It is *more* object oriented than, say, Java. - everything in Python is an object, there is no distinction between "boxed" and "unboxed" variables;

Re: Is Python programming language?

2013-02-08 Thread Dave Angel
On 02/08/2013 10:46 AM, Kwpolska wrote: On Fri, Feb 8, 2013 at 4:40 PM, Chris Angelico wrote: On Sat, Feb 9, 2013 at 2:28 AM, Albert Hopkins wrote: ... one could say that C++ is a "scripting language" if one were to use a C++ interpreter. And if one is sufficiently sadistic to actually use

Re: memoryview (was "len() on mutables vs. immutables")

2013-02-08 Thread Demian Brecht
This helped clarify, thanks. I also went through PEP 3118 in detail (as I should have in the first place) which also helped. Thanks, Demian Brecht http://demianbrecht.github.com On 2013-02-08 6:50 AM, "Oscar Benjamin" wrote: >This is in keeping with the way that numpy.ndarrays work. Essential

Re: Is Python programming language?

2013-02-08 Thread Kwpolska
On Fri, Feb 8, 2013 at 4:40 PM, Chris Angelico wrote: > On Sat, Feb 9, 2013 at 2:28 AM, Albert Hopkins wrote: >> ... one could say that C++ is a "scripting language" if one >> were to use a C++ interpreter. > > And if one is sufficiently sadistic to actually use C++ in that way. > > ChrisA > -- >

Re: Is Python programming language?

2013-02-08 Thread Chris Angelico
On Sat, Feb 9, 2013 at 2:28 AM, Albert Hopkins wrote: > ... one could say that C++ is a "scripting language" if one > were to use a C++ interpreter. And if one is sufficiently sadistic to actually use C++ in that way. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python programming language?

2013-02-08 Thread Albert Hopkins
On Fri, Feb 8, 2013, at 08:03 AM, gmspro wrote: > Hello all, > > One said, Python is not programming language, rather scripting language, > is that true? > According to Wikipedia[1] a "scripting languages" are a subset of "programming languages" so it goes that any "scripting language" is, be

Re: memoryview (was "len() on mutables vs. immutables")

2013-02-08 Thread Oscar Benjamin
On 8 February 2013 06:24, Demian Brecht wrote: > On 2013-02-07 8:30 PM, "Terry Reedy" wrote: > > If a memoryview (3+) is representing a non-continuguous block of memory (> > 1 > ndim), will len(obj) not return incorrect results? It seems to be > reporting the shape of the 0th dim at the moment..

Re: Is Python programming language?

2013-02-08 Thread Steven D'Aprano
gmspro wrote: > One said, Python is not programming language, rather scripting language, > is that true? I forgot to mention, there is a FAQ about this: http://docs.python.org/2/faq/general.html#what-is-python-good-for -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Python programming language?

2013-02-08 Thread Steven D'Aprano
gmspro wrote: > Hello all, > > One said, Python is not programming language, rather scripting language, > is that true? Python is a high-level, object-oriented, strongly-typed programming language with garbage collection, byte-code compilation, dynamic types, and syntax that includes OOP, proced

Re: Moving mouse, Python3 and PyObjc

2013-02-08 Thread Dave Angel
On 02/08/2013 05:32 AM, Oneill wrote: Your emails are very hard to read, since your mailer doublespaces nearly everything you quote. What's the objc module got to do with the mouse? http://packages.python.org/pyobjc/api/module-objc.html Perhaps you meant some other modul

Re: Is Python programming language?

2013-02-08 Thread Ulrich Eckhardt
Am 08.02.2013 14:03, schrieb gmspro: One said, Python is not programming language, rather scripting language, is that true? That depends on your definition of scripting language and programming language. Python's not a language but an animal. Uli -- http://mail.python.org/mailman/listinfo

pxssh sendline() cmd

2013-02-08 Thread rajesh kumar
Hi I need help in pxssh. Steps : 1) I was login into remote machine usning pxssh and the prompt is '$'. 2) After successful login running some command and the prompt is '>'. 3) Here onwards I want to execute cli commands by using sendline(). My requirement: I need to pass arguments to sendline()

Re: Is Python programming language?

2013-02-08 Thread rusi
On Feb 8, 6:03 pm, gmspro wrote: > Hello all, > > One said, Python is not programming language, rather scripting language, is > that true? > > Thanks. One said: English is the language spoken in England. Another One said: English is the language internationally used for commerce, academics and m

Re: Is Python programming language?

2013-02-08 Thread Stefan Behnel
gmspro, 08.02.2013 14:03: > One said, Python is not programming language, rather scripting language, is > that true? Apples and oranges. It's a bit like asking if C is an embedded systems language or if JavaScript is a 3D graphics language. Well, no, but you can use them for that if you want. Tha

Re: Is Python programming language?

2013-02-08 Thread Stephane Wirtel
* gmspro [2013-02-08 05:03:51 -0800]: > Hello all, > > One said, Python is not programming language, rather scripting language, is > that true? > > Thanks. > > -- > http://mail.python.org/mailman/listinfo/python-list What's the difference ? http://openerp.com OpenERP is written with Pytho

children process

2013-02-08 Thread Rita
hi, I currently have a bash wrapper which executes a program, something like this #!/usr/bin/env bash export LD_LIBRARY_PATH=/foo:$LD_LIBRARY_PATH exec "$@" I would like to have a python process which will do process accounting for all children, so if a process starts, I would like to get all th

Re: PyWart: Namespace asinitiy and the folly of the global statement

2013-02-08 Thread Steven D'Aprano
Rick Johnson wrote: > When reading over some source code we really have no idea in which > namespace a variable lives. Consider the following: > > count = 0 > class Blah: > def meth(): > for x in range(100): > count = x > > Where is count living? > > Of course in this si

Re: Curious to see alternate approach on a search/replace via regex

2013-02-08 Thread Steven D'Aprano
Ian Kelly wrote: > On Thu, Feb 7, 2013 at 10:57 PM, rh wrote: >> On Thu, 7 Feb 2013 18:08:00 -0700 >> Ian Kelly wrote: >> >>> Which is approximately 30 times slower, so clearly the regular >>> expression *is* being cached. I think what we're seeing here is that >>> the time needed to look up th

Re: PyWart: Namespace asinitiy and the folly of the global statement

2013-02-08 Thread Chris Angelico
On Fri, Feb 8, 2013 at 10:29 PM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> On Fri, Feb 8, 2013 at 3:30 PM, Rick Johnson >> wrote: >>> It is my strong opinion that all "unqualified" variables must be local to >>> the containing block, func/meth, class, or module. To access any variable >

Re: PyWart: Namespace asinitiy and the folly of the global statement

2013-02-08 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Feb 8, 2013 at 3:30 PM, Rick Johnson > wrote: >> It is my strong opinion that all "unqualified" variables must be local to >> the containing block, func/meth, class, or module. To access any variable >> outside of the local scope a programmer MUST qualify that vari

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Steven D'Aprano
Rick Johnson wrote: > On Monday, July 16, 2012 7:43:47 PM UTC-5, Steven D'Aprano wrote: Really Rick? Digging out a post from nearly seven months ago? You must really be bored silly. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Thomas Rachel
Am 08.02.2013 07:29 schrieb Rick Johnson: Consider this: if connect("my:db") as db: No need to make a call and then test for the validity of the call when you can do both simultaneously AND intuitively. Would be great, but can be emulated with def ifiter(x): if x: yield

Re: Moving mouse, Python3 and PyObjc

2013-02-08 Thread Oneill
> > > > > > import objc > > > > > > def clickMouse(x, y, button): > > > bndl = objc.loadBundle('CoreGraphics', globals(), > > '/System/Library/Frameworks/ApplicationServices.framework') > > > objc.loadBundleFunctions(bndl, globals(), [('CGPostMouseEvent', > > 'v{CGPoint=ff}III')]

Re: Moving mouse, Python3 and PyObjc

2013-02-08 Thread Oneill
On Thursday, 7 February 2013 23:22:01 UTC, Oneill wrote: > import objc > > > > def clickMouse(x, y, button): > > bndl = objc.loadBundle('CoreGraphics', globals(), > '/System/Library/Frameworks/ApplicationServices.framework') > > objc.loadBundleFunctions(bndl, globals(), [('CGPostMous

Re: Implicit conversion to boolean in if and while statements

2013-02-08 Thread Mark Lawrence
On 08/02/2013 06:15, Chris Angelico wrote: On Fri, Feb 8, 2013 at 4:53 PM, Rick Johnson wrote: And which Univeristy would you recommend for studying the intricacies of "gobbledygook"? ;-) Dunno, where'd you get your degree in logic? From the University of Wallamaloo whilst in charge of the

Re: Curious to see alternate approach on a search/replace via regex

2013-02-08 Thread Peter Otten
Serhiy Storchaka wrote: > On 07.02.13 11:49, Peter Otten wrote: >> ILLEGAL = "-:./?&=" >> try: >> TRANS = string.maketrans(ILLEGAL, "_" * len(ILLEGAL)) >> except AttributeError: >> # python 3 >> TRANS = dict.fromkeys(map(ord, ILLEGAL), "_") > > str.maketrans() D'oh. ILLEGAL = "-:

Re: which situations should we use thread. join() ?

2013-02-08 Thread Ulrich Eckhardt
Am 08.02.2013 07:29, schrieb Chris Angelico: On Fri, Feb 8, 2013 at 3:32 PM, iMath wrote: which situations should we use thread. join() ? http://bpaste.net/show/yBDGfrlU7BDDpvEZEHmo/ why do we not put thread. join() in this code ? I've no idea why you don't put thread.join() in that code. M

Re: Curious to see alternate approach on a search/replace via regex

2013-02-08 Thread Nick Mellor
Hi RH, It's essential to know about regex, of course, but often there's a better, easier-to-read way to do things in Python. One of Python's aims is clarity and ease of reading. Regex is complex, potentially inefficient and hard to read (as well as being the only reasonable way to do things so

Re: Curious to see alternate approach on a search/replace via regex

2013-02-08 Thread Ian Kelly
On Thu, Feb 7, 2013 at 10:57 PM, rh wrote: > On Thu, 7 Feb 2013 18:08:00 -0700 > Ian Kelly wrote: > >> Which is approximately 30 times slower, so clearly the regular >> expression *is* being cached. I think what we're seeing here is that >> the time needed to look up the compiled regular express