Re: [Tutor] Why begin a function name with an underscore

2012-08-27 Thread Richard D. Moores
On Mon, Aug 27, 2012 at 6:33 PM, Japhy Bartlett wrote: > something like: > > def _validate_int(obj): > """Raise an exception if obj is not an integer.""" > m = int(obj + 0) # May raise TypeError. > if obj != m: > raise ValueError('expected an integer but got %r' % obj) > > >

Re: [Tutor] Why begin a function name with an underscore

2012-08-27 Thread 罗健忠
> > It's better to use the single-leading-underscore convention, _internal. > This isn't name mangled at all; it just indicates to others to "be careful > with this, it's an internal implementation detail; don't touch it if you > don't *fully* understand it". It's only a convention though. you ca

[Tutor] Why begin a function name with an underscore

2012-08-27 Thread Richard D. Moores
I've been going through Steven D'Aprano's pyprimes () and have many questions. One is why begin a function name with an underscore. He has several functions that do this. Two are: def _validate_int(obj): """Raise an exception if obj is not an intege

Re: [Tutor] 2.7.3 Popen argument issues

2012-08-27 Thread Ray Jones
On 08/27/2012 05:45 AM, eryksun wrote: > Most programs expect their arguments to have been tokenized as the > shell would as a matter of convention. So, for example, if vlc gets > "-I" in argv[1] it expects that argv[2] will be a value such as > "dummy". A value of "-I dummy" in argv[1] in principl

Re: [Tutor] 2.7.3 Popen argument issues

2012-08-27 Thread eryksun
On Mon, Aug 27, 2012 at 3:52 AM, Ray Jones wrote: > > Yes, the Bash call worked (in fact I tried it just prior to sending the > original message just to be sure). > > I guess I'm a bit confused about 'splitting' the arguments. You said > that Python splits arguments on spaces. What exactly happens

Re: [Tutor] 2.7.3 Popen argument issues

2012-08-27 Thread Dave Angel
On 08/27/2012 03:52 AM, Ray Jones wrote: > On 08/26/2012 07:12 AM, eryksun wrote: >> > Yes, the Bash call worked (in fact I tried it just prior to sending the > original message just to be sure). > > I guess I'm a bit confused about 'splitting' the arguments. You said > that Python splits argument

Re: [Tutor] 2.7.3 Popen argument issues

2012-08-27 Thread Ray Jones
On 08/26/2012 07:12 AM, eryksun wrote: > On Sun, Aug 26, 2012 at 7:55 AM, Ray Jones wrote: >> [0x8d42554] stream_out_standard stream out error: no mux specified or >> found by extension >> [0x8d42134] main stream output error: stream chain failed for >> `standard{mux="",access=""#duplicate{dst="tr