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
my_string("this is a string") (OK, I know I have a recursive issue in my
example, but hopefully you get the point).
Or;
Test = ['item1', 'item2', 'item3'] returns a list, what if I want to add
functionality to all lists in my module? (and yes, I know I could simply not
do [] and always do my_list('item1', 'item2', 'item3']
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 Strohl
--
https://mail.python.org/mailman/listinfo/python-list