Dennis Lee Bieber wrote:
On Thu, 02 Jun 2005 16:12:44 +0900, Mark Sargent
[EMAIL PROTECTED] declaimed the following in
comp.lang.python:
How do I get that x to be an integer b4 it is entered into the indice.?
Cheers.
If you really want the index, ask for the index...
hc
Fredrik Lundh wrote:
Elliot Temple wrote:
btw hotcat[:] is a *copy* of hotcat, so just leave out [:]
when you want to modify the thing you're looping over, you need
to be careful. looping over a copy is often a good idea (see the
Python tutorial and the FAQ for more on this).
flupke wrote:
snip
Thanks for the good ideas people.
Regards,
Benedict
--
http://mail.python.org/mailman/listinfo/python-list
i want to trunkate 199.999 to 199.99
getcontext.prec = 2 isn't what i'm after either, all that does
is E's the value. do i really have to use floats to do this?
The precision is the total number of digits (i.e 199.99 has 5 digit
precision). Either round to that precision level or use the
Hi,
I'm writing a simple shell using cmd.Cmd. It would be very usefull if I
could read the commands as batchjob from a file. I've tried the following:
class MyShell(cmd.Cmd):
def __init__(self,stdin):
cmd.Cmd.__init__(self,stdin=stdin)
...
...
if
kosuke [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
man python ---
COMMAND LINE OPTIONS
This should REALLY be on the doc page of the Python site. I remember
asking for this about 7 years ago and being ridiculed for only having
Windows. It is really time to stop pretending
After entering the interpreter, you could do an execfile on the
.pythonrc file.
--
http://mail.python.org/mailman/listinfo/python-list
MM wrote:
Are there any other odbc packages other than the win32all and mxodbc
ones? The win32all odbc.pyd can't access table structure info like
SQLColumns, and mxobdc requires a commercial license which is
unjustifiable for this tiny project. Any other OS alternatives for
win32?. Thanks.
Achim Domma (Procoders) wrote:
I'm writing a simple shell using cmd.Cmd. It would be very usefull if I
could read the commands as batchjob from a file. I've tried the following:
class MyShell(cmd.Cmd):
def __init__(self,stdin):
cmd.Cmd.__init__(self,stdin=stdin)
...
Hello,
I am having trouble with putting the source for a program I am working on in different directories.
I have the directories set up like this:
dir1
dir2
dir3
I want the source in dir2 to be able to import from the source in
dir3(is this possible). I get import errors when I tried doing
Hi People !
Just something which will be a simple answer for someone .
With an interactive python script, sometimes it seems necessary to
clear the terminal in order to provide a clear presentation to users
With Bash then we just do a 'clear' statement but this does not seem to
work well in
I never thought id need help with such a thing as time formatting
(admittadly i never did it before) but ok, i guess there is a first for
everything.
I have a float variable representing seconds, and i want to format it
like this:
0:00:00 (h:mm:ss)
Now search as I might i am finding this quite
On 3 Jun 2005 01:21:04 -0700, Prema [EMAIL PROTECTED] wrote:
Just something which will be a simple answer for someone .
With an interactive python script, sometimes it seems necessary to
clear the terminal in order to provide a clear presentation to users
With Bash then we just do a
Achim Domma (Procoders) wrote:
I'm writing a simple shell using cmd.Cmd. It would be very usefull if I
could read the commands as batchjob from a file. I've tried the following:
[...]
Your original approach should work too if you clear the use_rawinput flag
and provide a do_EOF() method that
Greg Ewing wrote:
Taki Jeden wrote:
class view_tree_model(gtk.GenericTreeModel,gtk.TreeSortable):
raises a TypeError: multiple bases have instance lay-out conflict
Is this a bug in gtk, or python-gtk, or something?
It's not a bug, it's a limitation of the way Python
handles
thanks for your input...
well I just find out that modifying environment through ksh call is not
possible (can't get the new evironment back to python). I think the
best thing to do is to translate all my ksh to pure python... I thought
that I could re-use some stufff, but I guest I'm going to
Giles Brown schrieb:
MM wrote:
Are there any other odbc packages other than the win32all and mxodbc
ones? The win32all odbc.pyd can't access table structure info like
SQLColumns, and mxobdc requires a commercial license which is
unjustifiable for this tiny project. Any other OS alternatives for
infidel wrote:
Ok, forget everything I've said. The more I think about this the less
I understand it. I'm way out of my league here.
sitting-down-and-shutting-up-ly y'rs,
Well, that's a sign of maturity right there ;-)
some-people-just-don't-know-when-to-ly y'rs - steve
--
Steve
[EMAIL PROTECTED] wrote:
Jeff_Relf wrote:
As I've told you a quintillion times, Earthlink's insanity aside,
Win_XP is a virtual network, quite indepent of the connection used.
Linux is hardly an OS, it's just a kernel.
The world doesn't need a 'virtual network'...it needs an Internet
M1st0 [EMAIL PROTECTED] writes:
I hope that here is the right place for this kind of discussion.
There's a new mailing list [EMAIL PROTECTED] which is probably
more appropriate for specifics, but this list is probably OK for
general discussion.
Cheers,
mwh
--
Solaris: Shire horse that
* Cameron Laird (2005-06-02 18:08 +0100)
In article [EMAIL PROTECTED],
Donn Cave [EMAIL PROTECTED] wrote:
Meanwhile, it might be worthwhile to reconsider the use
of ksh here, if you have any choice in the matter. Ksh
is fine for interactive use, but has some unfortunate
flaws as a programming
You should read the metaclass book, if you can find it.
For the reference, see
http://www-106.ibm.com/developerworks/linux/library/l-pymeta.html
http://www-128.ibm.com/developerworks/linux/library/l-pymeta2/index.html
Michele Simionato
--
Terry Reedy wrote:
kosuke [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
man python ---
COMMAND LINE OPTIONS
This should REALLY be on the doc page of the Python site.
Hear, hear! I never even knew this existed!
Where should it go in the docs? In the Language Reference or
Reinhold Birkenfeld [EMAIL PROTECTED] wrote in
message news:[EMAIL PROTECTED]
Peter Hansen wrote:
Reinhold Birkenfeld wrote:
He is speaking of Decimals...
d = Decimal(199.999)
d._round(5, decimal.ROUND_DOWN)
Is one really supposed to call the underscore methods like that?
Umm...
-Original Message-
From: Ognjen Bezanov [mailto:[EMAIL PROTECTED]
Sent: 03 June 2005 09:30
To: python-list@python.org
Subject: Formatting Time
I never thought id need help with such a thing as time
formatting (admittadly i never did it before) but ok, i guess
there is a first for
quoth the Ognjen Bezanov:
I never thought id need help with such a thing as time formatting
(admittadly i never did it before) but ok, i guess there is a first for
everything.
I have a float variable representing seconds, and i want to format it
like this:
0:00:00 (h:mm:ss)
Now search
John Machin wrote:
Michael Hoffman wrote:
Terry Reedy wrote:
c) Check to see if Python has a startup option for suppressing warnings
As to c) python -h gives a list indicating what I thought, that -W
controls warnings, but gives insufficient info for me to use it, and
I didn't find any
Hello everyone,
I'm trying to do something in C calling Python and its failing. I'd be
grateful if you could take a look and hopefully you have an answer.
What I'm trying to do is determine the address of the collect function
in the gc module. I want to do this so that we can determine when a
Title: Message
Good
Morning
I have scoured the
internet looking for an Python SFTP API. So far, I have been unable to find a
suitable answer. Our needs are pretty basic. FTP TELNET are being removed
from our environment and I need to utilize SFTP for file
transfers.
As is probably said
Robert Kern wrote:
Greg Ewing wrote:
[about the from xxx import * syntax]
Better still, don't even *mention* it to a beginner.
They don't need to know about it. At all. Really.
Well, the OP's use is precisely why from xxx import * exists: the
interactive prompt.
In that case (and, really,
Kornfeld Rick (sys1rak) wrote:
Good Morning
I have scoured the internet looking for an Python SFTP API. So far, I
have been unable to find a suitable answer. Our needs are pretty basic.
FTP TELNET are being removed from our environment and I need to
utilize SFTP for file transfers.
chris wrote:
I'm new to Python ... and I've used decimal._round() as above. What's the
deal with using underscore methods? (A link will do if that'll save you some
typing).
Generally the underscore methods provide *internal* functionality that
might be used by other, more externally
In message [EMAIL PROTECTED], Stephen Kellett
[EMAIL PROTECTED] writes
Following my posting with the solution for anyone else that wants to
know the answer.
The solution appears to be not to use:
module = PyImport_AddModule(gc);
But to use
module = PyImport_ImportModule(gc);
Stephen
The best way depends on how you have structured your program. From
what you've told I believe that setting the directories like
dir1
dir2
dir3
is a good approach.
As for the import errors you're getting, check this section from the tutorial:
Hello Python World!
I've been playing with the 'wave' and 'audioop' modules in the library,
and I have a question. When I tried to read a wav file with samples
in 32-bit float, I got the following error:
Traceback (most recent call last):
File Play.py, line 111, in ?
playWAV(sys.argv[1])
I was wondering if there is already some 'official' module for round robin
arrays. Of course, it is relatively easy to implement your own if you need it,
but IMHO it feels like there should be one, because they are so
general-purpose.
Here's my implementation, if someone needs one. If there are
Hi,
I try to install two Python environments on my platform: one in release,
the other in debug.
I generate the RELEASE Python environment with the following instructions :
./configure --prefix=/usr/local/python --enable-shared
make
My problem is here : all the source files are
Skip Montanaro wrote:
Glade is fine for building Gtk user interfaces. I have no idea if there are
similar tools for other widget sets, though I wouldn't be surprised if such
tools existed. Once the GUI is fairly stable, most of the development after
that occurs in the underlying functional
[mg]
My problem is here : all the source files are compiled with the -g
flag which might be the debug flag. (On the other hand, the option
-DNDEBUG is defined : it's normal !) Then my question is : Is exist
a flag/option to run the shell script named 'configure' allowing to
remove the '-g'
Yes,
but we don't want it to get out of hand, like calling it orgy() instead of join().
Or condom() instead of secure().
Or onClimax() instead of onFinished()
:-)On 5/31/05, Eric Pederson [EMAIL PROTECTED] wrote:
I often can't remember that to remove spaces from a string whether it's strip() or
Hallchen!
When I add a warning filter with warnings.filterwarnings, how can I
get rid of it? I've read about resetwarnings(), but it removes all
filters, even those that I didn't install in a certain function.
In particular, I want to transform one special form of warning in an
exception to
Am Fri, 03 Jun 2005 09:29:41 +0100 schrieb Ognjen Bezanov:
I never thought id need help with such a thing as time formatting
(admittadly i never did it before) but ok, i guess there is a first for
everything.
I have a float variable representing seconds, and i want to format it
like this:
Could you please expand the BLT acronym. For
the life of me, the only thing I associate it with is
a Bacon, Lettuce and Tomato sandwich, and I'm
sure that's not what you meant.
John Roth
Lyddall's [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hello.
I am new to this list, but
On MS Windows, I am trying to find out a good default location to
save some temporary files.
The tempfile module seemed to have exactly what I wanted:
import tempfile
tempfile.gettempdir()
'c:\\docume~1\\admini~1\\locals~1\\temp'
My problem (entirely cosmetic, but still) is that I also need
[Leo Breebaart]
|
| On MS Windows, I am trying to find out a good default location to
| save some temporary files.
|
| The tempfile module seemed to have exactly what I wanted:
|
| import tempfile
| tempfile.gettempdir()
| 'c:\\docume~1\\admini~1\\locals~1\\temp'
|
|
| My problem (entirely
| [Leo Breebaart]
| |
| | On MS Windows, I am trying to find out a good default location to
| | save some temporary files.
| |
| | The tempfile module seemed to have exactly what I wanted:
| |
| | import tempfile
| | tempfile.gettempdir()
| | 'c:\\docume~1\\admini~1\\locals~1\\temp'
| |
| |
Coates, Steve (ACHE) wrote:
import time
t=36100.0
time.strftime('%H:%M:%S',time.gmtime(t))
'10:01:40'
But if t=24*60*60 then H cycles back to 0
import time
t=24*60*60
time.strftime('%H:%M:%S',time.gmtime(t))
'00:00:00'
Andrew
Hey,
Can I convert an xml.dom.Node object to an xml.dom.Element object? I
want to do the conversion inside a condition like this:
if node.nodeType == Node.ELEMENT_NODE:
# do conversion:
element = Element(node)
element = node.toElement()
so it definitely won't cause problems. I just
Hi,
Because of I have patched Python, I would like to create a Windows
installer containing my patched-Python. So, I try to use the option
'bdist_wininst' on the setup.py file distributed by python it is
supported ?
If yes, I have a problem : the run tell me that pyconfig.h does not
Hang on!
It *knows*! Wow, you can call getElementsByTagName() on a Node object
and it does the right thing.
Weird, but I like it! Very Python!
R.
On Fri, 03 Jun 2005 17:07:37 +0100, Richard Lewis
[EMAIL PROTECTED] said:
Hey,
Can I convert an xml.dom.Node object to an xml.dom.Element object?
I've got a couple of new articles on ONLamp:
Writing Google Desktop Search Plugins
http://www.onlamp.com/pub/a/python/2005/06/01/kongulo.html
and
Python Standard Logging
http://www.onlamp.com/pub/a/python/2005/06/02/logging.html
Comments, criticisms, flames all welcome.
Jeremy Jones
--
First, I compiled Python in DEBUG on Win32 with MSCV.net and the
solution distributed in the Python packages.
Second, I try to compiled NUMARRAY with my python debug :
python_d setup.py build
And the compilation crash with the following message : the file
python25.lib does not exist
MM wrote:
Are there any other odbc packages other than the win32all and mxodbc
ones? The win32all odbc.pyd can't access table structure info like
SQLColumns, and mxobdc requires a commercial license which is
unjustifiable for this tiny project. Any other OS alternatives for
win32?.
It's been a while since I've experimented with Condor, but it looks
like 'Access is denied.', You might want to figure out what user
the condor service is running as and log in as that user and try to run
your code.
--
http://mail.python.org/mailman/listinfo/python-list
Is the first meeting on June 6th, I only ask due to short notice.
If so I'll be there.
--
http://mail.python.org/mailman/listinfo/python-list
Here is the complete traceback..sorry about that though.
I used the run button and entered in C:\email.txt for the msgfile
parameter thats used for input
This email.txt file has a zip file attached to it and is all in text,
so hopefully I am working with the correct input file. I used the pop3
Jeremy Jones [EMAIL PROTECTED] writes:
I've got a couple of new articles on ONLamp:
Writing Google Desktop Search Plugins
http://www.onlamp.com/pub/a/python/2005/06/01/kongulo.html
and
Python Standard Logging
http://www.onlamp.com/pub/a/python/2005/06/02/logging.html
Comments,
Kent Johnson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Terry Reedy wrote:
kosuke [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
man python ---
COMMAND LINE OPTIONS
This should REALLY be on the doc page of the Python site.
Hear, hear! I never even knew this
Jeremy Jones [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I've got a couple of new articles on ONLamp:
Writing Google Desktop Search Plugins
http://www.onlamp.com/pub/a/python/2005/06/01/kongulo.html
Wow, another use for Python. I should get this. Thanks.
I would add the
J Correia wrote:
Elliot Temple [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
How do I make Python press a button on a webpage? I looked at
urllib, but I only see how to open a URL with that. I searched
google but no luck.
For example, google has a button input type=submit
Olivier Favre-Simon [EMAIL PROTECTED] writes:
[...]
I'd like to have a reimplementation of ClientForm on top of something
like BeautifulSoup...
John
When taken separately, either ClientForm, HTMLParser or SGMLParser work
well.
But it would be cool that competent people in the
[Michele Simionato]
I would like to know what is available for scripting browsers from
Python.
[...]
to do POST requests too. I don't want to use urllib to emulate a
browser, I am
interested in checking that browser X really works as intended with my
application. Any suggestion?
[...]
I'm happy to announce the release of Snakelets 1.41 and
at the same time Frog 1.6.
Snakelets is a Python web application server. This project provides a threaded
web
server, Ypages (HTML+Python language, similar to Java's JSPs) and Snakelets:
code-centric page request handlers (similar to
Paul Rubin wrote:
Any suggestions for the cleanest way to get rid of the thread?
As Jeff explains, it is rather unlikely that GC will collect
primegen objects, since the generating thread holds self as
a local variable.
You should make background_generator have explicit q and
event arguments,
I never thought id need help with such a thing as time formatting
(admittadly i never did it before) but ok, i guess there is a first for
everything.
I have a float variable representing seconds, and i want to format it
like this:
0:00:00 (h:mm:ss)
Now search as I might i am finding this quite
i want to use mod_python with Apache2 and i made a .htaccess in the
subdirectory where i have all my scripts:
The .htacces goes like this:
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
and I changed the main configuracion file of Apache2 like this:
#--memepelle
Directory
Guido van Rossum wrote:
After many rounds of discussion on python-dev, I'm inviting public
comments for PEP 343. Rather than posting the entire PEP text here,
I'm inviting everyone to read it on line
(http://www.python.org/peps/pep-0343.html) and then post comments on a
Wiki page I've created
The Rise of Inheritance
In well-thought-out languages, functions can have inner functions, as
well as taking other functions as input and return function as output.
Here are some examples illustrating the use of such facilities:
subroutine generatePower(n) {
return subroutine (x) {return x^n};
On Fri, Jun 03, 2005 at 01:16:17PM -0600, Manuel Pellecer wrote:
i want to use mod_python with Apache2 and i made a .htaccess in the
subdirectory where i have all my scripts:
The .htacces goes like this:
AddHandler mod_python .py
PythonHandler mptest
PythonDebug On
Try adding the
Is there already any software out there to manage a Python Interest
Group? Something that can register users, take RSVPs for meetings,
etc.
--
David Stanek
www.roninds.net
GPG keyID #6272EDAF on http://pgp.mit.edu
Key fingerprint = 8BAA 7E11 8856 E148 6833 655A 92E2 3E00 6272 EDAF
David Is there already any software out there to manage a Python
David Interest Group? Something that can register users, take RSVPs for
David meetings, etc.
I suspect a fair number take advantage of meetup.com.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Try upcoming.org. In addition to the Web interface, they also offer a
REST-ful API that you can use from your own app.
Grig
--
http://mail.python.org/mailman/listinfo/python-list
Nicolas Fleury wrote:
What about making the ':' optional (and end implicitly at end of current
block) to avoid over-indentation?
def foo():
with locking(someMutex)
with opening(readFilename) as input
with opening(writeFilename) as output
...
would be equivalent to:
David Stanek wrote:
Is there already any software out there to manage a Python Interest
Group? Something that can register users, take RSVPs for meetings,
etc.
I dare say that Roundup - http://roundup.sourceforge.net/ - (not to be
confused with Roundup - http://www.roundup.com/ ) - could be
Skip Montanaro wrote:
David Is there already any software out there to manage a Python
David Interest Group? Something that can register users, take RSVPs for
David meetings, etc.
I suspect a fair number take advantage of meetup.com.
And a fair number of people now suspect
David Is there already any software out there to manage a Python
David Interest Group? Something that can register users, take RSVPs
for
David meetings, etc.
I suspect a fair number take advantage of meetup.com.
Skip
The original group did use meetup.com. I'm not too fond
I want to get the name of the function from within the function. Something
like:
def myFunc():
print __myname__
myFunc()
'myFunc'
Really what I want to do is to easily strip off the prefix of a function
name and call another function. Like this:
def prefix_myFunc(a, b, c):
name =
In article [EMAIL PROTECTED],
Thorsten Kampe [EMAIL PROTECTED] wrote:
* Cameron Laird (2005-06-02 18:08 +0100)
In article [EMAIL PROTECTED],
Donn Cave [EMAIL PROTECTED] wrote:
Meanwhile, it might be worthwhile to reconsider the use
of ksh here, if you have any choice in the matter. Ksh
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
thanks for your input...
well I just find out that modifying environment through ksh call is not
possible (can't get the new evironment back to python). I think the
best thing to do is to translate all my ksh to pure python... I thought
Esben Pedersen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
How do i know which methods the ie object has? dir(ie) doesn't show
Navigate.
For ie object:
http://msdn.microsoft.com/workshop/browser/webbrowser/reference/ifaces/IWebBrowser2/IWebBrowser2.asp
For document object:
posted mailed
Paul McGuire wrote:
we just recently on
this forum had someone ask about polymorphism when what they really
meant was overloaded method signatures. (It is even more unfortunate
that language features such as overloaded method signatures and
operator overloading get equated
Maurice LING [EMAIL PROTECTED] writes:
Just a philosophical check here. When a program is distributed, is it
more appropriate to provide as much of the required 3rd party
libraries, like SOAPpy, PLY etc etc, in the distribution itself or it
is the installer's onus to get that part done?
If
Getting mod_python to work is hard because there are many things to get
into account.
Your Apache version should match the proper mod_python version, as well
as the python version amd so on...
If you are having many problems, I suggest installing Apache2Triad,
which is a package that will install
Christopher J. Bottaro wrote:
I want to get the name of the function from within the function. Something
like:
def myFunc():
print __myname__
myFunc()
'myFunc'
There's not a really good way to do this. Can you give some more detail
on what exactly you're trying to do here?
Andrew Dalke wrote:
def foo():
with locking(someMutex)
with opening(readFilename) as input
with opening(writeFilename) as output
...
Nothing in Python ends at the end of the current block.
They only end with the scope exits. The order of deletion
Steven Bethard wrote:
Christopher J. Bottaro wrote:
I want to get the name of the function from within the function.
Something like:
def myFunc():
print __myname__
myFunc()
'myFunc'
There's not a really good way to do this. Can you give some more detail
on what exactly you're
Fernando M. wrote:
Hi,
i was just wondering about the need to put self as the first
parameter in every method a class has because, if it's always needed,
why the obligation to write it? couldn't it be implicit?
Or is it a special reason for this being this way?
Thanks.
Here's how I
Does anybody know how to control the source IP address (IPv4) when
using the urllib2 library? I have a Linux box with several IP
addresses in the same subnet, and I want to simulate several
individuals within that subnet accessing web pages independently. I
need the functionality of urllib2
Christopher J. Bottaro wrote:
Basically I want to wrap every function in try/except automatically.
Simplest way to do that would be something like:
def wrapFunction(func):
def wrapper(*args, **kargs):
try:
return func(*args, **kargs)
except Exception, e:
I'm a beginner as well, and I liked this one:
http://docs.python.org/tut/tut.html
But I ended up buying the Learning Python book anyway.
--
http://mail.python.org/mailman/listinfo/python-list
Xah Lee wrote:
to be continued tomorrow.
Please don't...
mkb.
--
http://mail.python.org/mailman/listinfo/python-list
Torsten Bronger wrote:
When I add a warning filter with warnings.filterwarnings, how can I
get rid of it? I've read about resetwarnings(), but it removes all
filters, even those that I didn't install in a certain function.
I have never used this module, but judging by a quick glance of the
Christopher J. Bottaro wrote:
Basically I want to wrap every function in try/except automatically.
[snip]
every function (err, method) is enclosed in the exact
same try/except error handling code. Everytime I make a new function, I
copy/paste that try/catch block.
Yes, has's suggestion is
Terry Reedy wrote:
Kent Johnson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Terry Reedy wrote:
kosuke [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
man python ---
COMMAND LINE OPTIONS
This should REALLY be on the doc page of the Python site.
Hear, hear! I
David Stanek wrote:
On Fri, Jun 03, 2005 at 01:16:17PM -0600, Manuel Pellecer wrote:
i want to use mod_python with Apache2 and i made a .htaccess in the
subdirectory where i have all my scripts:
The .htacces goes like this:
AddHandler mod_python .py
PythonHandler mptest
zzz wrote:
May I know where is the good website for Python tutorial? Many thanks.
How about...the Python website? (www.python.org) Google is also a good
place to find a great multitude of things, including Python Tutorials.
--
http://mail.python.org/mailman/listinfo/python-list
I want to write a function, foo, so the following works:
def main():
n = 4
foo(n)
print n
#it prints 7
if foo needs to take different arguments, that'd be alright.
Is this possible?
I already tried this (below), which doesn't work. foo only changes
the global n.
n = 3
Elliot Temple wrote:
I want to write a function, foo, so the following works:
def main():
n = 4
foo(n)
print n
#it prints 7
What's wrong with:
def foo(n):
return 7
def main():
n = 4
n = foo(n)
print n
Anything else (including the tricks involving mutable
On Jun 4, 2005, at 2:13 AM, Leif K-Brooks wrote:
Elliot Temple wrote:
I want to write a function, foo, so the following works:
def main():
n = 4
foo(n)
print n
#it prints 7
What's wrong with:
def foo(n):
return 7
def main():
n = 4
n = foo(n)
print
Elliot Temple wrote:
Nothing is wrong with it in this case. I just want to know if Python
can do what I said.
With a number of difficult hacks, yes. Passing around objects as
namespaces, however, is vastly easier and far superior.
--
Robert Kern
[EMAIL PROTECTED]
In the fields of hell
1 - 100 of 120 matches
Mail list logo