Python Forum

Full Version: Problem with adding arbitrary parrameters to __init__ method
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Python community,

At the moment i'm starting to learn Python and it is going well, but I'm a bit stuck figuring out why the def __init__ wont take a parameter with a single asterisk.
The one with two works fine, anybody that knows if this even can work or is there something wrong in my code?

Here is the code:
print("\nAnother class for users:")
class User():
    """Describing a user."""
    def __init__(self, first_name, last_name, *languages, **information):
        self.fullname = first_name + " " + last_name
        self.languages = languages
        self.information = information



Thanks in regards

Mudo
I ran your code without issues. Please provide the full error you're getting, in code/error tags.