i would suggest overloading the 'with', 'as' combo
c = sqrt(a*a + b*b) with:
get_a(), get_b() as a, b
or
c = sqrt(a*a + b*b) with:
get_a() as a
get_b() as b
it reads well and plus it follows since this statement acts similarly to a
regular with and as statement with the behavior of the context manager being
(in psudocode):
set up: store original value of variable if any and set variable to new
value.
tear down: set value back to original or delete from local namespace if it
never had one
additionally we do not need to introduce any new keywords
any way that this is implemented though it would be quite useful
On Tue, Jul 20, 2010 at 2:35 PM, George Sakkis
On Tue, Jul 20, 2010 at 8:29 PM, Daniel Stutzbach
wrote: On Tue, Jul 20, 2010 at 1:16 PM, Guido van Rossum
wrote: Given the large number of Python users familiar with SQL compared to those familiar with Haskell, I think we'd do wise to pick a different keyword instead of 'where'. I can't think of one right now though.
Taking a cue from mathematics, how about "given"?
c = sqrt(a*a + b*b) given: a = retrieve_a() b = retrieve_b()
Or if we'd rather overload an existing keyword than add a new one, "with" reads well too.
George _______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas