differentmatt / filbert

JavaScript parser of Python
Other
133 stars 27 forks source link

Creating functions with optional parameters #23

Open nemoyatpeace opened 10 years ago

nemoyatpeace commented 10 years ago

I seem to get an error if I try to create a function with a default value assigned to a parameter:

class A:
   def __init__(self):
        self.b = 'hi'

   def main(self):
       def r(a,b=7):
           return a*7
       self.r = r

a=A()
a.main()
print(a.r)
print(a.r(8))

This code run just fine (in the filbert tester) until I added the parameter b=7.

differentmatt commented 10 years ago

8 is a catchall for advanced function arguments. We can use this issue to track default arguments.

nemoyatpeace commented 10 years ago

OK, so now I should actually read the issues that are already listed before I post my next one...