hey did you find the answer for this
--
https://mail.python.org/mailman/listinfo/python-list
On Wednesday, October 26, 2016 at 5:31:18 PM UTC-5, MRAB wrote:
> On 2016-10-26 21:44, pic8...@gmail.com wrote:
> > On Monday, October 24, 2016 at 12:39:47 PM UTC-5, Thomas Nyberg wrote:
> >> On 10/24/2016 12:45 PM, pic8...@gmail.com wrote:
> >> > Thanks for the reply.
> >> >
> >> > The code snippe
On 2016-10-26 21:44, pic8...@gmail.com wrote:
On Monday, October 24, 2016 at 12:39:47 PM UTC-5, Thomas Nyberg wrote:
On 10/24/2016 12:45 PM, pic8...@gmail.com wrote:
> Thanks for the reply.
>
> The code snippet given by Peter is not very clear
>
> I would like to multiprocess a function which is
On Monday, October 24, 2016 at 12:39:47 PM UTC-5, Thomas Nyberg wrote:
> On 10/24/2016 12:45 PM, pic8...@gmail.com wrote:
> > Thanks for the reply.
> >
> > The code snippet given by Peter is not very clear
> >
> > I would like to multiprocess a function which is written in python of the
> > form b
On 10/24/2016 12:45 PM, pic8...@gmail.com wrote:
Thanks for the reply.
The code snippet given by Peter is not very clear
I would like to multiprocess a function which is written in python of the form
bar(**kwargs) which returns a value. This example does not return anything
Would you please
On Sunday, October 23, 2016 at 3:44:16 PM UTC-5, Thomas Nyberg wrote:
> On 10/23/2016 03:12 AM, pic8...@gmail.com wrote:
> > import multiprocessing as mp
> >
> > def bar(**kwargs):
> >for a in kwargs:
> > print a,kwargs[a]
> >
> > arguments={'name':'Joe','age':20}
> > p=mp.Pool(processes=
On 10/23/2016 03:12 AM, pic8...@gmail.com wrote:
import multiprocessing as mp
def bar(**kwargs):
for a in kwargs:
print a,kwargs[a]
arguments={'name':'Joe','age':20}
p=mp.Pool(processes=4)
p.map(bar,**arguments)
p.close()
p.join()
What are you trying to do? The map method is similar
import multiprocessing as mp
def bar(**kwargs):
for a in kwargs:
print a,kwargs[a]
arguments={'name':'Joe','age':20}
p=mp.Pool(processes=4)
p.map(bar,**arguments)
p.close()
p.join()
Errors:
Traceback (most recent call last):
File "post.py", line 9, in
p.map(bar,**arguments)
import multiprocessing as mp
def bar(**kwargs):
for a in kwargs:
print a,kwargs[a]
arguments={'name':'Joe','age':20}
p=mp.Pool(processes=4)
p.map(bar,**arguments)
p.close()
p.join()
Errors:
Traceback (most recent call last):
File "post.py", line 9, in
p.map(bar,**arguments)
Chris Rebert wrote:
>
>2. Glob/wildcard ("*") expansion is done by the shell, but
>subprocess.Popen does not use the shell by default (for good reason!).
This is only true in Linux. In Windows, the wildcard characters are passed
to the program, so each app must do its own glob expansion.
--
Tim
On 04/16/2013 08:14 AM, PEnergy wrote:
> Greetings,
>
> I am trying to write a python script that, when called from the DOS
> prompt, will call another python script and pass it input variables.
> My current code will open the other python script but doesn't seem to
> pass it any values:
>
> impo
On Tue, 16 Apr 2013 12:10:09 -0700, Chris Rebert wrote:
> On Tue, Apr 16, 2013 at 7:14 AM, PEnergy wrote:
>> Greetings,
>>
>> I am trying to write a python script that, when called from the DOS
>> prompt, will call another python script and pass it input variables.
>> My current code will open t
On Tue, Apr 16, 2013 at 7:14 AM, PEnergy wrote:
> Greetings,
>
> I am trying to write a python script that, when called from the DOS prompt,
> will call another python script and pass it input variables. My current code
> will open the other python script but doesn't seem to pass it any values:
Greetings,
I am trying to write a python script that, when called from the DOS prompt,
will call another python script and pass it input variables. My current code
will open the other python script but doesn't seem to pass it any values:
import os,sys,subprocess
subprocess.Popen(['python.exe',
Chris Rebert writes:
> Use the `subprocess` module instead (with shell=False). You then won't
> need to worry about escaping.
> http://docs.python.org/library/subprocess.html
You will still need to worry about escaping because on the remote end
you invoke ssh which is a shell. The obvious call:
Ismael Farfán writes:
> How about something like this:
> os.system ( 'ssh remoteuser@remote python remote.py "arg 1" "arg 2" "arg 3"' )
That won't work. You need an additional level of quoting because ssh is
also a shell so it adds another level of interpretation.
The following works:
os.syste
On Wed, Sep 19, 2012 at 12:50 PM, ashish wrote:
> 2. I have a python script, local.py, running on 'local' which needs to pass
> arguments ( 3/4 string arguments, containing whitespaces like spaces, etc )
> to a python script, remote.py running on 'remote' (the remote machine).
> 3. Has anybody
On 9/19/2012 12:50 PM ashish said...
Hi c.l.p folks
Here is my situation
1. I have two machines. Lets call them 'local' & 'remote'.
Both run ubuntu & both have python installed
2. I have a python script, local.py, running on 'local' which needs to pass
arguments ( 3/4 string arguments, contai
On Thursday, September 20, 2012 10:39:28 AM UTC+5:30, Chris Angelico wrote:
> On Thu, Sep 20, 2012 at 2:27 PM, Steven D'Aprano
>
> wrote:
>
> > On Wed, 19 Sep 2012 12:46:33 -0700, ashish wrote:
>
> >
>
> >> 2. I have a python script, local.py, running on local which needs to
>
> >> pass argum
On Thu, Sep 20, 2012 at 2:27 PM, Steven D'Aprano
wrote:
> On Wed, 19 Sep 2012 12:46:33 -0700, ashish wrote:
>
>> 2. I have a python script, local.py, running on local which needs to
>> pass arguments ( 3/4 string arguments, containing whitespaces like
>> spaces, etc ) to a python script, remote.py
On Wed, 19 Sep 2012 12:46:33 -0700, ashish wrote:
> Hi PyTutor Folks
>
> Here is my situation
>
> 1. I have two machines. Lets call them local & remote. Both run ubuntu &
> both have python installed
>
> 2. I have a python script, local.py, running on local which needs to
> pass arguments ( 3/4
ashish wrote:
>
>Here is my situation
>
>1. I have two machines. Lets call them 'local' & 'remote'.
>Both run ubuntu & both have python installed
>
>2. I have a python script, local.py, running on 'local' which needs to pass
>arguments ( 3/4 string arguments, containing whitespaces like spaces, et
2012/9/19 ashish :
> Hi c.l.p folks
>
> Here is my situation
>
> 1. I have two machines. Lets call them 'local' & 'remote'.
> Both run ubuntu & both have python installed
>
> 2. I have a python script, local.py, running on 'local' which needs to pass
> arguments ( 3/4 string arguments, containing
Hi c.l.p folks
Here is my situation
1. I have two machines. Lets call them 'local' & 'remote'.
Both run ubuntu & both have python installed
2. I have a python script, local.py, running on 'local' which needs to pass
arguments ( 3/4 string arguments, containing whitespaces like spaces, etc ) to
Hi PyTutor Folks
Here is my situation
1. I have two machines. Lets call them local & remote.
Both run ubuntu & both have python installed
2. I have a python script, local.py, running on local which needs to pass
arguments ( 3/4 string arguments, containing whitespaces like spaces, etc ) to
a p
Hi,
I am trying to figure out how to implement a QThread class that
will handle GUI event while keeping the GUI responsive.
I want to call thread's methods by their names and start() the
thread from inside that method.
My problem is with passing methods their arguments since
start() wont take any
Thanks for the help Peter.Its working fine now
--
http://mail.python.org/mailman/listinfo/python-list
gaurav kashyap wrote:
> HI all,
> i have two python programs as 1.py and 2.py
>
> 1.py
> import os
> import sys
> processID=os.spawnl(os.P_WAIT,'/usr/local/bin/python','python','/
> mywork/2.py ' + 'hi')
>
> 2.py
> import sys
> domain= str(sys.argv[1] )
> print domain
>
> IN LINUX
> while execu
HI all,
i have two python programs as 1.py and 2.py
1.py
import os
import sys
processID=os.spawnl(os.P_WAIT,'/usr/local/bin/python','python','/
mywork/2.py ' + 'hi')
2.py
import sys
domain= str(sys.argv[1] )
print domain
IN LINUX
while executing 1.py,the argument 'hi' is not passed to the 2.py a
On Mon, 25 Aug 2008 06:31:53 -0700 (PDT), Alexandru Mosoi wrote:
> i want to execute a python script using exec open('script.py'). how do
> I pass arguments?
Take a look at subprocess module. It comes with a set of examples.
--
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/
--
http://mail.pyth
i want to execute a python script using exec open('script.py'). how do
I pass arguments?
--
http://mail.python.org/mailman/listinfo/python-list
But if you couldn't find readily available confirmation of what you presumed
to be true, weren't the responses showing how you might come that answer
using the interpreter helpful, rather than harsh?
The Python interpreter is the shizzit.
On Mon, Jun 23, 2008 at 12:17 PM, John Dann <[EMAIL PROTECT
John Dann wrote:
... the answer might have been of the 'yes, but' kind.
Well, if you really care, there is a 'yes, but' answer, but it
only has to do with multiple inheritance, and hence is a bit
esoteric for the issues you are currently addressing.
This is not meant to be a tease; I think it w
Thanks for the responses - they're much appreciated. And I understand
the slight impatience with questions that could possibly be answered
without recourse to a forum - I'm usually in the opposite position of
fielding many newbie questions in a forum in a completely different
field!
But don't be t
John Dann wrote:
May I ask a simple newbie question, which I presume is true, but for
which I can't readily find confirmation:
Let's say I have a parent class with an __init__ method explicitly
defined:
class ParentClass(object):
def __init__(self, keyword1, keyword2):
e
John Dann a écrit :
May I ask a simple newbie question, which I presume is true, but for
which I can't readily find confirmation:
Let's say I have a parent class with an __init__ method explicitly
defined:
class ParentClass(object):
def __init__(self, keyword1, keyword2):
May I ask a simple newbie question, which I presume is true, but for
which I can't readily find confirmation:
Let's say I have a parent class with an __init__ method explicitly
defined:
class ParentClass(object):
def __init__(self, keyword1, keyword2):
etc
and I subclass
On Dec 15, 6:46 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Fri, 14 Dec 2007 16:38:28 -0800 (PST), [EMAIL PROTECTED] declaimed
> the following in comp.lang.python:
>
> > The executable runs, but no argument appears to get passed into it. Of
> > course, I don't really know that for sure as
On Dec 14, 8:06 pm, John Machin <[EMAIL PROTECTED]> wrote:
>
> > The executable runs,
>
> how do you know it runs?
>
because the program's GUI appears on-screen.
> > but no argument appears to get passed into it.
>
> appears??
>
Since the TO field doesn't get populated with the email addres
On Dec 15, 11:38 am, [EMAIL PROTECTED] wrote:
> On Dec 14, 4:51 pm, John Machin <[EMAIL PROTECTED]> wrote:
>
> > On Dec 15, 9:01 am, [EMAIL PROTECTED] wrote:
>
> > > I have created what amounts to a simple GUI email sending program
> > > using Python + wxPython. I have modified the mailto registrat
On Dec 14, 4:51 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Dec 15, 9:01 am, [EMAIL PROTECTED] wrote:
>
> > I have created what amounts to a simple GUI email sending program
> > using Python + wxPython. I have modified the mailto registration in
> > the Windows Registry so that it launches the
On Dec 15, 9:01 am, [EMAIL PROTECTED] wrote:
> I have created what amounts to a simple GUI email sending program
> using Python + wxPython. I have modified the mailto registration in
> the Windows Registry so that it launches the script when someone
> clicks on someone's email link in a web page.
>
I have created what amounts to a simple GUI email sending program
using Python + wxPython. I have modified the mailto registration in
the Windows Registry so that it launches the script when someone
clicks on someone's email link in a web page.
While this works great if I create a convoluted path
Tom Harris schrieb:
> Hi,
>
> Is there a way to pass arguments to TestCases when running tests? I have
> a test suite that need to be configured slightly differently for 3
> different products, and rather than do a hack I wondered if there was a
> canonical way to do it.
>
> I _know_ that py.t
Hi,
Is there a way to pass arguments to TestCases when running tests? I have
a test suite that need to be configured slightly differently for 3
different products, and rather than do a hack I wondered if there was a
canonical way to do it.
I _know_ that py.test can do it trivially. I am rather
that was the problem. when i manually reassociated the extension, i somehow
didnt quote the argument for the filename. my bad.
thanks for the various explanations and options for this :)
cheers.
2007/8/20, Gabriel Genellina <[EMAIL PROTECTED]>:
>
> En Sat, 18 Aug 2007 09:24:35 -0300, SHY <[EMAIL
En Sat, 18 Aug 2007 09:24:35 -0300, SHY <[EMAIL PROTECTED]> escribi�:
> theres no special portion of code, just the one that handles filenames
> with
> spaces.
> the problem is that when i associate a file extension to my application
> and
> i open it, the filename is not quoted before passed
Sorry for ignoring the thread.
> the problem is that when i associate a file extension to my application and
> i open it, the filename is not quoted before passed as an arguement. i dont
If it is not quoted by default, you can quote it explicit. If this be the case
where the filename is obtained
theres no special portion of code, just the one that handles filenames with
spaces.
the problem is that when i associate a file extension to my application and
i open it, the filename is not quoted before passed as an arguement. i dont
know if its the problem of windows or something, or it was just
O.R.Senthil Kumaran wrote:
>> Quote:D:\ftp\Music\Mixes & Compilations\Above & Beyond - Essential
>> Mix\001_Essential_Mix_2004-06-06_-_Above_and_Beyond.txt
>
>> when i put 'print sys.argv[1:]' at the very beginning of the script, all i
>> get is this:
>>
>> Quote:['D:\\ftp\\Music\\Mixes']
>>
> Can
> Quote:D:\ftp\Music\Mixes & Compilations\Above & Beyond - Essential
> Mix\001_Essential_Mix_2004-06-06_-_Above_and_Beyond.txt
> when i put 'print sys.argv[1:]' at the very beginning of the script, all i
> get is this:
>
> Quote:['D:\\ftp\\Music\\Mixes']
>
Can you share the portion of the code?
hey,
i have a win32 gui application that accepts filenames as arguments (either
via command line or via associating an extension to the application) which
are then opened in it. the problem is that as soon as the filename contains
characters like '&', the process fails at the very beginning (sys.
Great -- thanks! (and also to J. Ezequiel).
Mark T wrote:
"Eric Spaulding" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Is there an easy way to pass arguments to a handler class that is used by
the standard TCPServer?
normally --> srvr =SocketServer.TCPServer(('',port_num),
"Eric Spaulding" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there an easy way to pass arguments to a handler class that is used by
> the standard TCPServer?
>
> normally --> srvr =SocketServer.TCPServer(('',port_num), TCPHandlerClass)
>
> I'd like to be able to: srvr =Socke
On Jun 13, 10:19 pm, Eric Spaulding <[EMAIL PROTECTED]> wrote:
> Is there an easy way to pass arguments to a handler class that is used
> by the standard TCPServer?
>
> normally --> srvr =SocketServer.TCPServer(('',port_num), TCPHandlerClass)
>
> I'd like to be able to: srvr =SocketServer.TCPServer
Is there an easy way to pass arguments to a handler class that is used
by the standard TCPServer?
normally --> srvr =SocketServer.TCPServer(('',port_num), TCPHandlerClass)
I'd like to be able to: srvr =SocketServer.TCPServer(('',port_num),
TCPHandlerClass, (arg1,arg2))
And have arg1, arg2 avai
On Mar 19, 11:52 pm, Steven Bethard <[EMAIL PROTECTED]> wrote:
> Luis M. González wrote:
> > On Mar 19, 10:49 pm, "zacherates" <[EMAIL PROTECTED]> wrote:
> >> This implies that `os.system("setuppy py2exe")` should do what you
> >> want.
>
> > It works!
> > Thank you, this is just what I wanted.
>
>
Luis M. González wrote:
> On Mar 19, 10:49 pm, "zacherates" <[EMAIL PROTECTED]> wrote:
>> This implies that `os.system("setuppy py2exe")` should do what you
>> want.
>
> It works!
> Thank you, this is just what I wanted.
You'll get better error checking if instead you do::
>>> import subpro
2 module
> > > - the subprocess module - the most complete way, but simple enough for
> > > most cases.
>
> > > --
> > > Gabriel Genellina
>
> > I'm sorry, but still I can't figure out this...
> > Would you please show me a sample usa
plest way, but you don't have much control,
> > and it blocks until the process finishes.
> > - os.popen[234]? or the functions in the popen2 module
> > - the subprocess module - the most complete way, but simple enough for
> > most cases.
>
> > --
> > G
he popen2 module
> - the subprocess module - the most complete way, but simple enough for
> most cases.
>
> --
> Gabriel Genellina
I'm sorry, but still I can't figure out this...
Would you please show me a sample usage of os.system or os.popen for
passing argumen
En Mon, 19 Mar 2007 20:46:56 -0300, Luis M. González <[EMAIL PROTECTED]>
escribió:
> What I want now is execute the script I just created.
> As far as I know, the only way to execute the script is from a command
> line and typing "setup.py py2exe".
A few ways:
- os.system("commandline"). Simple
Please forgive me if what I'm asking is non sense...
I created a little program to authomate the creation of the "setup.py"
script for py2exe.
It simply prompts for the main executable script name and then creates
setup.py, as follows:
# this is "makesetup.py"
nombre = raw_input('File name?: ')
> It works fine when I 'Run Module'...but when I type in interactive mode
> in the Python Shell
python using_sys.py test1 test2 test3
>
> I get the following error:
> SyntaxError: invalid syntax
By using proper syntax... :*)
To pass parameters, you do it when *starting* python[*]. Thus,
New to Python ... this should be an easy question to answer.
INPUT
import sys
print 'The command line arguments are:'
for i in sys.argv:
print i
print '\nThe PYTHONPATH is', sys.path
OUTPUT
The command line arguments are:
C:\Python25\using_sys.py
The PYTHONPATH is ['C:\\Python25\\Lib\\idl
Problem solved. use 'command = Calc' to call my Calc function but ignore
the argument passed to it. Create a list with the following elements -
a.get(), b.get() and c.get(). Every time a scale slider is moved, Calc
will retrieve the current scale values and I can do with them whatever I
want...
Matt Hammond wrote:
>> A. Partial success with : command = Calc. A slider will now pass
>> its argument to a function without problem. My Calc function however
>> is expecting 3 arguments - 1 from each slider i.e moving any of the
>> 3 sliders should cause a recalculation. I am now gettin
> A. Partial success with : command = Calc. A slider will now pass its
> argument to a function without problem. My Calc function however is
> expecting 3 arguments - 1 from each slider i.e moving any of the 3
> sliders should cause a recalculation. I am now getting the following
> erro
Matt Hammond wrote:
> On Mon, 22 Aug 2005 12:16:01 +0100, m7b52000 <[EMAIL PROTECTED]>
> wrote:
>
>>> command = lambda : Calc(a.get())
>
>
>> I get the following message when I use lambda as above:
>>
>> TypeError: () takes no arguments (1 given)
>
>
> Oops, forgot! The Scale widget outp
On Mon, 22 Aug 2005 12:16:01 +0100, m7b52000 <[EMAIL PROTECTED]>
wrote:
>> command = lambda : Calc(a.get())
> I get the following message when I use lambda as above:
>
> TypeError: () takes no arguments (1 given)
Oops, forgot! The Scale widget outputs a single argument - the value of
the
Matt Hammond wrote:
> On Sun, 21 Aug 2005 08:09:55 +0100, m7b52000
> wrote:
>
>> It is proving most difficult in Python. How do I pass the .get()
>> values to my calculating function? Do I use the command option for
>> each slider? e.g command = Calc(a.get()). Obviously not cos it
>> doesn
On Sun, 21 Aug 2005 08:09:55 +0100, m7b52000
wrote:
> It is proving most difficult in Python. How do I pass the .get() values
> to my calculating function? Do I use the command option for each slider?
> e.g command = Calc(a.get()). Obviously not cos it doesn't work.
It should work if you w
Some time ago I wrote a little program in Tcl/Tk that took the values
from 3 sliders and performed a calculation using these values. The
calculation was of course automatically repeated each time a slider was
moved.
It is proving most difficult in Python. How do I pass the .get() values
to my
"Gregory Piñero" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>Ahh, so it's a mutable thing. That makes sense that I can't change a
>mutable object and thus can't affect it outside of the function.
You of course meant immutable, but this is still confused. It is a
name-binding
"Christopher Subich" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> Dennis Lee Bieber wrote:
>> In a more simplistic view, I'd reverse the phrasing... The name
>> "x" is assigned to the object "y" (implying it is no longer attached to
>> whatever used to have the name)
I agree tha
"Gregory Piñero" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> how references work in Python
'references' are an implementation detail and a metaconcept used to talk
about Python but are not part of the language spec itself.
> when passing a
Gregory Piñero wrote:
> So what if I do want to share a boolean variable like so:
Well, the easiest way is to wrap it in a list:
mybool = [True]
mybool[0] = False
mybool[0] = True
and so on.
Alternately, what is this boolean attached to that's so significant?
Sharing an arbitrary boolean, with
Thanks everyone. I understand now. Everything is a reference, all
that matters is whether I can go inside the "cubbyhole" and change
something. Immutables don't allow this.
So what if I do want to share a boolean variable like so:
sharedbool=True
class cls1:pass
cl=cls1()
cl.sharedbool1=shared
Christopher Subich wrote:
> Rocco Moretti wrote:
>
>> Variables in Python are names. They aren't the cubbyholes into which
>> you put values, they are sticky notes on the front of the cubby hole.
>
>
> +1 MOTW (Metaphor of the Week)
Thanks, but please note it's not really mine - I've seen it s
Dennis Lee Bieber wrote:
> On Tue, 09 Aug 2005 10:39:29 -0500, Rocco Moretti
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
>
>>Change it to "the object referenced by y is assigned to the name of x",
>>and you're closer to the truth.
>
> In a more simplistic view, I'
Rocco Moretti wrote:
> Variables in Python are names. They aren't the cubbyholes into which you
> put values, they are sticky notes on the front of the cubby hole.
+1 MOTW (Metaphor of the Week)
--
http://mail.python.org/mailman/listinfo/python-list
infidel wrote:
>>in Python equality rebinds the name
>
>
> Assignment (=) rebinds the name. Equality (==) is something else
> entirely.
Good catch. I was thinking of it as the "equals" operator.
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wrote:
> In a more simplistic view, I'd reverse the phrasing... The name
> "x" is assigned to the object "y" (implying it is no longer attached to
> whatever used to have the name)
No, because that'd imply that the object 'y' somehow keeps track of the
names assigned to it
Gregory Piñero wrote:
> Ahh, so it's a mutable thing. That makes sense that I can't change a
> mutable object and thus can't affect it outside of the function.
If you meant "immutable" for the second mutable, you're right.
> Does
> that mean Python functions aren't always byref, but are someti
> Does that mean Python functions aren't always byref,
> but are sometimes byval for nonmutables?
Don't think of it as byref or byval (as they are used in Visual Basic).
All parameters are passed the same way: by reference instead of by copy.
It's a little difficult to get your head around, but
EMAIL PROTECTED]> wrote:
> On Tue, 9 Aug 2005 10:53:15 -0400, Gregory Piñero <[EMAIL PROTECTED] >
> declaimed the following in comp.lang.python:
>
> Is this the third time this week that this has come
> up?
>
> > Hey guys, would someone mind giving me a quick r
> in Python equality rebinds the name
Assignment (=) rebinds the name. Equality (==) is something else
entirely.
--
http://mail.python.org/mailman/listinfo/python-list
Christopher Subich wrote:
> Gregory Piñero wrote:
>
>> Hey guys, would someone mind giving me a quick rundown of how
>> references work in Python when passing arguments into functions? The
>> code below should highlight my specific confusion:
This URL is
Gregory Piñero wrote:
> Hey guys, would someone mind giving me a quick rundown of how
> references work in Python when passing arguments into functions? The
> code below should highlight my specific confusion:
All arguments are passed by reference, but in Python equality rebinds
Hey guys, would someone mind giving me a quick rundown of how
references work in Python when passing arguments into functions? The
code below should highlight my specific confusion:
bool1=True
lst1=[1,2,3]
def func1(arg1): arg1.append(4)
def func2(arg1): arg1=False
>>func1(lst1)
Hello,
thank you very much for all your help. I have solved the problem - you
guys where right, the problem was some where else.
I have another class which got an accessor:
def getCenter(self):
global center
return center
and I called it by saying n.getCenter, but this returns:
Is getCenter a function? If so, you need to invoke distance using:
dist = self.distance( n.getCenter(), newElement )
Of course, that is assuming that newElement is a local variable of type
list/tuple/etc.
-- Paul
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 10 Jul 2005 11:19:31 +0100, Philipp H. Mohr wrote:
> Hello,
> I got a newbie question, I have written the following distance function:
Great. Now, how about you tell us what you expect it to do? I assume
it calculates the Euclidean distance between two points. (If you
don't know what Eucl
"Philipp H. Mohr" <[EMAIL PROTECTED]> wrote:
> Hello,
> I got a newbie question, I have written the following distance function:
>
> def distance(self,element1, element2):
> dist = 0
>
> for n in range(len(element1)):
> dist = dist + pow((element1[n] - element2[n]),2)
>
(You posted your question as a followup to oen of Xah Lee's musings.
That is not the best of ideas, since people with threaded newsreaders
tend not to see it. Just post (creating a new thread) next time.)
On Sun, 10 Jul 2005 11:19:31 +0100 (BST), Philipp H. Mohr <[EMAIL PROTECTED]>
wrote:
> Hello
Hello,
I got a newbie question, I have written the following distance function:
def distance(self,element1, element2):
dist = 0
for n in range(len(element1)):
dist = dist + pow((element1[n] - element2[n]),2)
print 'dist' + dist
return sqrt(dist)
and i
Steve Holden wrote:
> Steven Bethard wrote:
>>
>> Also possible, to guarantee that exactly one argument was given:
>>
>> try:
>>arg1, = sys.argv
>> except ValueError:
>>print "This script takes an argument, you boob!"
>>sys.exit(1)
>>
> Aren't we forgetting argv[0] here
Oops. Yup. Ch
Dennis Lee Bieber wrote:
> On Sun, 22 May 2005 16:12:06 -0400, Steve Holden <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
>
>>Aren't we forgetting argv[0] here, or am I overlooking something (like,
>>you chopped it off without telling me?)?
>>
>
> argv[0] is ofte
Steven Bethard wrote:
> James Stroud wrote:
>
>>import sys
>>
>>try:
>> arg1 = sys.argv[1]
>>except IndexError:
>> print "This script takes an argument, you boob!"
>> sys.exit(1)
>
>
> Also possible, to guarantee that exactly one argument was given:
>
> try:
>arg1, = sys.argv
> except Va
Hi,
look at sys.argv
Regards,
Philippe
Jeff Elkins wrote:
> I'm sure this is obvious, but how the heck do pass an argument(s) to a
> python script from the command line?
>
> Thanks,
>
> Jeff Elkins
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 109 matches
Mail list logo