Re: Override built in types... possible? or proposal.

2018-05-31 Thread Steven D'Aprano
On Thu, 31 May 2018 09:51:30 -0700, Rob Gaddi wrote: > On 05/31/2018 07:49 AM, Dan Strohl wrote: >> Is it possible to override the assignment of built in types to the >> shorthand representations? And if not, is it a reasonable thought to >> consider adding? [...] > My problem with this idea

Re: Override built in types... possible? or proposal.

2018-05-31 Thread Terry Reedy
On 5/31/2018 10:49 AM, Dan Strohl via Python-list wrote: Is it possible to override the assignment of built in types to the shorthand representations? By which I presume you mean literals and overt (non-comprehension) displays. So you wish that Python should be even more dynamic. (Some

RE: Override built in types... possible? or proposal.

2018-05-31 Thread Dan Strohl via Python-list
> > > > I am envisioning something in the header like an import statement > > where I could do; > > > > override str=my_string > > override list=my_list > > > > This would only be scoped to the current module and would not be > imported when that module was imported. > > > > Thoughts? > > > > Dan

Re: Override built in types... possible? or proposal.

2018-05-31 Thread Rob Gaddi
On 05/31/2018 07:49 AM, Dan Strohl wrote: Is it possible to override the assignment of built in types to the shorthand representations? And if not, is it a reasonable thought to consider adding? For example, right now, if I do: test = "this is a string", I get back str("this is a string").

Override built in types... possible? or proposal.

2018-05-31 Thread Dan Strohl via Python-list
Is it possible to override the assignment of built in types to the shorthand representations? And if not, is it a reasonable thought to consider adding? For example, right now, if I do: test = "this is a string", I get back str("this is a string"). What if I want to return this as