Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

How to pass an input argument when creating an instance of a class?

$
0
0

My idea was to implement the following class:

class name(object, name):    def __init__(self, name):        print name

Then the idea was to create two instances of that class:

person1 = name("jean")person2 = name("dean")

I know that is not possible, but how can I pass an input argument into an instance of a class?


Viewing all articles
Browse latest Browse all 23131

Trending Articles