Re: Get classes from "self.MyClass" to improve subclassability

2015-06-15 Thread Thomas Güttler
Hi, crazy. I develop python since several years. I was not aware, that you can change the defaults of kwargs. I am amazed, but won't use it :-) Am Samstag, 13. Juni 2015 01:09:47 UTC+2 schrieb Terry Reedy: > On 6/12/2015 7:12 AM, Thomas Güttler wrote: > > Here is a snippet from the argparse mo

Re: Get classes from "self.MyClass" to improve subclassability

2015-06-12 Thread Terry Reedy
On 6/12/2015 7:12 AM, Thomas Güttler wrote: Here is a snippet from the argparse module: {{{ def parse_known_args(self, args=None, namespace=None): ... # default Namespace built from parser defaults if namespace is None: namespace = Namespace() # < ===

Re: Get classes from "self.MyClass" to improve subclassability

2015-06-12 Thread Thomas Güttler
Hi Steven, I understand your solution. It is correct and works. But the missing five characters "self." in the upstream code produces a lot of more lines in the final result. Regards, Thomas Güttler Am Freitag, 12. Juni 2015 14:24:06 UTC+2 schrieb Steven D'Aprano: > On Fri, 12 Jun 2015 04:12

Re: Get classes from "self.MyClass" to improve subclassability

2015-06-12 Thread Steven D'Aprano
On Fri, 12 Jun 2015 04:12:52 -0700, Thomas Güttler wrote: > Here is a snippet from the argparse module: > > {{{ > def parse_known_args(self, args=None, namespace=None): > ... > # default Namespace built from parser defaults if namespace is > None: > namespa

Re: Get classes from "self.MyClass" to improve subclassability

2015-06-12 Thread Chris Angelico
On Fri, Jun 12, 2015 at 9:12 PM, Thomas Güttler wrote: > I prefer "self.Namespace()" to namespace kwargs. > > What do you think? Given that the namespace argument already exists, and you're proposing a change, you'll need a much stronger justification than mere preference. What's the downside of

Get classes from "self.MyClass" to improve subclassability

2015-06-12 Thread Thomas Güttler
Here is a snippet from the argparse module: {{{ def parse_known_args(self, args=None, namespace=None): ... # default Namespace built from parser defaults if namespace is None: namespace = Namespace() # < === my issue }}} I subclass from the class of the