Dear All,
What is the best way of creating methods depending on the packages that have
been installed.
A silly example is
try:
import somepack
class hello:
def __init__(self):
print 'hi'
def some(self):
print 'some'
except:
class hello:
Hi,
Does anyone know of any examples on how (& where) to use staticmethods and
classmethods?
Thanks
Colin
--
http://mail.python.org/mailman/listinfo/python-list
Dear All,
I ran my code through pylint to clean it up and one of the (many) errors it
through up was
Dangerous default value {} as argument
Bascially, I have:
class NewClass:
def __init__(self, myDict={}):
for key, value in myDict:
print key, value
Obviously, this is not
Dear All,
Many thanks
Colin
"C Gillespie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dear All,
>
> I have a simple class
> class hello:
> def world(self):
> return 'hello'
> def test(self,arg):
> retur
Dear All,
I have a simple class
class hello:
def world(self):
return 'hello'
def test(self,arg):
return self.arg
When I want to do is:
>hello.test('world')
'hello'
i.e. pass the method name as an argument. How should I do this?
Thanks
Colin
--
http://mail.python.org/
> What are you trying to do exactly? If you provide more explanations, we
may
> provide a better help than the simplistic one above.
Dear All,
Thanks for the suggestions.
Basically, I have the situation where a user (via the web) requests data
from a database that has to be written to file. Howe
"Miki Tebeka" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello Colin,
>
> > I have a function
> > def printHello():
> > fp = open('file','w')
> > fp.write('hello')
> > fp.close()
> >
> > I would like to call that function using spawn or fork. My questions
are:
> >
>
Dear All,
I have a function
def printHello():
fp = open('file','w')
fp.write('hello')
fp.close()
I would like to call that function using spawn or fork. My questions are:
1. Which should I use
2. How do I call that function if it is defined in the same file.
Many thanks
Colin
--