[Python-ideas] Re: Using explicit parenthesization to convey aspects of semantic meaning?

2020-12-16 Thread Greg Ewing
On 17/12/20 8:16 am, Paul Sokolovsky wrote: With all the above in mind, Python3.7, in a strange twist of fate, and without much ado, has acquired a new operator: the method call, ".()". > CPython3.6 and below didn't have ".()" operator, and compiled it as > "attr access" + "function call", but

[Python-ideas] Re: Using explicit parenthesization to convey aspects of semantic meaning?

2020-12-17 Thread Greg Ewing
On 17/12/20 9:56 pm, Paul Sokolovsky wrote: It's about a new exciting (hmm, we'll see) feature which, turned out, was there all this time, ... I'm asking fellow Python programmers if they recognize it. If they do, we can consider how to get more from that feature, I don't see how we can get any

[Python-ideas] Re: Using explicit parenthesization to convey aspects of semantic meaning?

2020-12-17 Thread Greg Ewing
On 17/12/20 11:25 pm, Paul Sokolovsky wrote: CPython compiles "(a.b)()" using LOAD_METHOD not because it consciously "optimizes" it, but simply because it's *unable* to represent the difference between "a.b()" and "(a.b)()". I'm pretty sure whoever added the optimisation fully intended it to a

[Python-ideas] Re: Using explicit parenthesization to convey aspects of semantic meaning?

2020-12-17 Thread Greg Ewing
On 18/12/20 1:52 am, Paul Sokolovsky wrote: On Fri, 18 Dec 2020 01:23:34 +1300 Greg Ewing wrote: On 17/12/20 11:25 pm, Paul Sokolovsky wrote: a) (a.b)() syntax b) apply() being resurrected I can't answer that without knowing what alternative semantics you have in mind for (a.b)()

[Python-ideas] Re: Using explicit parenthesization to convey aspects of semantic meaning?

2020-12-17 Thread Greg Ewing
On 18/12/20 7:01 am, Paul Sokolovsky wrote: Now, what if you have an object attribute which stores a callable (no matter is it's bound method, a function, a class, or whatever)? You will need to call it as "(obj.callable_ref)(arg, kw=val)". So, in strict mode, this: import random n = random.c

[Python-ideas] Re: Using explicit parenthesization to convey aspects of semantic meaning?

2020-12-17 Thread Greg Ewing
On 18/12/20 1:48 pm, Paul Sokolovsky wrote: So, it's already clear that mod.func() syntax will continue to work as before. I don't foresee any problems with implementing that, do you? What about this: import random class A: def choice(self, stuff): return stuff[0] a = A() def f(

[Python-ideas] Re: Standalone bool?

2020-12-21 Thread Greg Ewing
On 22/12/20 6:24 am, Christopher Barker wrote: What I think the OP wants, and I happen to agree, is for Booleans to not only not BE integers in the subclassing sense, but also to not behave as numbers in the. Duck Typing sense. However, that ship has sailed. I think it would have been minima

[Python-ideas] Re: Unpack operator "**" and Mapping

2020-12-26 Thread Greg Ewing
On 27/12/20 10:15 am, Christopher Barker wrote: It does seem like ** could be usable with any iterable that returns pairs of objects. However the trick is that when you iterate a dict, you get the keys, not the items, which makes me think that the only thing you should *need* is an items() meth

[Python-ideas] Re: Unpack operator "**" and Mapping

2020-12-26 Thread Greg Ewing
On 27/12/20 3:03 pm, Chris Angelico wrote: But that would mean that a lot of iterables would look like mappings when they're not. In the context of ** you're expecting a mapping, not a sequence. -- Greg ___ Python-ideas mailing list -- python-ideas@p

[Python-ideas] Re: Unpack operator "**" and Mapping

2020-12-29 Thread Greg Ewing
On 30/12/20 9:44 am, Christopher Barker wrote: So there are dunders, and protocols, and ABCs, and they all overlap a bit in purpose. And "protocols" seem to be the least clearly specified. > there are various protocols described in the C API docs, including > the Mapping protocol: > > https://

[Python-ideas] Re: Unpack operator "**" and Mapping

2020-12-29 Thread Greg Ewing
On 30/12/20 11:20 am, Brendan Barnwell wrote: So, to give an example, the iterator protocol should be documented right where the `for` statement is documented, and it should be explicitly framed as "this is the definition of what the `for` statement does", Not sure about that -- there ar

[Python-ideas] Re: Standard tool for iterating over recursive data structures?

2021-01-01 Thread Greg Ewing
On 2/01/21 6:14 am, Jeff Allen wrote: we may as well say that the required result takes the form of an iterable of the nodes, which may subsequently be iterated by a consumer. In general you need more than that, I think. If you're printing a representation of the graph, you want to know about

[Python-ideas] Re: Support reversed(itertools.chain(x, y, z))

2021-01-08 Thread Greg Ewing
On 9/01/21 10:19 am, Ram Rachum wrote: In short, I want `reversed(itertools.chain(x, y, z))` that behaves like `itertools.chain(map(reversed, (z, y, x)))`. I think you mean `itertools.chain(*map(reversed, (z, y, x)))` You can get this with itertools.chain(*map(reversed, reversed(t))) Mak

[Python-ideas] Re: Support reversed(itertools.chain(x, y, z))

2021-01-08 Thread Greg Ewing
On 9/01/21 12:54 pm, Steven D'Aprano wrote: Your proposal would still have the surprising consequences that reversing a chain that includes a string would surprisingly split the string into a sequence of characters in reverse order. Not that surprising, since chain already splits strings into s

[Python-ideas] Re: List .index() Method

2021-01-29 Thread Greg Ewing
On 30/01/21 3:27 am, Francis O'Hara Aidoo wrote: listy = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] if listy.index(10) == -1:   print("Monty Python") > Although ambiguity will make it difficult to implement, The difficulty isn't just with implementation, it's with *specification*. How is it

[Python-ideas] Re: Conditional with statements

2021-02-07 Thread Greg Ewing
On 8/02/21 6:59 am, Christopher Barker wrote: I find myself reading entire files into memory and then processing them, so as to avoid having to extra-indent all the processing code. I don't know why some people seem to be so afraid of indentation levels. Remember, you don't *have* to indent

[Python-ideas] Re: Arrow functions polyfill

2021-02-15 Thread Greg Ewing
On 16/02/21 6:29 am, Guido van Rossum wrote: I can sympathize with trying to get a replacement for lambda, because many other languages have jumped on the arrow bandwagon, and few Python first-time programmers have enough of a CS background to recognize the significance of the word lambda. I

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Greg Ewing
On 17/02/21 7:10 am, Steven D'Aprano wrote: "It's Greek letter, like pi that you may remember from maths class. In some technical computer science, the Greek L, lambda, is used as the symbol for functions." The most accurate answer seems to be "Because somebody made a mistake transcribing a mat

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Greg Ewing
On 17/02/21 7:10 am, Steven D'Aprano wrote: Its no more "magic" than tuple, deque, iterator, coroutine, ordinal, modulus, etc, not to mention those ordinary English words with specialised jargon meanings like float, tab, zip, thread, key, promise, trampoline, tree, hash etc. Actually, I think i

[Python-ideas] Re: SimpleNamespace vs object

2021-02-17 Thread Greg Ewing
On 18/02/21 3:51 am, Ricky Teachey wrote: I would personally love for SimpleNamespace to get a shorter name and become a built-in. It is a fantastic object to use in all kinds of situations I find myself disagreeing with that. It's dead simple to define your own blank-object class, and you get

[Python-ideas] Re: Alternate lambda syntax

2021-02-17 Thread Greg Ewing
On 18/02/21 3:38 am, MRAB wrote: So a "byte" is part of a word (a word contains multiple characters). In the Burroughs B6900 architecture, programs consisted of 48-bit words broken up into 8-bit opcodes called "syllables". -- Greg ___ Python-ideas m

[Python-ideas] Re: Alternate lambda syntax

2021-02-18 Thread Greg Ewing
On 19/02/21 9:43 am, Steven D'Aprano wrote: Although I have heard from Ruby enthusiasts that the ability to write large, complex, multi-statement anonymous block functions is really useful, its not something I can personally say I have missed. Ruby may be somewhat different here, because Ruby's

[Python-ideas] Re: Integer concatenation to byte string

2021-03-02 Thread Greg Ewing
On 2/03/21 7:01 am, mmax42...@gmail.com wrote: Currently, the only way to concatenate an integer to a bytes object is by converting the integer to bytes with a function call before concatenating. No, it's not: >>> b = bytearray() >>> b.append(42) >>> b bytearray(b'*') -- Greg __

[Python-ideas] Re: allow initial comma

2021-03-12 Thread Greg Ewing
On 13/03/21 5:02 am, Ned Batchelder wrote: I think the only reason anyone ever used leading commas to begin with was because of languages that didn't allow a final trailing comma.  In those worlds, to keep the editing smooth, people moved the commas to the beginning of the line, Which doesn't

[Python-ideas] Re: Multiple dispatch transpilation

2021-03-16 Thread Greg Ewing
On 17/03/21 2:54 am, Marvin van Aalst wrote: it should in principle be possible to transform the code from |Class.method|to |method(class:type)|, *before compilation*essentially allowing the same optimizations. I don't think this transformation would help with anything. If the static analysis

[Python-ideas] Re: Suggesting feature for python - Big Set, Big Dictionary

2021-03-23 Thread Greg Ewing
On 24/03/21 7:47 am, Chris Angelico wrote: On Wed, Mar 24, 2021 at 5:35 AM Vijay Patel wrote: > Suggestion: 1. Big Set, Big Dictionary - > How would it be stored on disk? Would it be in some sort of database? If so, check out a database access module Also remember that virtual memory is a

[Python-ideas] Re: Reverse polish notation

2021-04-02 Thread Greg Ewing
On 3/04/21 3:51 pm, John wrote: Can't argue that long equations are hard to read. The question is which is harder. A slew of parenthesis makes a mess that's difficult to detangle. In my experience, RPN is always harder to read than infix. A slew of parens can be confusing, but a bunch of oper

[Python-ideas] Re: Reverse polish notation

2021-04-02 Thread Greg Ewing
On 3/04/21 4:33 pm, David Mertz wrote: add all these 20 receipts together without needing 19 "+" signs, but just one at the end. Um, that's not the way any RPN calculator I've seen works. You still need to press the "+" key 19 times, just in slightly different places. To get by with just one "

[Python-ideas] Re: Reverse polish notation

2021-04-02 Thread Greg Ewing
On 3/04/21 5:07 pm, John wrote: This fails when it's like b*((x*2^(3-a))-(7*c)), since you now have to look back and forth and get a handle on what each of the terms is. b x 2 3 a - ** * 7 c * - * is pretty much a set of steps (3 - a, raise 2 to that, multiply x by that, multiply 7 by c and subt

[Python-ideas] Re: Reverse polish notation

2021-04-03 Thread Greg Ewing
On 3/04/21 6:15 pm, David Mertz wrote: It's a long time ago, but I'm pretty sure I used ticker tape adding machines with a big ENTER button to separate numbers... Then the operation, usually +, at the end. That seems unlikely. If you don't tell it what to do with the numbers until the very end

[Python-ideas] Re: Reverse polish notation

2021-04-03 Thread Greg Ewing
On 4/04/21 6:50 am, Chris Angelico wrote: Algebra gives us a HIGHLY compact notation (far too compact to be truly useful in computing, as it's very blackboard/paper oriented) Anyone up for allowing Mathjax in Python source? -- Greg ___ Python-ideas

[Python-ideas] Re: Python Idea - extension of 'with'

2021-04-08 Thread Greg Ewing
On 9/04/21 2:59 am, anthony.flury via Python-ideas wrote: I was wondering whether a worthwhile extension might be to allow the `with` statement to have an `except` and `else` clauses I don't think I would find this very useful. My application-level exception handling is rarely that close to the

[Python-ideas] Re: Flatten function (was: Deprecate sum of lists)

2021-06-20 Thread Greg Ewing
On 21/06/21 6:04 am, Sebastian Berg wrote: * `flatten()` (alwasy copy) * `ravel()` (copies if needed, and additionally ensures contiguity) * `reshape(-1)` (copies if needed) They are all subtly different, unfortunately. There's also a .flat attribute, that returns a 1-d iterator! -- Greg

[Python-ideas] Re: Pre PEP: Python Literals (was custom strings before)

2021-07-05 Thread Greg Ewing
On 6/07/21 8:39 am, Guido van Rossum wrote: FWIW, we could make f-strings properly nest  too... So this is not an argument for backticks. An argument might be that single and double quotes currently do not nest and never have done, so having them start to nest but only in the context of f-strin

[Python-ideas] Re: Pre PEP: Python Literals (was custom strings before)

2021-07-05 Thread Greg Ewing
On 6/07/21 9:56 am, Jim Baker wrote: d = deferred_tag"Some expr: {:(x*2)}" All that is happening here is that this being wrapped in a lambda, which captures any scope lexically as usual. Is there reason to think this will be a common enough requirement to justify having an abbreviated syntax

[Python-ideas] Re: Complete recursive pickle dump

2021-08-27 Thread Greg Ewing
On 27/08/21 11:27 pm, Evan Greenup via Python-ideas wrote: If it contains function it will persist all its attribute, and code object. For example, if user pickle recursively dump a numpy ndarray into a pickle file, when user pickle load this file from a system which doesn't install numpy, its

[Python-ideas] Re: Add a special TypeError subclass for implementation errors

2021-09-03 Thread Greg Ewing
On 4/09/21 4:32 am, Guido van Rossum wrote: The question is, would anyone ever want to make a distinction between the two in *real* code? Another problem with this idea is that there isn't just one user and one author. Library code often calls other library code written by a different author, s

[Python-ideas] Re: Context manager for csv module 'reader' and 'DictReader'?

2021-09-05 Thread Greg Ewing
On 6/09/21 3:07 am, C. Titus Brown via Python-ideas wrote: with csv.DictReader.open(filename) as r: for row in r: … You can do this now: from contextlib import closing with closing(csv.DictReader.open(filename)) as r: ... IMO this is preferable than going around adding context m

[Python-ideas] Re: Context manager for csv module 'reader' and 'DictReader'?

2021-09-06 Thread Greg Ewing
On 7/09/21 5:46 am, C. Titus Brown via Python-ideas wrote: Maybe Greg missed that DictReader.open didn’t exist and was in fact what I was asking for! Sorry about that, I thought you were asking for context manager methods to be added to an existing file-like object. If csv.DictReader had a cl

[Python-ideas] Re: Invalidate list iterators after size changes?

2021-10-09 Thread Greg Ewing
On 9/10/21 11:24 am, Tyler Hou via Python-ideas wrote: Right now, the following code is valid in Python 3.9 (and infinitely loops): ``` lst = [1, 2, 3] for i in lst: lst.append(i) ``` 1. If the size of a list, set, or dict changes, invalidate all existing iterators to that containers. T

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-10-31 Thread Greg Ewing
On 1/11/21 4:59 am, David Mertz, Ph.D. wrote:     b = b I don't want to live in a universe where this could be anything other than a no-op in Python. -- Greg ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to py

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-11-22 Thread Greg Ewing
On 23/11/21 3:15 am, Remy wrote: Iterators to implement 'transformational' functions like map, filter, flat_map, 'reductional' functions like reduce, sum, join, and 'evaluate' functions like to_list and to_set. This would place a burden on all iterators to implement a large and complex interf

[Python-ideas] Re: Enhancing iterator objects with map, filter, reduce methods

2021-11-26 Thread Greg Ewing
On 27/11/21 11:34 am, Eric V. Smith wrote: Would adding something to the Iterator ABC really also add it to my class Foo? No, your class would need changing to inherit from the Iterator ABC. This is a big problem in general with "just add it to the ABC" ideas. A huge number of existing classe

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-01 Thread Greg Ewing
On 2/12/21 4:40 am, Paul Moore wrote: the intended use is that people must supply a list[int] or not supply the argument *at all*. I don't think this is a style of API that we should be encouraging people to create, because it results in things that are very awkward to wrap. -- Greg __

[Python-ideas] Re: inline Python functions and methods

2021-12-08 Thread Greg Ewing
On 9/12/21 12:03 am, Steven D'Aprano wrote: does that mean that the compiler will translate the above to: def eggs(a, b, c): def spam(*args): # Do something with args... thing = spam(a, b, c) ... If that's what's intended, it wouldn't really be an i

[Python-ideas] Re: inline Python functions and methods

2021-12-08 Thread Greg Ewing
On 9/12/21 2:07 am, TobiasHT wrote: If a function fails to be inlined at compiletime due to dynamic behavior of python, then the normal function call behavior can be the fallback The problem is that the compiler might *think* it knows where the module is at compile time, but at run time it tur

[Python-ideas] Re: Runtime-accessible attribute docstrings – take 2

2021-12-08 Thread Greg Ewing
On 9/12/21 12:50 am, tmkehrenb...@gmail.com wrote: The main criticism, I think, was that it is weird to have the docstring *below* the attribute. I don't think that's a problem. The docstring of a class or function is also below the name of the class or function. I think it's actually more cons

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-11 Thread Greg Ewing
On 11/12/21 1:22 pm, Christopher Barker wrote: Darn — the P and A are swapped there. "Argument" and "actual" both start with "A" -- does that help? -- Greg ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to pytho

[Python-ideas] Re: inline Python functions and methods

2021-12-11 Thread Greg Ewing
On 11/12/21 5:40 pm, TobiasHT wrote: > The right function to perform inlining on shall be determined at runtime and cached in the same scope as where it’s performing it’s operations from cases where the program performs large iterations or even in infinite loops and other cases that need optim

[Python-ideas] Re: Revisiting a frozenset display literal

2022-01-16 Thread Greg Ewing
U+2744 Snowflake, anyone? my_frozenset = ❄{1, 2, 3} -- Greg ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message a

[Python-ideas] Re: Revisiting a frozenset display literal

2022-01-18 Thread Greg Ewing
On 19/01/22 6:41 am, Rob Cliffe via Python-ideas wrote: I'm happy with the     f{ ... } Fine with me too. I'd also be happy with making frozenset a keyword. It's hard to imagine it breaking any existing code, it avoids having to make any syntax changes, and all current uses of frozenset() on

[Python-ideas] Re: Revisiting a frozenset display literal

2022-01-18 Thread Greg Ewing
On 19/01/22 6:41 am, Rob Cliffe via Python-ideas wrote: I'm happy with the     f{ ... } Fine with me too. I'd also be happy with making frozenset a keyword. It's hard to imagine it breaking any existing code, it avoids having to make any syntax changes, and all current uses of frozenset() on

[Python-ideas] Re: Allowing non-ASCII bracket and quote characters in source code

2022-01-19 Thread Greg Ewing
On 20/01/22 3:45 am, Alexandre Brault wrote: On 2022-01-18 6:12 p.m., Chris Angelico wrote: 3) Optional semantic difference: 【1, 2, 3】 is exactly the same as (1, 2, 3), but 【1, 2, 3) would be an error. What does it say about the viability of this idea that until the second part of that sentenc

[Python-ideas] Re: Revisiting a frozenset display literal

2022-01-20 Thread Greg Ewing
On 20/01/22 3:17 am, Joao S. O. Bueno wrote: But upon seeing a method call, we can just think first of a runtime behavior Correctly, btw. Any optimization there would be an exception, that people would have to know by heart. Frozensets are immutable, so nobody should be making any assumptions

[Python-ideas] Re: Allowing non-ASCII bracket and quote characters in source code

2022-01-20 Thread Greg Ewing
On 20/01/22 12:52 pm, Christopher Barker wrote: On Wed, Jan 19, 2022 at 2:12 PM Greg Ewing <mailto:greg.ew...@canterbury.ac.nz>> wrote: Those particular brackets are really confusing because they're half square and half round. And THAT is why this is a bad idea. I

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-25 Thread Greg Ewing
David Mertz wrote: Sorry. From my tablet. "Bug magnets" (it really, really wants to autocorrect that) At least it didn't correct it to "butt magnets". :-) -- Greg ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/l

Re: [Python-ideas] As-do statements/anonymous blocks in python

2018-07-28 Thread Greg Ewing
James Lu wrote: as expr [do comma-separated-expressions]: >block means evaluate expr, then call the result of the expression. If do is present, call it with the argument list after do. This kind of thing has been proposed before. Although it seems like a straightforward idea, there are s

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-28 Thread Greg Ewing
Abe Dillon wrote: others countering that `person.name ` is not how periods are used in natural languages, so using other symbols in unintuitive ways is perfectly fine. Dots have been used for attribute access in so many languages for so long that it has become the normal an

Re: [Python-ideas] Redefining method

2018-07-30 Thread Greg Ewing
Jamesie Pic wrote: def o.bar(self): ... You could get almost the same effect with from functools import partial def bar(self, other_args): ... o.bar = partial(bar, o) But IMO this is nowhere near being a common enough thing to do to justify having special syntax for it. -- G

Re: [Python-ideas] Syntactic sugar to declare partial functions

2018-08-13 Thread Greg Ewing
Abe Dillon wrote: [Bruce Leban] Lambda calculus IS computer science. It's a foundation of computer science. That doesn't mean it "IS" computer science. Set theory is a foundation of computer science. It's still it's own discipline. Lambda calculus is considered a part of computers scie

Re: [Python-ideas] Syntactic sugar to declare partial functions

2018-08-13 Thread Greg Ewing
Chris Angelico wrote: No, lambda calculus isn't on par with brakes - but anonymous functions are, and if they're called "lambda", you just learn that. It's like saying that people would find it easier to learn to drive if "brakes" were called "stoppers" or something. I don't think that's true.

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-15 Thread Greg Ewing
Steve Barnes wrote: * Brakes are used to apply breaking, I hope they actually apply braking, not breaking. :-) * A dinosaur is specifically an extinct terrible (formerly considered) lizard Which technically is not a lizard. -- Greg ___ Python

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-15 Thread Greg Ewing
Jonathan Fine wrote: Puffinus puffinus is the scientific name for Puff the Magic Dragon? -- Greg ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeof

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-15 Thread Greg Ewing
Alexandre Brault wrote: On 2018-08-15 03:32 PM, MRAB wrote: On 2018-08-15 18:27, MRAB wrote: > While we're at it, what's the only creature that's known commonly and only by its scientific name? I would have guessed Tyrannosaurus Rex I would have thought pretty much any dinosaur. -- Greg

Re: [Python-ideas] Off topic: 'strike a balance' - second language English

2018-08-21 Thread Greg Ewing
Jonathan Fine wrote: Matlab says: "Here, copy paste this and it'll work". To the point that the workspace is designed to automatically strip >>> from any copy and pasted commands. Maybe this is something Python's REPL should do? -- Greg ___ Python-i

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-22 Thread Greg Ewing
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 nouns.

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-22 Thread Greg Ewing
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 i

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-22 Thread Greg Ewing
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 givin

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-22 Thread Greg Ewing
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. That's

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-22 Thread Greg Ewing
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

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-23 Thread Greg Ewing
Steven D'Aprano wrote: The only difference between dict and lambda is time. Well, "more arbitrary" was perhaps a rather loose way of saying it. What I meant was that the chain of associations is shorter for "lambda" than for "s-expression", because the "s" refers to a word the reader is probab

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-24 Thread Greg Ewing
Stephen J. Turnbull wrote: Abe Dillon writes: > 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? Yes, if you want to think about it that way. For understanding what kinds of things an L

Re: [Python-ideas] A GUI for beginners and experts alike

2018-08-24 Thread Greg Ewing
Chris Barker via Python-ideas wrote: In fact, there was an effort along these lines a few years back: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ I don't know that it's seen much development lately. It hasn't, sorry to say. Turns out that writing and maintaining what is effective

Re: [Python-ideas] A GUI for beginners and experts alike

2018-08-24 Thread Greg Ewing
Chris Barker - NOAA Federal wrote: Now that you say that, I think I’m mingling memories — there was another project that attempted to wrap TKInter, wxPython, QT .. I always thought that was ill advised. You're probably thinking of "anygui" (named in the spirit of "anydbm"). As far as I remember

Re: [Python-ideas] A GUI for beginners and experts alike

2018-08-24 Thread Greg Ewing
Here are some PyGUI versions of the ABC Challenge. # Modal from GUI import ModalDialog, Label, TextField, Row, Column, Grid from GUI.StdButtons import DefaultButton, CancelButton from GUI.Alerts import note_alert a = TextField(width = 100) b = TextField(widt

Re: [Python-ideas] A GUI for beginners and experts alike

2018-08-24 Thread Greg Ewing
Mike Barnett wrote: Unsubscribing from this mess. “Python Ideas” ? We didn't mean to drive you away! Python discussions have a tendency to roam far and wide. It doesn't mean we're not interested in what you have to say. Any new package is naturally going to invite comparisons with similar thi

Re: [Python-ideas] On evaluating features [was: Unpacking iterables for augmented assignment]

2018-08-28 Thread Greg Ewing
Guido van Rossum wrote: we might propose (as the OP did) that this: a, b, c += x, y, z could be made equivalent to this: a += x b += y c += z But not without violating the principle that lhs += rhs is equivalent to lhs = lhs.__iadd__(lhs) Granted, this rule inevitably leads

Re: [Python-ideas] Pre-conditions and post-conditions

2018-08-28 Thread Greg Ewing
Wes Turner wrote: I'm going to re-write that in a pseudo-Eiffel like syntax: Maybe some magic could be done to make this work: def __init__(self, img: np.ndarray, x: int, y: int, width: int, height: int) -> None: def __require__(): x >= 0

Re: [Python-ideas] Pre-conditions and post-conditions

2018-08-29 Thread Greg Ewing
Jonathan Fine wrote: My message of support for Ivan quoted the Eiffel docs. https://www.eiffel.org/doc/eiffel/ET-_Design_by_Contract_%28tm%29%2C_Assertions_and_Exceptions During development and testing, assertion monitoring should be turned on at the highest possible level. Combined with st

Re: [Python-ideas] Fix some special cases in Fractions?

2018-08-29 Thread Greg Ewing
Jeroen Demeyer wrote: On 2018-08-30 06:39, Neil Girdhar wrote: I'd like these to be Fraction(1), Fraction(1), and Fraction(0). Why? I cannot think of any natural use case why you would want Fractions for a few special cases on an operation which returns non-Fractions generically. Also, Fr

Re: [Python-ideas] Fix some special cases in Fractions?

2018-08-30 Thread Greg Ewing
Jonathan Goble wrote: How? Raising something to the 2/3 power means squaring it and then taking the cube root of it. On reflection, "wrong" is not quite accurate. A better word might be "surprising". (-1) ** (2/3) == 1 would imply that 1 ** (3/2) == -1. I suppose that could be considered true

Re: [Python-ideas] Fix some special cases in Fractions?

2018-08-30 Thread Greg Ewing
Neil Girdhar wrote: we want branch continuity in the power. After all, floating point values have some inaccuracy, and we wouldn't want chaotic behavior, i.e., small changes to the power to have drastic changes to the result. This is not like Fraction where we know that x ** Fraction(1, 3) i

Re: [Python-ideas] Fix some special cases in Fractions?

2018-08-30 Thread Greg Ewing
Neil Girdhar wrote: Powers of other numbers have to keep the same behavior since in general those kinds of expressions don't create rational numbers. There are infinitely many other rational numbers that *could* be given the same treatment, though, e.g. (-8) ** (2/3). If you don't want to inclu

Re: [Python-ideas] Add recordlcass to collections module

2018-09-02 Thread Greg Ewing
Zaur Shibzukhov wrote: > `Recordclass` is defined on top of` memoryslots` just like `namedtuple` > above` tuple`. Attributes are accessed via a descriptor (`itemgetset`), > which supports both` __get__` and `__set__` by the element index. > > As a result, `recordclass` takes up as much memory as`

Re: [Python-ideas] Pre-conditions and post-conditions

2018-09-03 Thread Greg Ewing
Jonathan Fine wrote: I've just read and article which makes a good case for providing pre-conditions and post-conditions. http://pgbovine.net/python-unreadable.htm There's nothing in there that talks about PBC-style executable preconditions and postconditions, it's all about documenting the l

Re: [Python-ideas] Executable space protection: NX bit,

2018-09-03 Thread Greg Ewing
Jonathan Fine wrote: # Evil code! ask_delete.__code__, ask_save.__code__ = ask_save.__code__, ask_delete.__code__ If an attacker can trick you into executing that line of code, he can probably just delete your data directly. -- Greg ___ Pyt

Re: [Python-ideas] Keyword only argument on function call

2018-09-06 Thread Greg Ewing
Rhodri James wrote: that syntax looks at best highly misleading -- how many parameters are we passing? I don't like it at all. Maybe something like this would be better: f(=a, =b, =c) Much more suggestive that you're passing a keyword argument. As for whether consistent naming is a good

Re: [Python-ideas] Fwd: Add Unicode-aware str.reverse() function?

2018-09-08 Thread Greg Ewing
Stephan Houben wrote: To be honest, quite apart from the Unicode issue, I never had a need to reverse a string in real code. Yeah, seems to me it would only be useful if you were working on some kind of word game such as a palindrome generator, or if your string represents something other than

Re: [Python-ideas] Retire or reword the "Beautiful is better than ugly" Zen clause

2018-09-13 Thread Greg Ewing
Jacco van Dorp wrote: You can have master and slave devices - for example, if I have a PC that tells a robot what to do, my PC is the master and the robot the slave. If we're going to object to "slave", we should object to "robot" as well, since it's derived from a Czech word meaning "forced w

Re: [Python-ideas] Retire or reword the "Beautiful is better than ugly" Zen clause

2018-09-13 Thread Greg Ewing
M.-A. Lemburg wrote: For me, it refers to a general feeling of consistency, pureness and standing out on its own. It's abstract and doesn't have anything to do with humans. Yep. And the proposed replacement "clean/dirty" doesn't even mean the same thing. It's entirely possible for a thing to be

Re: [Python-ideas] Retire or reword the "Beautiful is better than ugly" Zen clause

2018-09-13 Thread Greg Ewing
Calvin Spealman wrote: I ask everyone on this thread being rude to please step back and try to look at the issue without your bias and knee-jerk reactions. I've given it some thought, and this is what I think: As has been pointed out, context is important. The reason that shunning people for n

Re: [Python-ideas] Retire or reword the "Beautiful is better than ugly" Zen clause

2018-09-14 Thread Greg Ewing
Tim Delaney wrote: And I can't think of an elegant replacement for "ugly" to pair with "elegant". There's "inelegant", but it doesn't have the same punch as "ugly". And I think Tim deliberately chose a very punchy word for that line, to reflect that we care a *lot* about aesthetics in Python.

Re: [Python-ideas] Retire or reword the "Beautiful is better than ugly" Zen clause

2018-09-14 Thread Greg Ewing
Guido van Rossum wrote: Facts to consider: (a) the OP's address is ...@yandex.com , a well-known Russian website (similar to Google); (b) there's a Canadian actress named Samantha Quan. Now I'm waiting for the Kremlin to deny rumours that the Canadian actress Samantha Quan i

Re: [Python-ideas] Retire or reword the "Beautiful is better than ugly" Zen clause

2018-09-15 Thread Greg Ewing
Chris Barker via Python-ideas wrote: "efficient is better than inefficient" kind of goes without saying... Perhaps we should just replace the entire Zen with "Good is better than bad." Insert your own subjective ideas on what constitutes "good" and "bad" and you're set to go. :-) -- Greg _

Re: [Python-ideas] Moving to another forum system where moderation is possible

2018-09-20 Thread Greg Ewing
Mark E. Haase wrote: I would also appreciate a +1 button. Many e-mails to this list do nothing more than say +1 or -1 without much added discussion. A tiny bit of discussion is still better than none at all. And even if there's no discussion, there's a name attached to the message, which makes

Re: [Python-ideas] Moving to another forum system where moderation is possible

2018-09-20 Thread Greg Ewing
Mark E. Haase wrote: Many e-mails to this list do nothing more than say +1 or -1 without much added discussion. Are there really all that many? They seem relatively rare to me. Certainly not enough to annoy me. -- Greg ___ Python-ideas mailing list P

Re: [Python-ideas] Moving to another forum system where moderation is possible

2018-09-20 Thread Greg Ewing
Mikhail V wrote: I think there are forum systems which allow you to post by email so it is possible to get the same effect as with mailing list, if you really want. I hope that, if any such change is made, a forum system is chosen that allows full participation via either email or news. Otherwi

Re: [Python-ideas] Moving to another forum system where

2018-09-21 Thread Greg Ewing
James Lu wrote: I believe GitHub has direct email capability. If you watch the repository and have email notifications on, you can reply directly to an email and it will be sent as a reply. Can you start a new topic of conversation by email, though? The best solution would to have admins rece

Re: [Python-ideas] Moving to another forum system where

2018-09-21 Thread Greg Ewing
Chris Barker via Python-ideas wrote: One of the problems with the assignment expression discussion is that it got pretty far on python-ideas, then moved to python-dev, where is was further discussed (and there were parallel thread on the two lists) As long as there are two lists with similar

Re: [Python-ideas] Why is design-by-contracts not widely adopted?

2018-09-26 Thread Greg Ewing
Chris Angelico wrote: For example, matplotlib's plt.show() method guarantees that... a plot will be shown, and the user will have dismissed it, before it returns. Unless you're inside Jupyter/iPython, in which case it's different. Or if you're in certain other environments, in which case it's dif

  1   2   3   4   5   6   7   8   9   >