On Tue, Oct 20, 2009 at 16:25, Aahz a...@pythoncraft.com wrote:
In article mailman.1745.1256065337.2807.python-l...@python.org,
J dreadpiratej...@gmail.com wrote:
The tuple thing is a new concept to me... at least the vocabulary is,
I'll go look that up now and learn info on tuples. It's been
Dennis Lee Bieber wrote:
On Mon, 03 Aug 2009 23:00:13 -0400, Dave Angel da...@ieee.org
declaimed the following in gmane.comp.python.general:
To throw away the result of an expression in Python is even easier.
Just don't use it.
func1() and func2()
is a valid expression whose result
On Aug 3, 11:00 pm, Dave Angel da...@ieee.org wrote:
Simon wrote:
On Aug 2, 5:51 am, Dave Angel da...@ieee.org wrote:
snip
I don't understand your comparison to Foxpro. read on.
As your code was last posted, you don't need a return value from
init_Exec() Every function that doesn't
On Aug 2, 5:51 am, Dave Angel da...@ieee.org wrote:
Simon wrote:
Okay I will fix my code and include self and see what happens. I
know I tried that before and got another error which I suspect was
another newbie error.
The idea behind the init_Pre is that I can put custom code here to
Simon wrote:
On Aug 2, 5:51 am, Dave Angel da...@ieee.org wrote:
snip
I don't understand your comparison to Foxpro. read on.
As your code was last posted, you don't need a return value from
init_Exec() Every function that doesn't have an explicit return will
return None. And None is
Simon wrote:
Okay I will fix my code and include self and see what happens. I
know I tried that before and got another error which I suspect was
another newbie error.
The idea behind the init_Pre is that I can put custom code here to
customize the __init__ instead of creating a new subclass.
Nat Williams wrote:
As MRAB described, ALL instance methods need to accept 'self' as a first
parameter, as that will be passed to them implicitly when they are called.
This includes __init__. The name 'self' is just a commonly accepted
convention for the name of the instance object passed to
Okay I will fix my code and include self and see what happens. I
know I tried that before and got another error which I suspect was
another newbie error.
The idea behind the init_Pre is that I can put custom code here to
customize the __init__ instead of creating a new subclass. This kind
of
Hi
I want to create an instance of dcCursor which inherits from
dcObject. When I run the following code it gives the error shown.
Can some explain to me what is wrong? I have included the dcObject.py
and dcCursor.py below.
import dcObject
import dcCursor
x = dcCursor.dcCursor()
Traceback
Simon wrote:
Hi
I want to create an instance of dcCursor which inherits from
dcObject. When I run the following code it gives the error shown.
Can some explain to me what is wrong? I have included the dcObject.py
and dcCursor.py below.
import dcObject
import dcCursor
x = dcCursor.dcCursor()
Hi
So should the dcObject class include the self as well since I have
not defined an __init__ method in dcCursor?
Simon
--
http://mail.python.org/mailman/listinfo/python-list
As MRAB described, ALL instance methods need to accept 'self' as a first
parameter, as that will be passed to them implicitly when they are called.
This includes __init__. The name 'self' is just a commonly accepted
convention for the name of the instance object passed to methods. You don't
have
En Fri, 31 Jul 2009 22:53:47 -0300, Simon dciphercomput...@gmail.com
escribió:
So should the dcObject class include the self as well since I have
not defined an __init__ method in dcCursor?
Every method that you define takes self as its first argument.
Every method that you want to call on
En Sat, 01 Aug 2009 00:13:05 -0300, Nat Williams nat.willi...@gmail.com
escribió:
One other thing. I'm a little confused by the first line of
dcObject.__init__:
self.init_Pre() and self.init_Exec()
I suspect this does not do what you think it does. init_Pre and
init_Exec
will both be
I'm trying to run a command (arch -k) and check if the value returned is
'sun4v' or not.
kir...@t2:[~] $ arch -k
sun4v
In fact, I want to do 3 three things
1) Check if the system is Solaris.
2) If it is Solaris, check if 'arch -k' prints 'sun4v'
3) If both 1 and 2 are true, copy a file.
Dave wrote:
I'm trying to run a command (arch -k) and check if the value returned is
'sun4v' or not.
kir...@t2:[~] $ arch -k
sun4v
In fact, I want to do 3 three things
1) Check if the system is Solaris.
2) If it is Solaris, check if 'arch -k' prints 'sun4v'
3) If both 1 and 2 are true, copy
python-newbie113 wrote:
I am new to python and have a question about using methods.
Here is the link i am looking at:
http://www.pythonware.com/library/tkinter/introduction/x2102-methods.htm
If i use, create_arc(bbox, options) = id
what is id? and how do i find the parameter list representing
Dave Angel wrote:
python-newbie113 wrote:
I am new to python and have a question about using methods.
Here is the link i am looking at:
http://www.pythonware.com/library/tkinter/introduction/x2102-methods.htm
If i use, create_arc(bbox, options) = id
what is id? and how do i find the parameter
I am new to python and have a question about using methods.
Here is the link i am looking at:
http://www.pythonware.com/library/tkinter/introduction/x2102-methods.htm
If i use, create_arc(bbox, options) = id
what is id? and how do i find the parameter list representing options?
Thanks for help
On 2009-06-17, python-newbie113 warhammer1...@gmail.com wrote:
If i use, create_arc(bbox, options) = id
what is id? and how do i find the parameter list representing options?
I am not familiar with tkinker; but, the expression is just showing a
function prototype. The function part should be
Hi everyone.
I am reading a python library code and found something i can not understand.
Please help!
class Envelope(object):
def __init__(self,ta_info):
self.ta_info = ta_info
def writefilelist(self,ta_list,tofile):
for filename in ta_list:
fromfile =
On Mon, 18 May 2009 10:18:52 +0100, Jim Qiu bluefishe...@gmail.com wrote:
Please check the blue highlighted part, I don't understand how the
object
get the property?
Colours and highlighting don't come across in Usenet postings. Could
you be a bit more specific. Which object, and what
On Mon, May 18, 2009 at 2:18 AM, Jim Qiu bluefishe...@gmail.com wrote:
Hi everyone.
I am reading a python library code and found something i can not understand.
Please help!
class Envelope(object):
def __init__(self,ta_info):
self.ta_info = ta_info
def
On Mon, May 18, 2009 at 5:30 PM, Rhodri James
rho...@wildebst.demon.co.ukwrote:
On Mon, 18 May 2009 10:18:52 +0100, Jim Qiu bluefishe...@gmail.com
wrote:
Please check the blue highlighted part, I don't understand how the object
get the property?
Colours and highlighting don't come
Jim Qiu wrote:
Hi everyone.
I am reading a python library code and found something i can not understand.
Please help!
class Envelope(object):
def __init__(self,ta_info):
self.ta_info = ta_info
def writefilelist(self,ta_list,tofile):
for filename in ta_list:
zhangle2...@gmail.com wrote:
I am just learning Python and get a problem when trying this example:
from urllib import urlopen
doc=urlopen(http://www.python.org;).read()
print(doc)
when i run this, i was tould that 'cannot import name urlopen
What's wrong with this code? Do i need to
use urllib2
2009/4/12 zhangle2...@gmail.com:
hi,
I am just learning Python and get a problem when trying this example:
from urllib import urlopen
doc=urlopen(http://www.python.org;).read()
print(doc)
when i run this, i was tould that 'cannot import name urlopen
What's wrong with this
hi,
I am just learning Python and get a problem when trying this example:
from urllib import urlopen
doc=urlopen(http://www.python.org;).read()
print(doc)
when i run this, i was tould that 'cannot import name urlopen
What's wrong with this code? Do i need to place my code in some
specific
On Apr 12, 11:01 pm, Peter Otten __pete...@web.de wrote:
zhangle2...@gmail.com wrote:
I am just learning Python and get a problem when trying this example:
from urllib import urlopen
doc=urlopen(http://www.python.org;).read()
print(doc)
when i run this, i was tould that 'cannot import
En Tue, 17 Mar 2009 01:24:18 -0200, Aaron Garrett
aaron.lee.garr...@gmail.com escribió:
On Mar 16, 9:59 pm, Chris Rebert c...@rebertia.com wrote:
On Mon, Mar 16, 2009 at 7:48 PM, Aaron Garrett
aaron.lee.garr...@gmail.com wrote:
I have spent quite a bit of time trying to find the answer on
I have spent quite a bit of time trying to find the answer on this
group, but I've been unsuccessful. Here is what I'd like to be able to
do:
def A(**kwargs):
kwargs['eggs'] = 1
def B(**kwargs):
print(kwargs)
def C(**kwargs):
A(**kwargs)
B(**kwargs)
I'd like to be able to make
On Mon, Mar 16, 2009 at 7:48 PM, Aaron Garrett
aaron.lee.garr...@gmail.com wrote:
I have spent quite a bit of time trying to find the answer on this
group, but I've been unsuccessful. Here is what I'd like to be able to
do:
def A(**kwargs):
kwargs['eggs'] = 1
def B(**kwargs):
I think you may need to do something like this in your code, this is what I
will be doing here shortly too
class peanutsdict(dict):
__slots__ = ['defaultZZz']
def __init__(self,default=None):
dict.__init(self)
self.default = default
def __getitem__(self,key):
On Mar 16, 9:59 pm, Chris Rebert c...@rebertia.com wrote:
On Mon, Mar 16, 2009 at 7:48 PM, Aaron Garrett
aaron.lee.garr...@gmail.com wrote:
I have spent quite a bit of time trying to find the answer on this
group, but I've been unsuccessful. Here is what I'd like to be able to
do:
Hi,
I'm just learning the very basics of python and I ran into this problem in
version 3.0/3000:
x = input(x: )
x: 36
y = input(y: )
y: 42
print (x*y)
Traceback (most recent call last):
File pyshell#3, line 1, in module
print (x*y)
TypeError: can't multiply sequence by non-int of type
On 2009-01-31 18:19, Paulo Repreza wrote:
Hi,
I'm just learning the very basics of python and I ran into this problem
in version 3.0/3000:
x = input(x: )
x: 36
y = input(y: )
y: 42
print (x*y)
Traceback (most recent call last):
File pyshell#3, line 1, in module
print (x*y)
TypeError: can't
Hi,
Thanks for your reply. It worked.
Paulo Repreza
On Sat, Jan 31, 2009 at 4:25 PM, Robert Kern robert.k...@gmail.com wrote:
On 2009-01-31 18:19, Paulo Repreza wrote:
Hi,
I'm just learning the very basics of python and I ran into this problem
in version 3.0/3000:
x = input(x: )
x: 36
On Thu, 2008-12-11 at 13:44 -0600, Kirk Strauser wrote:
At 2008-12-11T17:24:44Z, rdmur...@bitdance.com writes:
' ab c \r\n'.rstrip('\r\n')
' ab c '
' ab c \n'.rstrip('\r\n')
' ab c '
' ab c '.rstrip('\r\n')
' ab c '
I didn't say it couldn't
At 2008-12-12T15:35:11Z, J. Cliff Dyer j...@sdf.lonestar.org writes:
Python has a version equally good:
def chomp(s):
return s.rstrip('\r\n')
You'll hardly miss Perl at all. ;)
I haven't missed Perl in years! I just wish there was a basestring.stripeol
method because I seem to end up
Kirk Strauser wrote:
At 2008-12-12T15:35:11Z, J. Cliff Dyer j...@sdf.lonestar.org writes:
Python has a version equally good:
def chomp(s):
return s.rstrip('\r\n')
You'll hardly miss Perl at all. ;)
I haven't missed Perl in years! I just wish there was a basestring.stripeol
method
Hi!
Im new at python and I just want to know if (and how) it is possible
to send parameters to a program.
what I mean is that when we start python I can call a file that should
be run like this: python myfile.py
can I send additional parameters along with it? like::: python
myfile.py myVar1
Im new at python and I just want to know if (and how) it is possible
to send parameters to a program.
what I mean is that when we start python I can call a file that should
be run like this: python myfile.py
can I send additional parameters along with it? like::: python
myfile.py myVar1 myVar2
yes, but your script will need to know hoe to handle this.the
following will open a file who's name was passed to the script
if len(sys.argv) 1:
try:
open_file(fname=sys.argv[1])
except:
pass
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 12, 12:59 pm, r rt8...@gmail.com wrote:
yes, but your script will need to know hoe to handle this.the
following will open a file who's name was passed to the script
if len(sys.argv) 1:
try:
open_file(fname=sys.argv[1])
except:
pass
ah, ok. now what if I
i was just giving you an example from my TextEditor.py script.
this is how arg works
lets say you have a script named MyScript.py
---
import sys
print sys.argv
---
call the script with arguments
MyScript.py 99 100
['C:\\Python25\\MyScript.py', '99', '100']
int(sys.argv[1]) - 99
--
Andrew Robert wrote:
Two issues regarding script.
You have a typo on the file you are trying to open.
It is listed with a file extension of .in when it should be .ini .
Pardon?
The OPs original post used .in both in the python code and the command
line. Doesn't look like a typo to me.
2008/12/12 trfilmograp...@gmail.com:
ah, ok. now what if I want the variable to be an integer that I
send? for instance if I send 99 to the program, it is picking it up
as a string instead of an integer value. How do I handle this with
python??
As 'r' has said, you can cast it to
At 2008-11-29T04:02:11Z, Mel [EMAIL PROTECTED] writes:
You could try
for item in fname:
item = item.strip()
This is one case where I really miss Perl's chomp function. It removes a
trailing newline and nothing else, so you don't have to worry about losing
leading or trailing spaces if
On Thu, 11 Dec 2008 at 10:24, Kirk Strauser wrote:
At 2008-11-29T04:02:11Z, Mel [EMAIL PROTECTED] writes:
You could try
for item in fname:
item = item.strip()
This is one case where I really miss Perl's chomp function. It removes a
trailing newline and nothing else, so you don't have
Kirk Strauser wrote:
At 2008-11-29T04:02:11Z, Mel mwil...@the-wire.com writes:
You could try
for item in fname:
item = item.strip()
This is one case where I really miss Perl's chomp function. It removes a
trailing newline and nothing else, so you don't have to worry about losing
At 2008-12-11T17:24:44Z, rdmur...@bitdance.com writes:
' ab c \r\n'.rstrip('\r\n')
' ab c '
' ab c \n'.rstrip('\r\n')
' ab c '
' ab c '.rstrip('\r\n')
' ab c '
I didn't say it couldn't be done. I just like the Perl version better.
--
Kirk Strauser
On Thu, 11 Dec 2008 13:44:22 -0600, Kirk Strauser wrote:
At 2008-12-11T17:24:44Z, rdmur...@bitdance.com writes:
' ab c \r\n'.rstrip('\r\n')
' ab c '
' ab c \n'.rstrip('\r\n')
' ab c '
' ab c '.rstrip('\r\n')
' ab c '
I didn't say it couldn't be
Steve Holden a écrit :
Kirk Strauser wrote:
At 2008-11-29T04:02:11Z, Mel mwil...@the-wire.com writes:
You could try
for item in fname:
item = item.strip()
This is one case where I really miss Perl's chomp function. It removes a
trailing newline and nothing else, so you don't have to
At 2008-12-11T19:49:23Z, Steve Holden st...@holdenweb.com writes:
... and it's so hard to write
item = item[:-1]
It's easy - and broken. Bad things happen if you're using something other
than '\n' for EOL.
--
Kirk Strauser
The Day Companies
--
On Thu, 11 Dec 2008 19:49:23 -, Steve Holden st...@holdenweb.com
wrote:
Kirk Strauser wrote:
At 2008-11-29T04:02:11Z, Mel mwil...@the-wire.com writes:
You could try
for item in fname:
item = item.strip()
This is one case where I really miss Perl's chomp function. It
removes a
Kirk Strauser wrote:
At 2008-12-11T19:49:23Z, Steve Holden st...@holdenweb.com writes:
item = item[:-1]
It's easy - and broken. Bad things happen if you're using something other
than '\n' for EOL.
Or if the last line of your file doesn't end
with a newline.
--
Greg
--
On Dec 12, 10:31 am, Rhodri James rho...@wildebst.demon.co.uk
wrote:
On Thu, 11 Dec 2008 19:49:23 -, Steve Holden st...@holdenweb.com
wrote:
Kirk Strauser wrote:
At 2008-11-29T04:02:11Z, Mel mwil...@the-wire.com writes:
You could try
for item in fname:
item =
On Dec 11, 3:49 pm, John Machin sjmac...@lexicon.net wrote:
On Dec 12, 10:31 am, Rhodri James rho...@wildebst.demon.co.uk
wrote:
On Thu, 11 Dec 2008 19:49:23 -, Steve Holden st...@holdenweb.com
wrote:
Kirk Strauser wrote:
At 2008-11-29T04:02:11Z, Mel mwil...@the-wire.com
Jason Scheirer wrote:
On Dec 11, 3:49 pm, John Machin sjmac...@lexicon.net wrote:
On Dec 12, 10:31 am, Rhodri James rho...@wildebst.demon.co.uk
wrote:
On Thu, 11 Dec 2008 19:49:23 -, Steve Holden st...@holdenweb.com
wrote:
Kirk Strauser wrote:
At 2008-11-29T04:02:11Z, Mel
On Thu, 11 Dec 2008 23:49:10 -, John Machin sjmac...@lexicon.net
wrote:
On Dec 12, 10:31 am, Rhodri James rho...@wildebst.demon.co.uk
wrote:
On Thu, 11 Dec 2008 19:49:23 -, Steve Holden st...@holdenweb.com
wrote:
... and it's so hard to write
item = item[:-1]
Tsk. That
On Dec 12, 11:39 am, MRAB goo...@mrabarnett.plus.com wrote:
Jason Scheirer wrote:
On Dec 11, 3:49 pm, John Machin sjmac...@lexicon.net wrote:
On Dec 12, 10:31 am, Rhodri James rho...@wildebst.demon.co.uk
wrote:
On Thu, 11 Dec 2008 19:49:23 -, Steve Holden st...@holdenweb.com
John Machin wrote:
On Dec 12, 11:39 am, MRAB goo...@mrabarnett.plus.com wrote:
Jason Scheirer wrote:
On Dec 11, 3:49 pm, John Machin sjmac...@lexicon.net wrote:
On Dec 12, 10:31 am, Rhodri James rho...@wildebst.demon.co.uk
wrote:
On Thu, 11 Dec 2008 19:49:23 -, Steve Holden
On Dec 12, 1:11 pm, MRAB goo...@mrabarnett.plus.com wrote:
John Machin wrote:
On Dec 12, 11:39 am, MRAB goo...@mrabarnett.plus.com wrote:
Jason Scheirer wrote:
On Dec 11, 3:49 pm, John Machin sjmac...@lexicon.net wrote:
On Dec 12, 10:31 am, Rhodri James rho...@wildebst.demon.co.uk
Josh wrote:
Can Python be used on one Linux machine to drive another Linux machine
through SSH? I am currently running Putty on my XP box to run tests on a
Linux box. I need to automate these tests and thought it would be fun to
do so from a Linux VMWare Image I recently setup. Does this
In article
[EMAIL PROTECTED],
Nan [EMAIL PROTECTED] wrote:
Hello,
I just started to use Python. I wrote the following code and
expected 'main' would be called.
def main():
print hello
main
But I was wrong. I have to use 'main()' to invoke main. The python
interpreter does not
Hi All,
How do I parse a variable inside an RE?
What is the re.search() syntax when your
search string is a variable?
It's easy to parse hardcoded RE's but not
if you use a variable.
Here is my code, input and runtime:
$ cat test45.py
#!/usr/bin/python
import re
resp = raw_input('Selection:
2008/12/1 [EMAIL PROTECTED]
Hi All,
How do I parse a variable inside an RE?
What is the re.search() syntax when your
search string is a variable?
It's easy to parse hardcoded RE's but not
if you use a variable.
Here is my code, input and runtime:
$ cat test45.py
#!/usr/bin/python
[EMAIL PROTECTED] schrieb:
Hi All,
How do I parse a variable inside an RE?
What is the re.search() syntax when your
search string is a variable?
It's easy to parse hardcoded RE's but not
if you use a variable.
Both are exactly equal in difficulty.
Here is my code, input and runtime:
$ cat
On Dec 2, 8:56 am, Diez B. Roggisch [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] schrieb:
Hi All,
How do I parse a variable inside an RE?
What is the re.search() syntax when your
search string is a variable?
It's easy to parse hardcoded RE's but not
if you use a variable.
Both are
Hi All,
I dont understand why the following code never finds tree.
I could not find the answer in the Python tutorials.
Here is the code, test43.in, and runtime:
#!/usr/bin/python
fname = open(test43.in)
var = 'tree'
for item in fname:
print item: , item,
if item == var:
print
Any reason for posting such an issue to the account list? Pillock!
On Sat, Nov 29, 2008 at 4:47 AM, [EMAIL PROTECTED] wrote:
Hi All,
I dont understand why the following code never finds tree.
I could not find the answer in the Python tutorials.
Here is the code, test43.in, and runtime:
item = tree\n != 'tree'
[EMAIL PROTECTED] wrote:
Hi All,
I dont understand why the following code never finds tree.
I could not find the answer in the Python tutorials.
Here is the code, test43.in, and runtime:
#!/usr/bin/python
fname = open(test43.in)
var = 'tree'
for item in fname:
It's the newline after each word that's messing you up.
var = tree\n
...
or
if item.strip() == var:
...
etc.
Kirby
On Fri, Nov 28, 2008 at 7:47 PM, [EMAIL PROTECTED] wrote:
Hi All,
I dont understand why the following code never finds tree.
I could not find the answer in the Python
[EMAIL PROTECTED] wrote:
Hi All,
I dont understand why the following code never finds tree.
I could not find the answer in the Python tutorials.
Here is the code, test43.in, and runtime:
#!/usr/bin/python
fname = open(test43.in)
var = 'tree'
for item in fname:
print item: , item,
if
alex23 wrote:
On Nov 29, 5:09 pm, Josh [EMAIL PROTECTED] wrote:
Can Python be used on one Linux machine to drive another Linux machine
through SSH? I am currently running Putty on my XP box to run tests on a
Linux box. I need to automate these tests and thought it would be fun to
do so from a
On Fri, 2008-11-28 at 19:47 -0800, [EMAIL PROTECTED] wrote:
Hi All,
I dont understand why the following code never finds tree.
The problem is that the lines you are reading from the file have a
newline at the end so 'tree' != 'tree\n'. See below for suggested
changes.
I could not find the
because when you loop over open(...) is the same as looping over open
(...).readlines() and readlines() reads everything including newlines.
Try replace:
if item == var:
with
if item.strip() == var:
Massimo
On Nov 28, 2008, at 9:47 PM, [EMAIL PROTECTED] wrote:
Hi All,
I dont
On Nov 29, 2:53 pm, [EMAIL PROTECTED] wrote:
Hi All,
I dont understand why the following code cannot find the
variable tree. It is very simple but I could not find the answer
to this on the Python Tutorials. Here is the code, input and runtime:
#!/usr/bin/python
fname = open(test43.in)
Two issues regarding script.
You have a typo on the file you are trying to open.
It is listed with a file extension of .in when it should be .ini .
The next issue is that you are comparing what was read from the file
versus the variable.
The item read from file also contains and
Hi All,
I dont understand why the following code cannot find the
variable tree. It is very simple but I could not find the answer
to this on the Python Tutorials. Here is the code, input and runtime:
#!/usr/bin/python
fname = open(test43.in)
var = 'tree'
for item in fname:
print item: ,
[EMAIL PROTECTED] wrote:
Hi All,
I dont understand why the following code cannot find the
variable tree. It is very simple but I could not find the answer
to this on the Python Tutorials. Here is the code, input and runtime:
#!/usr/bin/python
fname = open(test43.in)
var = 'tree'
On Nov 29, 1:53 pm, [EMAIL PROTECTED] wrote:
I dont understand why the following code cannot find the
variable tree.
fname = open(test43.in)
var = 'tree'
for item in fname:
This will include the EOL character for each line.
Try adding the following line here:
item = item.strip()
Can Python be used on one Linux machine to drive another Linux machine
through SSH? I am currently running Putty on my XP box to run tests on a
Linux box. I need to automate these tests and thought it would be fun to
do so from a Linux VMWare Image I recently setup. Does this sound
do-able
On Nov 29, 5:09 pm, Josh [EMAIL PROTECTED] wrote:
Can Python be used on one Linux machine to drive another Linux machine
through SSH? I am currently running Putty on my XP box to run tests on a
Linux box. I need to automate these tests and thought it would be fun to
do so from a Linux VMWare
Asun Friere a écrit :
On Nov 27, 6:11 am, Nan [EMAIL PROTECTED] wrote:
Hello,
I just started to use Python. I wrote the following code and
expected 'main' would be called.
def main():
print hello
main
Not an answer to your question, but I dislike functions named 'main'
because the
On Nov 27, 9:05 pm, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
The problem is that you often have more to do in the __main__ section of
a script than just calling one simple function, and you don't
necessarily want to pollute the module's namespace with all this code.
As I said, it's
On Thu, 27 Nov 2008 17:58:55 -0800, Asun Friere wrote:
if __name__ == '__main__' :
import sys
sys.exit(main(sys.argv))
Doesn't this just pollute the namespace with main()?
Agreed. I don't see anything wrong with that. You have one function more
than you otherwise would have had,
Hello,
I just started to use Python. I wrote the following code and
expected 'main' would be called.
def main():
print hello
main
But I was wrong. I have to use 'main()' to invoke main. The python
interpreter does not give any warnings for the above code. Is there
any way/tool to easily
On Wed, 2008-11-26 at 11:11 -0800, Nan wrote:
Hello,
I just started to use Python. I wrote the following code and
expected 'main' would be called.
def main():
print hello
main
But I was wrong. I have to use 'main()' to invoke main. The python
interpreter does not give any
On Wed, Nov 26, 2008 at 11:11 AM, Nan [EMAIL PROTECTED] wrote:
Hello,
I just started to use Python. I wrote the following code and
expected 'main' would be called.
def main():
print hello
main
But I was wrong. I have to use 'main()' to invoke main. The python
interpreter does not
On Nov 27, 6:11 am, Nan [EMAIL PROTECTED] wrote:
Hello,
I just started to use Python. I wrote the following code and
expected 'main' would be called.
def main():
print hello
main
Not an answer to your question, but I dislike functions named 'main'
because the situation they occur in
I'm a newbie to python. Can anyone tell me why the following little program
complains about incorrect dimensions?
snip
import pylab
from pylab import *
n = 10; m = 2*n;
A = randn(m,n);
b = A*rand(n,1) + 2*rand(m,1);
/snip
The actual error I receive is,
snip
b = A*rand(n,1) + 2*rand(m,1);
Joe Hays wrote:
I'm a newbie to python. Can anyone tell me why the following little
program complains about incorrect dimensions?
snip
import pylab
from pylab import *
n = 10; m = 2*n;
A = randn(m,n);
b = A*rand(n,1) + 2*rand(m,1);
/snip
The actual error I receive is,
HI,
I need an example for the usage of the apply()-function. Can you help me?
Thanks.
o-o
Thomas
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Oct 4, 2008 at 2:25 AM, TK [EMAIL PROTECTED] wrote:
HI,
I need an example for the usage of the apply()-function. Can you help me?
Don't use the apply() function, it's deprecated and unnecessary thanks
to Python's enhanced calling syntax, which is described in depth on
pos_args = [spam, 1, [3]]
kwd_args = {b:7, c:9}
result = some_function(*pos_args, **kwd_args)
Which is equivalent to:
result = some_function(spam, 1, [3], b=7, c=9)
Which was equivalent to:
result = apply(some_function, pos_args, kwd_args)
Thanks a lot.
o-o
Thomas
--
Hi
can someone tell me why it prints the high score table multiple times?
#high scores program
scores =[]
choice = None
while choice != 0:
print high Score Table
0 - exit
1 - show Scores
2 - add a score
3 - delete a score
4 - sort scores
change:
for score in scores:
print scores
to:
for score in scores:
print score
that should do the trick :)
Almar
2008/9/30 garywood [EMAIL PROTECTED]
Hi
can someone tell me why it prints the high score table multiple times?
#high scores program
scores =[]
choice = None
while
Ken D'Ambrosio wrote:
First, apologies for such a newbie question; if there's a better forum
(I've poked around, some) feel free to point it out to me. Anyway, a
mere 25-odd years after first hearing about OOP, I've finally decided
to go to it, by way of Python. But this puzzles me:
import
First, apologies for such a newbie question; if there's a better forum
(I've poked around, some) feel free to point it out to me. Anyway, a
mere 25-odd years after first hearing about OOP, I've finally decided to
go to it, by way of Python. But this puzzles me:
import commands
free
501 - 600 of 1781 matches
Mail list logo