Galcon 2: 33 players online!
:: Community ::
ForumsMessagesModsChat
 

Forums :: [ANCIENT] Desktop :: Mods :: Special python member function disabled?

You must sign in to post.

Page 1 / 1 1 

Special python member function disabled? :: May 10, 2007 @ 8:56pm

Ensign SirGnip

Clan: Galconians
Joined: Dec 27, 2006
Posts: 59
Location: Chi-town

If I have a class like this:

class MyStuff:
    def __init__(self, x=0):
        self.val = x
    def __add__(self, rhs):
        return(MyStuff(self.val + rhs.val))

Galcon throws an exception, complaining about the "__add__".  So, does this mean Galcon doesn't allow classes to use the special member function names (ex: __del__, __str__, __add__, etc.?)  Now, __init__ seems to be let by ok.

Your Mod API wiki page said "variables may not begin with _, contain __, or start with various reserved prefixes (f_, and more)".  Does this also apply to function names?

FWIW, the exception is:

CheckStrException: (183, 'name', '__str__')
post updated on May 10, 2007 @ 8:56pm
Re: Special python member function disabled? :: May 10, 2007 @ 9:26pm

Ensign philhassey

Clan: Galconicorn
Joined: Nov 30, 2006
Posts: 6034
Location: Zarcon

The Developer
Correct.  No using __ in method or function names (lots of other python loopholes).  __init__ is allowed.

- Phil

Page 1 / 1 1 

You must sign in to post.