B
Bengt Richter
]
The '::' unary suite operator should return an ordered dict subtype representing the bindings, so
print items => {'x':1, 'y':[1, 2], 'foo':<function foo at 0x02EE8D14>}
instead. This allows cleaner suite-based keyword calling, since no dict:<suite>) is necessary,
so
def foo(**kw): print kw
followed by
foo(**::
x = 1
y = [1,2]
def foo()ass)
will print the same. Since ::<suite> is an expression, it can go anywhere an expression can go.
I like orthogonality ;-)
Methods allow (with order preserved from binding in suite)
: x=1; y=2).keys() # => ['x', 'y']
and
: x=1; y=2).values() # => [1, 2]
and
: x=1; y=2).items() # => [('x', 1), ('y', 2)]
note that :: is ;-greedy in one-line suites, so
:: x=1; y=2
is not
: x=1); y=2
Regards,
Bengt Richter
Update, sorry. Galloping evolution here ;-)The "::" expression I'm proposing generalizes capturing suite bindings into an ordered sequence of (key,value)
tuples, like an ordered vars().items() limited to the bindings produced in the suite following "::"
Thus
items = ::
x = 1
y = [1,2]
def foo()ass
print items => (('x', 1), ('y', [1, 2]), ('foo', <function foo at 0x02EE8D14>))
The '::' unary suite operator should return an ordered dict subtype representing the bindings, so
print items => {'x':1, 'y':[1, 2], 'foo':<function foo at 0x02EE8D14>}
instead. This allows cleaner suite-based keyword calling, since no dict:<suite>) is necessary,
so
def foo(**kw): print kw
followed by
foo(**::
x = 1
y = [1,2]
def foo()ass)
will print the same. Since ::<suite> is an expression, it can go anywhere an expression can go.
I like orthogonality ;-)
Methods allow (with order preserved from binding in suite)
: x=1; y=2).keys() # => ['x', 'y']
and
: x=1; y=2).values() # => [1, 2]
and
: x=1; y=2).items() # => [('x', 1), ('y', 2)]
note that :: is ;-greedy in one-line suites, so
:: x=1; y=2
is not
: x=1); y=2
Regards,
Bengt Richter