Hi,
I have this script:
from types import *
class Tag:
def __init__(self, nom, tipus, valor):
self.nom = nom
self.tipus = tipus
self.valor = valor
def __str__(self):
return "Nom: " + str(self.nom) + ", Tipus: " + str(self.tipus)
+ ", Valor: " + str(se
Al 07/05/12 21:07, En/na Dave Angel ha escrit:
On 05/07/2012 02:24 PM, xancorreu wrote:
Hi,
I have this script:
from types import *
Bad idea. Once you do that, you can silently overwrite globals in your
own module with stuff that the current version of types happens to have
in it. Besides
Al 08/05/12 01:24, En/na Alan Gauld ha escrit:
On 07/05/12 21:37, xancorreu wrote:
This is the code:
OK, But it's not clear from that why you want the type.
You are not doing anything meaningful with the type.
class Tag:
def __init__(self, nom, tipus, valor):
self.nom = nom
self.
Al 08/05/12 19:36, En/na Alan Gauld ha escrit:
On 08/05/12 11:23, xancorreu wrote:
It works with
c = Tag("twice", type(lambda x: x), lambda x: 2*x)
but I want to specify the type of (lambda x: x) **manually** as I do
with str in b
Unfortunately we don't always get what we
Al 08/05/12 20:42, En/na Emile van Sebille ha escrit:
On 5/8/2012 11:31 AM xancorreu said...
isinstance(2, function)
like I do
isinstance(2, int)
Do you understand my reasoning?
Nope, but here ya go:
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:55:11)
[GCC 4.4.1] on linux2
Type "