> def met1(self, arg=None): |<-- ctrl+1 here would bring the suggestion,
> instead of having to create another line with arg to make the choice
> (and if more than one argument had '=None', add one option for each).
>
> What do you think?
I also think that this could have several benefits to it, as you could
probably quite easily implement separate behaviors for constructors and
conventional methods.
This would probably be the most useful pattern for constructors:
class MyClass:
def __init__(self, arg = None):
if arg is None:
arg = list()
self.arg = arg
while you probably would want to do this for other methods:
class MyClass:
def method(self, arg = None):
if arg is None:
arg = self.arg
How does that sound to you? Is it reasonable? It's certainly true for my
style of coding anyway.
I elaborated on the rationale for doing things this way in the use case
docs for AssignToAttributeOfSelf (if I'm allowed to repeat myself... :-)
'''It's often a good idea to use the same names in args, variables and
data members. This keeps the terminology consistent. This way
customer_id should always contain a customer id, and any other variants
are misspellings that probably will lead to bugs.'''
What do you think?
Cheers!
/Joel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
pydev-code mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-code