[Steven D'Aprano]
> Indeed. I wonder whether Abe drives, and if he does, whether he has read
> the owner's manual. They are typically *full* of jargon.
Do you still not understand the difference between documentation and
interface?
You seem to not even acknowledge that there's a difference
Chris Angelico wrote:
for those who
know Greek, it's like calling something an "S-expression", which is
fairly obviously an abbreviation for something. ("Symbolic
expression", I think? Someone might correct me there.)
Yes, except that lambda is an even more arbitrary choice of
letter -- as far
On Thu, Aug 23, 2018 at 03:12:30PM +1200, Greg Ewing wrote:
> Abe Dillon wrote:
> >They still find it's better to use a red break
> >light symbol with the aim of clearly communicating to non-experts.
>
> The handbrake warning light on my dashboard has a symbol
> that represents a brake drum and
Abe Dillon wrote:
They still find it's better to use a red break
light symbol with the aim of clearly communicating to non-experts.
The handbrake warning light on my dashboard has a symbol
that represents a brake drum and a pair of brake shoes,
and the word "BRAKE" written underneath it.
[Chris Angelico]
> Because your form cannot possibly work without some additional
> information.
That isn't my form. That's PSEUDO CODE. Just like I wrote above it.
You're the one who's not listening.
The alternative I've suggested, for the thousanth time, is:
hand = sorted(cards,
On Thu, Aug 23, 2018 at 11:59 AM, Abe Dillon wrote:
> [Chris Angelico]
>>
>> > I've also argued that the very form of lambda expressions is noisier
>> > than it
>> > otherwise needs to be. It's not like noise is only distracting to novice
>> > developers.
>> Yes, you've asserted it. We've
[Chris Angelico]
> If the concept is utterly unfamiliar and the word is familiar, it
> creates a different problem: the false parallel. Let's suppose that,
> instead of calling them "lambda expressions", we call them "bacon
> expressions".
Or maybe "curry expressions!"... (I really hate that
On Wed, Aug 22, 2018 at 7:47 PM Mike Miller
wrote:
> >> On Tue, Aug 21, 2018 at 3:07 PM, Jonathan Fine
> wrote:
> Maybe this is something Python's REPL should do?
> iPython brings in a lot of functionality, perhaps too much.
> Would prefer something more focused like bpython or ptpython.
>
On Thu, Aug 23, 2018 at 10:44 AM, Abe Dillon wrote:
> The problem goes beyond just learning the term lambda, it can increase
> mental load on an already mentally demanding activity to have to translate
> an unfamiliar word every time you see it. It's lack of relation to anything
> else makes it
[Steven D'Aprano]
> As educators, if we fail to teach the technical language of a field to
> our students, we are failing to prepare those students to enter that
> field. Technical jargon is the language of the field.
It's not the responsibility of the tool to teach. My socket wrench doesn't
On 2018-08-22 23:44, Greg Ewing wrote:
Steven D'Aprano wrote:
Not "process the sorted list", but reify the sort verb into an actual
thing (an object or value) and then process that thing itself.
This is mind-bending when you think about it, far more mind-blowing than
the normal linguistic
On 2018-08-22 10:08, Antoine Pitrou wrote:
On Wed, 22 Aug 2018 09:38:57 -0700
Chris Barker via Python-ideas
On Tue, Aug 21, 2018 at 3:07 PM, Jonathan Fine wrote:
Maybe this is something Python's REPL should do?
To me it sounds fine to improve the REPL. Especially, being able to
paste
Thanks, Stephen.
That's interesting. So the parser can see one token past, for instance;
what would be the end of an expression, see "if", and know to expand the
AST?
___
Python-ideas mailing list
Python-ideas@python.org
Replying out of order:
[Steven D'Aprano]
> Under your proposal, that becomes:
> def bench(name, cleanup=None with ???, *, seconds=1, repeat=3):
> except I'm not really sure what goes in the ??? for an empty parameter
> list.
I know I tend to write long-winded responses, but please read them
Stephan Houben wrote:
Church's lambda notation was the first way to write
down a function without naming it, in the 1930's.
That's debatable. It could be argued that calculus makes use
of anonymous functions, e.g. the expression
d/dx (x**2 + 2*x - 3)
describes a function of x without
On Thu, Aug 23, 2018 at 9:02 AM, Greg Ewing wrote:
> Rhodri James wrote:
>>
>> This, by the way, is why think using the same syntax for function
>> definition and generator definition was a mistake.
>
>
> I think I remember arguing the same thing back when generators
> were being devised.
>
> But
Rhodri James wrote:
This, by the way, is why think using the same syntax for function
definition and generator definition was a mistake.
I think I remember arguing the same thing back when generators
were being devised.
But there are arguments the other way too. From the outside,
a generator
Steven D'Aprano wrote:
Not "process the sorted list", but reify the sort verb into an actual
thing (an object or value) and then process that thing itself.
This is mind-bending when you think about it, far more mind-blowing than
the normal linguistic process of nouning verbs and verbing
On Wed, Aug 22, 2018 at 06:01:05PM -0400, Wes Turner wrote:
> %edit -p
>
> > Bring up an editor and execute the resulting code.
https://code.activestate.com/recipes/578926-call-out-to-an-external-editor/
--
Steve
___
Python-ideas mailing list
%doctest_mode works like the Python REPL (with '>>>' prompts and no pretty
printing)
https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-doctest_mode
On Wednesday, August 22, 2018, Wes Turner wrote:
> %edit -p
>
> > Bring up an editor and execute the resulting code.
>
> >
%edit -p
> Bring up an editor and execute the resulting code.
> -p: this will call the editor with the same data as the previous time it
was used, regardless of how long ago (in your current session) it was.
https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-edit
Something
On Thu, Aug 23, 2018 at 6:24 AM, David Mertz wrote:
> Oops. I blame the partial editing of copy/padte on doing it on my phone. I
> meant this, of course:
>
> widget.register(callback=spam.eggs)
This isn't quite the same, incidentally. It's (mostly) equivalent to:
widget.register(callback=lambda
... functions as nouns...
On Wed, Aug 22, 2018, 1:44 PM David Mertz wrote:
> This isn't trying to snipe. I have written the exact same unnecessary
> circumlocution in my own code hundreds of times. Hopefully most of them
> simplified before release, but I'm sure not all. And I "wrote the book",
This isn't trying to snipe. I have written the exact same unnecessary
circumlocution in my own code hundreds of times. Hopefully most of them
simplified before release, but I'm sure not all. And I "wrote the book", as
one says, _Functional Programming in Python_.
Functions as sounds is a powerful
Oops. I blame the partial editing of copy/padte on doing it on my phone. I
meant this, of course:
widget.register(callback=spam.eggs)
On Wed, Aug 22, 2018, 1:47 PM Steven D'Aprano wrote:
> On Wed, Aug 22, 2018 at 01:38:03PM -0400, David Mertz wrote:
> > On Wed, Aug 22, 2018, 12:40 PM Steven
Fwiw, I usually don't do
def foo():
if False: yield None
But simply:
def foo():
return ()
That the returned iterable is not a generator seldom matters.
Stephan
Op wo 22 aug. 2018 21:17 schreef Chris Angelico :
> On Thu, Aug 23, 2018 at 3:56 AM, Rhodri James
> wrote:
> > On 22/08/18
On Thu, Aug 23, 2018 at 3:56 AM, Rhodri James wrote:
> On 22/08/18 14:38, Jonathan Fine wrote:
> def fn():
>>
>> ... if None:
>> ... yield
>> ...
>
> list(fn()) # Fails, unless fn is a generator function.
>>
>> []
Actually, it fails unless fn returns some sort of
On Thu, 23 Aug 2018 03:44:07 +1000, Steven D'Aprano wrote:
> On Wed, Aug 22, 2018 at 12:11:40PM -0500, Abe Dillon wrote:
> difflib tests include this call:
>
> sm = difflib.SequenceMatcher(isjunk=lambda x: x == ' ', ...)
>
> which becomes:
>
> sm = difflib.SequenceMatcher(isjunk=x == ' ' with x,
Op wo 22 aug. 2018 18:40 schreef Steven D'Aprano :
> Chris' conclusion is that anonymous functions are inherently hard for
> many beginners to learn, regardless of whether the syntax is called
> "lambda" or "function".
>
Civilization itself had trouble with the concept. Functions as mathematical
On 22/08/18 18:06, Jonathan Fine wrote:
The BBC micro:bit is a pocket-sized codeable computer with motion
detection, a built-in compass and Bluetooth technology, which was
given free to every child in year 7 or equivalent across the UK in
2016.
Ditto for the Raspberry Pi, which is cheap rather
On 22/08/18 14:38, Jonathan Fine wrote:
Hi Rhodri
You wrote:
This, by the way, is why think using the same syntax for function definition and
generator definition was a mistake. It's only when I reach a "yield" statement
that I realise my expectations for this code are wrong.
Here's
On Wed, Aug 22, 2018 at 01:38:03PM -0400, David Mertz wrote:
> On Wed, Aug 22, 2018, 12:40 PM Steven D'Aprano wrote:
>
> > I believe that many people have a lot of trouble grasping the concept of
> > functions as first-class values capable of being passed to other functions
> > as data... It
On Wed, Aug 22, 2018 at 12:11:40PM -0500, Abe Dillon wrote:
> [Steven D'Aprano]
>
> > > The revelation that it's a function should come when you read the "by" or
> > > "key".
> > I disagree. The most important fact is that it is a function, not
> > specifically what it does.
>
>
> I was trying
On 22/08/18 17:59, Chris Barker via Python-ideas wrote:
On Wed, Aug 22, 2018 at 9:51 AM, Stephan Houben
wrote:
Let me stand up and say that I personally like lambda. It's the standard
terminology and not easily confused.
I agree.
And secondly, even if I didn't like it, changing the name of
On Wed, Aug 22, 2018, 12:40 PM Steven D'Aprano wrote:
> I believe that many people have a lot of trouble grasping the concept of
> functions as first-class values capable of being passed to other functions
> as data... It took me a long time to stop writing code like this:
>
> map(lambda x:
On Tue, Aug 21, 2018 at 09:57:51PM -0500, Abe Dillon wrote:
> [Chris Angelico]
>
> > If you have a use-case for a lambda function that takes a callback and
> > has a default value for that callback, please submit it to The Daily
> > WTF. In Steve's example, the main function was created with a
>
[Steven D'Aprano]
> > The revelation that it's a function should come when you read the "by" or
> > "key".
> I disagree. The most important fact is that it is a function, not
> specifically what it does.
I was trying to say that the context almost always gives away that the
reader should expect
On Wed, 22 Aug 2018 09:38:57 -0700
Chris Barker via Python-ideas
wrote:
> On Tue, Aug 21, 2018 at 3:07 PM, Jonathan Fine wrote:
>
> > > Maybe this is something Python's REPL should do?
> >
> > Good idea.
> >
>
> I can't find (with very little effort) any documentation of this, but I
> have
Hi Steve
You and I have different experience, background and interests.
You wrote
> As educators, if we fail to teach the technical language of a field to
> our students, we are failing to prepare those students to enter that
> field. Technical jargon is the language of the field.
Python is a
On Wed, Aug 22, 2018 at 04:58:17PM +0100, Jonathan Fine wrote:
> I wrote:
>
> > Here is my simple proposal. Enhance Python to allow
> >
> > >>> hn = def a, b=2, c=3: a ** b / c
>
> I'd like to add a clarification. Here are two proposals.
>
> ONE. Wherever you could have used 'lambda', you now
On Wed, Aug 22, 2018 at 9:51 AM, Stephan Houben
wrote:
> Let me stand up and say that I personally like lambda. It's the standard
> terminology and not easily confused.
>
I agree.
And secondly, even if I didn't like it, changing the name of something
because it's a slightly less confusing name
Let me stand up and say that I personally like lambda. It's the standard
terminology and not easily confused.
I doubt that "many Python users" have a problem with it. Evidence?
I dislike the def proposal strongly.
It is too similar to a normal def.
At least get a new keyword then
Some other
Le 22/08/2018 à 04:12, MRAB a écrit :
On 2018-08-22 02:38, Elazar wrote:
I don't think this change makes sense, but if it's done, there should
be another change, with actual implications:
There is no way to express the types of the parameters in a lambda -
`lambda x: int : x` is obviously a
Michael makes some reasonable points, but I think the very premise of
this thread is putting the cart before the horse.
As educators, if we fail to teach the technical language of a field to
our students, we are failing to prepare those students to enter that
field. Technical jargon is the
I've often thought the same about "lambda."
Although I've long since gotten used to the word, "def" without a function name
seemed like a better choice, especially for beginners.
+0.25 for proposal ONE
However, parentheses should be allowed and lambda put on a long deprecation
schedule.
I wrote:
> Here is my simple proposal. Enhance Python to allow
>
> >>> hn = def a, b=2, c=3: a ** b / c
I'd like to add a clarification. Here are two proposals.
ONE. Wherever you could have used 'lambda', you now have a choice.
You can still use 'lambda', or you can use 'def' instead. The
Hi Rhodri
You wrote:
>This, by the way, is why think using the same syntax for function definition
>and generator definition was a mistake. It's only when I reach a "yield"
>statement that I realise my expectations for this code are wrong.
Here's something that might help, and surprise, you.
On 22/08/18 07:11, Steven D'Aprano wrote:
"Wait wait wait!" should ideally never happen. In programming, surprises
are not a good thing, and they're even less good when they are
retroactive.
"Ha, fooled you! You thought you were dealing with an eagerly evaluated
expression, but it was a
On Tue, Aug 21, 2018 at 05:45:53PM -0500, Abe Dillon wrote:
> Can you explain how far the parser is capable of backtracking?
Its an LL(1) parser, if I recall correctly, so if you look at the
details of LL(1) parsing, that should answer the question.
https://en.wikipedia.org/wiki/LL_parser
But
On Tue, Aug 21, 2018 at 01:56:16PM -0500, Abe Dillon wrote:
> The revelation that it's a function should come when you read the "by" or
> "key".
I disagree. The most important fact is that it is a function, not
specifically what it does. Consider:
widget.register(value[a](x)
50 matches
Mail list logo