I kind of strangely like this, but it does something completely
different from parens or []. Those do have something in common -
func(param) and indexable[index] both result in some value obtained in
some way by combining the two names - either it's the result of func
when called with param, or it
Steven D'Aprano wrote:
y = 1
def func():
x = 2
return x+y
Here, there's a local environment as well as an implicit global one.
Surely we don't want to call this a closure?
Python probably isn't the best choice of language for the
point you're making, because even top-level functions i
Hi everybody,
Our PEP idea would be to purpose to add a global default value for
itemgeet and attrgetter method.
This was inspired from bug 14384 (https://bugs.python.org/issue14384);
opened by Miki TEBEKA.
For example, we could do:
p1 = {'x': 43; 'y': 55}
x, y, z = itemgetter('x', 'y', 'z', de
Tim Peters wrote:
def objective_readability_score(text):
"Return the readability of `text`, a float in 0.0 .. 1.0"
return 2.0 * text.count(":=") / len(text)
A useful-looking piece of code, but it could be more readable.
It only gives itself a readability score of 0.0136986301369863.
--
On 02/05/18 07:21, Ken Hilton wrote:
Going back to the regex example, this is how it would look in that case:
if re.match(exp, string){m}:
print(m.group(0))
The various other options at least suggest that in some manner what is
going on is an assignment. This really doesn't. S
[MRAB]
>> There's another question that hasn't been asked yet: what should locals()
>> and globals() return?
[Tim, "globals()" is obvious, "locals()" can be surprising now]
> ...
And here recording the results of some code spelunking Dicts don't
really have anything to do with how locals are im
Essentially, functools.partial is almost good enough for specifying some of
the parameters of an object's initializer, but the partial object doesn't
respond properly to issubclass. Please consider adding something like
partialclass described here:
https://stackoverflow.com/questions/38911146/
On Wed, May 02, 2018 at 02:46:09PM -0700, Neil Girdhar wrote:
> Essentially, functools.partial is almost good enough for specifying some of
> the parameters of an object's initializer, but the partial object doesn't
> respond properly to issubclass.
[...]
I think that ought to be an uncontrovers
On Wed, May 02, 2018 at 10:08:55AM +0200, Vincent Maillol wrote:
> Hi everybody,
>
> Our PEP idea would be to purpose to add a global default value for
> itemgeet and attrgetter method.
I'm sorry, I'm not sure I understand what you mean by a global default.
My interpretation of that would be the
> On May 2, 2018, at 1:08 AM, Vincent Maillol wrote:
>
> Our PEP idea would be to purpose to add a global default value for
> itemgeet and attrgetter method.
My preference is to not grow that API further. It is creep well beyond its
intended uses. At some point, we're really better off just
On Wed, May 02, 2018 at 10:28:33PM -0700, Raymond Hettinger wrote:
>
>
> > On May 2, 2018, at 1:08 AM, Vincent Maillol
> > wrote:
> >
> > Our PEP idea would be to purpose to add a global default value for
> > itemgeet and attrgetter method.
>
> My preference is to not grow that API further.
11 matches
Mail list logo