DescentBB
http://www.descentbb.net/

[python] I just figured this out by accident!
http://www.descentbb.net/viewtopic.php?f=7&t=20192
Page 1 of 1

Author:  Isaac [ Sun Jan 20, 2013 11:50 am ]
Post subject:  [python] I just figured this out by accident!

So this is regular use:

Code:
>>> def a(x=0,y=0,z=0):
...     print x
...     print y
...     print z
...
>>> a(3,2,4)
3
2
4
>>> a()
0
0
0


Now, for the amazing part:

Code:
>>> a(z=3)
0
0
3


YEAHHH!!!!!!

This has just saved me lots of time, for a complicated messy method I'm calling.

Author:  snoopy [ Sun Jan 20, 2013 7:47 pm ]
Post subject:  Re: [python] I just figured this out by accident!

Yep. You can define default values.

Page 1 of 1 All times are UTC-06:00
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/