> You can run your code inside a class definition, abuse metaclassing to
replace the namespace with yourown dict and override the __setitem__
function. Then you can implement a var function so it inspect into it's
caller namespace, and inserts the given key into it.
This hack doesn't apply on any s
On Oct 2, 2015 12:35 AM, "Denis McMahon" wrote:
>
> On Thu, 01 Oct 2015 01:48:03 -0700, gal kauffman wrote:
>
> > items = s.replace(' (', '(').replace(', ',',').split()
> >
> > items_dict = dict()
> > for item in i
Oct 1, 2015 3:48 PM, "Tim Chase" wrote:
> On 2015-10-01 01:48, gal kauffman wrote:
> > items = s.replace(' (', '(').replace(', ',',').split()
>
> s = "name1 (1)"
>
> Your suggestion doesn't catch cas
items = s.replace(' (', '(').replace(', ',',').split()
items_dict = dict()
for item in items:
if '(' not in item:
item += '(0,0)'
if ',' not in item:
item = item.replace(')', ',0)')
name, raw_data = item.split('(')
data_tuple = tuple((int(v) for v in
raw_data.repla
Sorry, you really can't give FunctionType an argument list.
Maybe you can wrap the function with a callable object, this way you can
change the argument list returned, and doest have to eval or compile code.
On Sep 25, 2015 12:46 AM, "Joseph L. Casale"
wrote:
> > I don't think you can easily chan
You can use the FunctionType class found in the types module (and its
friends) to create functions on the run.
And you can use the 'inspect' module to inspect existing functions, if you
need to base the new function on an existing one.
On Sep 24, 2015 11:28 PM, "Joseph L. Casale"
wrote:
> I have