[Python-ideas] Re: Possibility to decorate single code line or code block?

2020-12-21 Thread Jonathan Fine
Hi Paul I get a syntax error. The code won't even compile. I don't see how your code can avoid it. Are you sure your example works? $ python3.8 Python 3.8.0 (default, Oct 28 2019, 16:14:01) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> @TimeIt ...

[Python-ideas] Re: Possibility to decorate single code line or code block?

2020-12-21 Thread Jonathan Fine
Hi Christopher I did notice the unusual command line, but didn't think any more of it. I thought everything I needed to look at was already in the message. A reference to https://pypi.org/project/importhook/ would have helped me. I don't see importhook providing a practical implementation of the

[Python-ideas] Re: A PEP to encourage people to mind docstrings in stub files

2020-12-22 Thread Jonathan Fine
Hi Alexey You wrote that docstring-related software generally fails to handle docstrings properly in stub files. I don't have experience of this, probably because I don't use such software. Please would you provide some examples. Ideal would be issued that have been raised (by you if need be) for

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

2021-01-01 Thread Jonathan Fine
Hi I'd say the problem isn't recursion. Here I'm using the definitions given in: https://en.wikipedia.org/wiki/Recursion https://www.cs.utah.edu/~germain/PPS/Topics/recursion.html Rather, it's that the data has a loop (or cycle) in it. A simple example of this is >>> x = [] >>> x.append(x

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

2021-01-01 Thread Jonathan Fine
Hi Richard You suggested A very simple and in my mind reasonable use for this is to build a > representation of a graph, where each node is represented by a list (or > some other collection), and the connections are denoted by adding to > that collection the nodes that are adjacent (or maybe a tu

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

2021-01-01 Thread Jonathan Fine
Hi Jeff You wrote: Detecting cycles will involve a lot of bikeshedding. (Sorry, couldn't > resist.) > Indeed. That really brought a smile to my face. Thank you. As I recall, bikeshedding is endless discussion (cycles again) of the COLOUR to paint the bikeshed. And in mathematics there's the top

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

2021-01-01 Thread Jonathan Fine
Hi Jeff > But you're right, that's a better word for discussing the problem. > Steven's problem data structures are cyclic graphs. I don't agree that such > structures are a sign one is doing something wrong (outside the naive > approach to printing them out). > Thank you for agreeing with me, an

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

2021-01-01 Thread Jonathan Fine
Hi Richard You wrote I believe that one solution to detecting the cycles is to create a set > of the object IDs you have visited and started to print. If you come > across an ID you have already seen, this point is in a cycle. Sets are > fairly compact and intentionally fast to search for an item

[Python-ideas] Re: (Off-topic) Different object, same id

2021-01-01 Thread Jonathan Fine
Bravo, Jeff. I couldn't have chosen a better example. However, I'd expect large ints to be stored in two parts. A (class, pointer) pair which has fixed size. And memory referenced by the pointer, large enough to store the value of the large int. However, that's part of the language implementation

[Python-ideas] Off-topic: Happy Birthday, Don Knuth (and Python coroutines)

2021-01-10 Thread Jonathan Fine
Hi Don Knuth, author of The Art Of Computer Programming and creator of the TeX typesetting system is 83 today. Happy Birthday Don. Thank you for TeX and everything else. You're warmly invited to join me online to celebrate Don's life and work. The virtual party is on Thursday 14 January, 6:30 to

[Python-ideas] Off-topic: What costs NaN pounds for a null amount?

2021-01-14 Thread Jonathan Fine
Hi There's interest here in arithmetic operations on NaN . I've just seen a product listed as costing NaN pounds to buy a null amount. That was written as £NaN/null. The bargain item is Glade Shake & Vacuum Citrus, and you can see it at https://www.tesco.com/groceries/en-GB/products/253732570 Se

[Python-ideas] Re: Itertools generator injection

2021-03-20 Thread Jonathan Fine
Hi I see two issues. The first is present behaviour. The second is alternative ways of ordering the elements of a Cartesian product. Here's an example of the present behaviour. >>> iter_range = iter(range(100)) >>> prod = itertools.product(iter_range, "abcdef") >>> next(iter_range)

[Python-ideas] Re: Adding syntax for the empty set

2021-04-09 Thread Jonathan Fine
In August 2020, in the context of PEP 472 I suggested >>> {-} for the empty set literal. At present the closest we can do for an empty set literal is >>> {0} - {0} set() The context for this is whether PEP 472 should make >>> something[] a syntax error. If we do then, what about th

[Python-ideas] Re: String comprehension

2021-04-30 Thread Jonathan Fine
Hi David I see where you are coming from. I find it helps to think of sep.join as a special case. Here's a more general join, with sep.join equivalent to genjoin(sep, '', ''). def genjoin(sep, left, right): def fn(items): return left + sep.join(items) + right retur

[Python-ideas] Re: String comprehension

2021-04-30 Thread Jonathan Fine
On Fri, Apr 30, 2021 at 6:00 PM Chris Angelico wrote: For those cases where you're merging literal parts and generated > parts, it may be of value to use an f-string: > > >>> f"[{','.join('0123')}]" > '[0,1,2,3]' > > The part in the braces is evaluated as Python code, and the rest is > simple lit

[Python-ideas] Re: String comprehension

2021-05-03 Thread Jonathan Fine
Summary: The argument in list(arg) must be iterable. The argument in str(arg) can be anything. Further, in [ a, b, c, d ] the content of the literal must be read by the Python parser as a Python expression. But in "this and that" the content need not be a Python expression. Hi David I find your s

[Python-ideas] OT: Accessibility: Jana Schroeder's Holman Prize Application

2021-05-10 Thread Jonathan Fine
Perhaps Off Topic, but for a good cause. This year I met Jana Scroeder, a blind person forced to change jobs as part of the social cost of Covid. Her outsider experience of computer coding training became a wish to make things better. She has applied for a Holman Prize ($25,000 over a year) to fun

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-14 Thread Jonathan Fine
Martin wrote: when dividing two integers, the result is a float, which means we > immediately lose precision. This is not good if you want to use code which > supports higher precision. I am of course in favour of keeping precision, if there is no cost. But here there is a cost. Arbitrary precis

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-14 Thread Jonathan Fine
Hi Martin I think it important to realise there are at least two issues. The first is whether sometimes fraction is better than float, and vice versa. The second is whether the default behaviour for int / int should be changed. A third issue is whether some of the benefits you are seeking can be

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-14 Thread Jonathan Fine
Martin wrote So, if you show them (the following is fake) > > >>> 1/2 + 1/3 > 5/6 > 1 / 2 + 1 / 3 > 0.83 > > They will immediately spot what's going on. > I'm sighted. I can see the difference. I suspect a blind person using a screen reader would struggle a lot to spot th

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Jonathan Fine
Martin wrote: In general, doing symbolic math in Python is not very beautiful. I think this is a problem worth investigating. (Disclaimer: I do research in pure mathematics.) > The number of hoops you have to jump through is large, mostly because > syntax is abused for things it was not actual

[Python-ideas] Re: symbolic math in Python

2021-05-19 Thread Jonathan Fine
Martin wrote: as you might have noticed, I am trying to improve the syntax and semantics > for symbolic math in Python. Until now, I have to say, my ideas were not > that well received, but I learned from the discussion and maybe this time I > come up with something people like. > For about 10 ye

[Python-ideas] SEMANTICS for 'variables' produced by a decorator

2021-05-29 Thread Jonathan Fine
There's been a discussion in this list on extending Python to provide SYNTAX such as @decorator name = EXPRESSION and also suitable semantics. (Here 'name' is an identifier, in the discussion called a 'variable'.) This post is about providing SEMANTICS for such decorator syntax. We can do

[Python-ideas] Re: dict.sort()?

2021-05-29 Thread Jonathan Fine
On Sat, May 29, 2021 at 6:01 PM Chris Angelico > But if you're okay with constructing a new dict, you can do this: > > d = dict(sorted(d.items(), key=lambda kv: ...)) > Or to keep the same dict (not tested) tmp = list(sorted(d.items())) d.clear() d.update(tmp) -- Jonathan _

[Python-ideas] Re: The name Ellipsis should be a constant

2021-06-01 Thread Jonathan Fine
We have the following. >>> 12 = True SyntaxError: can't assign to literal >>> True = False SyntaxError: can't assign to keyword >>> ... = False SyntaxError: can't assign to Ellipsis We also have (works better in monospaced font) >>> d[] = True d[] = True

[Python-ideas] Off topic: Rational discursive thought and helping others

2021-06-22 Thread Jonathan Fine
Off-topic Someone on this list wrote: Mu. > > https://en.wikipedia.org/wiki/Mu_(negative)#%22Unasking%22_the_question This is a koan, a device in Zen Buddhism used by a teacher to help the student liberate themselves from being imprisoned by rational discursive thought. Here is another koan.

[Python-ideas] Re: disallow assignment to unknown ssl.SSLContext attributes

2021-06-25 Thread Jonathan Fine
Thank you Thomas for concisely and fairly reporting your experience, and based on that suggesting a way to improve Python. Thank you for taking the time to do this. Here's a typo that caused a bug (which inconvenienced the original poster): context.miunimum_version = ssl.TLSVersion.TLSv1_3 > cont

[Python-ideas] Re: disallow assignment to unknown ssl.SSLContext attributes

2021-06-25 Thread Jonathan Fine
It may help to think separately about existing code using ssl, and about new code. However, I'm not a user of ssl, so please doubt my opinions below. EXISTING CODE Those maintaining existing code might welcome an easy way of checking that the code doesn't have a misleading assignment. They might a

[Python-ideas] Re: disallow assignment to unknown ssl.SSLContext attributes

2021-06-28 Thread Jonathan Fine
Thomas Grainger wrote: It looks like there's a consensus being reached, should I create a bpo? > Perhaps first state what seems to be the consensus and invite further comments before going to bpo. Disclaimer: I'd like to see both: 1. Something on PyPi to help persons who are using ssl on curren

[Python-ideas] Re: CACHEDIR.TAG for __pycache__ on Linux

2021-07-02 Thread Jonathan Fine
Hi Leon (and Bryan) Here's some comments on your interesting suggestion. Bryan Ford's CACHEDIR.TAG proposal is supported by gnu tar. See: https://www.gnu.org/software/tar/manual/html_node/exclude.html By the way, I've copied Bryan. There's a cachedir_tag module on PyPi, by Alex Willmer: https:/

[Python-ideas] Re: writelines2?

2021-07-13 Thread Jonathan Fine
The interactive help message for writelines gives no help. I've made an enhancement request to b.p.o. help(open('/dev/zero').writelines) gives no help https://bugs.python.org/issue44623 Please take a look. -- Jonathan ___ Python-ideas mailing list --

[Python-ideas] Re: writelines2?

2021-07-13 Thread Jonathan Fine
Thank you Paul. I used my default Python, which is Python 3.6. However, with 3.7 and 3.8 I get the same as you. I've promoted you 'works for me' on b.p.o to 'not a bug'. Thank you again. -- Jonathan ___ Python-ideas mailing list -- python-ideas@python.o

[Python-ideas] Re: New 'How to Write a Good Bug Report' Article for Docs

2021-08-16 Thread Jonathan Fine
Jonathan Goble wrote: > Is there a reason why we can't just link to the Wayback Machine copy like > you did here? > I agree with that as immediate first aid. It seems that wikipedia practice now is to link to both the original article and to a copy on the wayback machine. I've found some perhap

[Python-ideas] Re: Addition of a "plus-minus" binary numeric operator

2021-09-14 Thread Jonathan Fine
Hi Yahbai You might wish to reconsider your proposal in light of existing behaviour >>> 1+-1 0 Consider also your proposed >>> a, b = 2 +- 1 We know that {a, b} = {1, 3}. But which is which? In your use case you might be better off introducing a custom type >>> lims = pm(2, 1) >>> lims.lo, lims.

[Python-ideas] Re: def variable = value

2021-10-23 Thread Jonathan Fine
>From my phone. An important thing about def x and class A is that the strings x and A are made available to the constructor for x and A respectively. The same is not true for x=val. Jonathan ___ Python-ideas mailing list -- python-ideas@python.org To u

[Python-ideas] Re: def variable = value

2021-10-24 Thread Jonathan Fine
Hi Serhiy Thank you for so clearly explaining how names get passed to function and class constructors. You also wrote: > We do not have generalized way to call arbitrary constructor with > automatically passing __name__, __qualname__ and __module__. And it would > be convenient. > > create n

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

2021-10-24 Thread Jonathan Fine
Hi Please forgive me if it's not already been considered. Is the following valid syntax, and if so what's the semantics? Here it is: def puzzle(*, a=>b+1, b=>a+1): return a, b Aside: In a functional programming language a = b + 1 b = a + 1 would be a syntax (or at least compi

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

2021-10-24 Thread Jonathan Fine
Hi Chris You wrote: In fact, on subsequent consideration, I'm inclining more strongly > towards SyntaxError, due to the difficulty of explaining the actual > semantics. Changing the PEP accordingly. Your PEP, so your choice. I now think that if implemented, your PEP adds to the Python compiler

[Python-ideas] PEP 671 proof-of-concept: A less invasive implementation

2021-10-30 Thread Jonathan Fine
Hi One of the motives for PEP 671 is that the signature of a function fn, and hence the associated help(fn) is sometimes opaque regarding default values. I won't repeat the excellent examples already given. In the current implementation default values are handled outside the compiled code of the

[Python-ideas] Re: PEP 671 proof-of-concept: A less invasive implementation

2021-10-30 Thread Jonathan Fine
Hi Chris I like your questions. You ask: How would fn.__wibble__ be different from checks at the top of fn.__code__? They'd be in two different code blocks. I see a function call going as follows. 1. Process the supplied arguments in the usual way. 2. Create a new frame object and place it on the

[Python-ideas] Re: PEP 671 proof-of-concept: A less invasive implementation

2021-10-31 Thread Jonathan Fine
Hi I've just had a brainwave that may give an even less invasive implementation of PEP 671. It relies on every function having a dict, as provided by https://www.python.org/dev/peps/pep-0232/. Consider: def fn(a, b, c): pass fn.__wibble__ = 123 fn.__wibble__ # Give 123, of course. No

[Python-ideas] Re: PEP 671 proof-of-concept: A less invasive implementation

2021-10-31 Thread Jonathan Fine
Hi Chris Again you ask good questions. Q: How to find the bare string '#wibble'? It's optimised out during compilation. A: Very good. I didn't know that. For current Python we'll have to use a different marker. For future Python we could change the compiler so that it directly sets fn.__wibble__

[Python-ideas] Re: Compiler from python to WebAssembly

2021-12-05 Thread Jonathan Fine
Hi Ricard Python to web assembly is a good idea that is already being developed. The first result from this search https://www.google.com/search?q=python+webassembly is the project https://github.com/pyodide/pyodide. Also relevant is https://www.theregister.com/2021/11/30/python_web_wasm/ You lo

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

2022-01-16 Thread Jonathan Fine
Summary: Further information is provided, which suggests that it may be best to amend Python so that "frozenset({1, 2, 3})" is the literal for eval("frozenset({1, 2, 3})"). Steve D'Aprano correctly notes that the bytecode generated by the expression x in {1, 2 ,3} is apparently not optimal. He

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

2022-01-17 Thread Jonathan Fine
The compiler can figure out that the value of {1, 2, 3} is a set containing the elements 1, 2 and 3. The problem with the value of frozenset({1, 2, 3}) is that the value of frozenset depends on the context. This is because frozenset = print is allowed. According to help(repr): repr

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

2022-01-17 Thread Jonathan Fine
Earlier today in https://bugs.python.org/issue46393, Serhiy Storchaka wrote: As Steven have noted the compiler-time optimization is not applicable here because name frozenset is resolved at run-time. In these cases where a set of constants can be replaced with a frozenset of constants (in "x in {

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

2022-01-19 Thread Jonathan Fine
Joao's {1, 2, 3}.frozen() shows real originality, arising from deep creative thought about the roots of the problem. I was both surprised and delighted when I saw it, and I think some others were too. (I agree with others that here 'freeze' is better than 'frozen'.) Obviously, each of the two

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

2022-01-27 Thread Jonathan Fine
Hi Steve D'Aprano started this thread on 16 Jan, referencing https://bugs.python.org/issue46393. In the 95th message in this thread, on 27 Jan, Stephen J. Turnbull wrote: I think for many of us (specifically me, but I don't think I'm alone) it's > equally important that we aren't persuaded that

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

2018-07-25 Thread Jonathan Fine
Hi All To start this thread, on 18 July, Steve Dower wrote: > Possibly this is exactly the wrong time to propose the next big syntax > change, since we currently have nobody to declare on it, but since we're > likely to argue for a while anyway it probably can't hurt (and maybe this > will become

Re: [Python-ideas] Can we add "zip and assert equal length" to the standard library?

2018-07-27 Thread Jonathan Fine
Hi Peter Thank you for your deferred default values idea, which we're now working on together. https://github.com/petered/peters_example_code/blob/master/peters_example_code/deferral.py You wrote: > I find that about 90% of the time I want want to zip iterators together, I > expect them to be the

Re: [Python-ideas] Can we add "zip and assert equal length" to the standard library?

2018-07-28 Thread Jonathan Fine
Hi All I've followed my own advice, earlier in this thread. The newly created repository https://github.com/jfine2358/py-jfine2358 contains personal Python code that others might find useful. And you'll find in it: === https://github.com/jfine2358/py-jfine2358/blob/master/jfine2358/itertools.py

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

2018-07-28 Thread Jonathan Fine
Hi James This is an attempt to respond to the issues that be lying behind your request for code blocks in Python. It's my two cents worth (https://en.wikipedia.org/wiki/My_two_cents) of opinion. I really do wish we could have language that had all of Ruby's strengths, and also all of Python's. Th

Re: [Python-ideas] slice[] to get more complex slices

2018-07-28 Thread Jonathan Fine
Hi Stephan I took a look at your personal web site. Your PhD sounds interesting. Quantum coherence and photosynthesis. But off-topic here. (Sadly, personal web sites are a bit of mess.) You wrote: > I'd really like to move this proposal forward in some form. +10 > As a next step, would it be he

Re: [Python-ideas] Redefining method

2018-07-30 Thread Jonathan Fine
Hi Jamesie Thank you for your question. You asked why not > c = MyClass > o = c() > > def c.foo(cls): ... > def o.bar(self): ... I've the same same query, but never had the courage to ask. So that you for asking. And also giving me a chance to share my thoughts. In Ruby, I believe, you can 'open

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

2018-07-31 Thread Jonathan Fine
David Mertz wrote: > `spam?.eggs?.cheese?.aardvark` is NOT redundant for > `spam?.eggs.cheese.aardvark`. The two expressions simply do different > things [...] I agree, assuming ?. is a binary operator. Given this, in Python (+ PEP 505) one can write tmp = spam ?. eggs val1 = tmp ?. ch

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

2018-07-31 Thread Jonathan Fine
Stephan Houben wrote: > Nope, the introduction of the tmp variable changed the semantics. It isn't a > "chain" anymore so it breaks shortcutting. I'm confused. Assume 'a' is not defined. With Python's dot (attribute access) we have >>> a.b.c NameError: name 'a' is not defined >>> a.(b.c) SyntaxE

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

2018-08-01 Thread Jonathan Fine
Hi All I have two further questions. I'm keen to clarify what is the behaviour specified by PEP 505. I'm not, at this time, interested in why and how PEP 505 specifies behaviour. I just wish, through explicit examples, to clarify the behaviour that is specified. Here 'a' is an identifier. Conside

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

2018-08-01 Thread Jonathan Fine
Hi Chris Thank you for your prompt reply. You wrote > Incorrect. The short-circuiting behaviour ends at any sort of > grouping. It's like how "a < b < c" is not equivalent to "(a < b) < > c", nor to "a < (b < c)". You've told me that my answer B is wrong. But you've not provided your correct ans

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

2018-08-01 Thread Jonathan Fine
Hi Chris You wrote: > Oh. The equivalent ones are #1 and #2, and #7 and #8, where this > proposal doesn't change anything. Otherwise, they're not equivalent. Are you sure. I'd also expect #10 and #11 to be equivalent. By the way, there's a typo in my examples: 11) (a .? b) ?. c -- Jonathan __

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

2018-08-01 Thread Jonathan Fine
Hi Chris Thank you for your reply. I think we're making good progress. You wrote >> 10) a ?. b ?. c >> 11) (a ?. b) ?. c > > I would parse those differently, but you may be right that they'll > always have the same final result. I'd like to get some certainty on this. I'm not aware of any value

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

2018-08-01 Thread Jonathan Fine
Hi Chris We're discussing. > 10) a ?. b ?. c > 11) (a ?. b) ?. c I asked > So, are there any values of 'a' for which #10 and #11 don't give the > same result? You replied > I'm not prepared to put my neck out and say "They are absolutely > identical" and have people jump on me with some technica

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

2018-08-01 Thread Jonathan Fine
Hi Stephan You wrote > Let me stand up and claim that if a chain consists *only* of None-coalescing > operations, then breaking up the chain by adding parentheses does not > matter, ever. You missed a post I made, 17 minutes before yours. I then believed that PEP 505 specified. #1. (None ?. dne

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

2018-08-01 Thread Jonathan Fine
Hi Steve Thank you for your reply. We're discussing the abstract to PEP 505, which writes === The "None-aware attribute access" operator ?. ("maybe dot") evaluates the complete expression if the left hand side evaluates to a value that is not None === I gave (42).str as an example. I wrote > I

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

2018-08-01 Thread Jonathan Fine
Chris Angelico wrote: > It may be true, but it isn't better IMO - especially not for the > abstract. It's unnecessarily pedantic. The current wording isn't > ambiguous, because infinite recursion makes no sense. Thank you for this. Please take a look and compare https://www.python.org/dev/peps/p

Re: [Python-ideas] PEP 505: None-aware operators: operators ?= and ?? and OR

2018-08-02 Thread Jonathan Fine
Hi Eric [Steve Dower: Eric seems to have found a bug in the PEP. Where to report?] You quoted, from PEP 505, Before > mangle_from_ = True if policy is None else policy.mangle_from_ After > mangle_from_ = policy?.mangle_from_ ?? True You then remarked > I cannot see how these are equivalent I

Re: [Python-ideas] PEP 505: None-aware operators: operators ?= and ?? and OR

2018-08-03 Thread Jonathan Fine
Hi Alexandre Thank you for your post. In PEP 505 the context for the example being discussed is: > Some of these are shown below as examples before and after converting to use > the new operators. You wrote: > So yes, *strictly speaking* the two chunks of code are not exactly the same. I see

Re: [Python-ideas] Revisiting dedicated overloadable boolean operators

2018-08-03 Thread Jonathan Fine
Hi Todd Thank you for your contribution! I've got a couple of comments. The experts, I hope, will have more to say. You wrote: > As to why this is useful, the overall problem is that the current logical > operators, like and, or, and not, cannot be overloaded, which means projects > like numpy a

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

2018-08-04 Thread Jonathan Fine
Here's my opinion, in a nutshell. A diet with a small amount of sugar is healthy. But too much sugar is not. https://www.nhs.uk/live-well/eat-well/how-does-sugar-in-our-diet-affect-our-health/ I have a similar attitude to syntactic sugar. Sometimes helpful. https://news.ycombinator.com/item?id=16

Re: [Python-ideas] File format for automatic and manual tests

2018-08-08 Thread Jonathan Fine
Hi Victor Thank you for your contribution, regarding standards for Python tools. Here is my two cents worth. You wrote: > We need a standard to make PyCharm and others to conform to it. Things don't quite work that way, in the Python community. True, we have a Benevolent Dictator For Life (BDFL)

Re: [Python-ideas] Python certification

2018-08-09 Thread Jonathan Fine
Hi Patrick and Oleg Thank you, respectively, for a good question and a helpful response. Patrick asks: > Does anyone know of any PSF approved training or certifications for Python > developers? Oleg writes: > The python-ideas list is for discussing more speculative design ideas of > Python t

Re: [Python-ideas] Python certification

2018-08-09 Thread Jonathan Fine
Hi Oleg You wrote >In what way certification programs are related to documentation, > especially to the tutorial? One way is through syllabus. Necessarily, a certification via exam requires a syllabus (or a course of study). There is, implicitly, a syllabus in https://docs.python.org/3/tutor

[Python-ideas] Python Community Code of Conduct

2018-08-13 Thread Jonathan Fine
https://www.python.org/psf/codeofconduct/ Python Community Code of Conduct The Python community is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences great successes and continued gr

Re: [Python-ideas] Toxic forum

2018-08-14 Thread Jonathan Fine
Hi All Here's something that's at the core of my approach. Faced with this sort of problem, I read again https://www.python.org/psf/codeofconduct/. And then I compare my intentions, words and actions to the guidelines in this, the Python Community Code of Conduct. Only when I have, so to speak, r

Re: [Python-ideas] Python docs page: In what ways is None special

2018-08-14 Thread Jonathan Fine
Hi I'm pleased to announce that I've completed the first draft of my page. It's viewable on gitub. https://github.com/jfine2358/py-jfine2358/blob/master/docs/none-is-special.md To quote from that page: This page arose from a thread on the python-ideas list. I thank Steve Dower, Paul Moore, Steve

Re: [Python-ideas] Conduct on python-ideas

2018-08-14 Thread Jonathan Fine
Hi Everyone Brett Cannon wrote: > I shouldn't be having to explain to adults on how to communicate among > strangers of different cultures, but here we are. I did an entire PyCon US > keynote on why we need to treat open source as a series of kindnesses and > react as such: https://youtu.be/tzFWz

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

2018-08-15 Thread Jonathan Fine
Steve Barnes and Greg Ewing wrote: >> * A dinosaur is specifically an extinct terrible (formerly considered) >> lizard > > > Which technically is not a lizard. I can't resist. Puffinus puffinus is the scientific name for (drum roll) no, not the Atlantic (or common) Puffin but (off-pitch fanf

Re: [Python-ideas] Python docs page: In what ways is None special

2018-08-15 Thread Jonathan Fine
Hi Thank you all, for the kind words and appreciation, and the comments and suggestions. I have time now to respond to one comment. Please note that is just my opinion, and your opinion may be different. Rhodri James prefers (https://mail.python.org/pipermail/python-ideas/2018-August/052742.html)

Re: [Python-ideas] Jump to function as an an alternative to call function

2018-08-15 Thread Jonathan Fine
Hi Jacob Thank you for your problem. I'll focus on your simple example (lightly edited for clarity) > Let foo(a, b) be the syntax to call foo(a, b), and foo(a, b)% be the syntax > to jump to foo(a, b) > > c = 5 > > def foo(a): > return a + c > > def bar(a, c): > return foo(a) > >

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

2018-08-16 Thread Jonathan Fine
Hi Marko Thank you for introducing yourself, and clearly stating your question. That helps us all. You asked: > Could somebody update me on the state of the discussion on this matter? I think bring the existing PEP up to date would be a good starting point. Its content hasn't been changed since

Re: [Python-ideas] Python docs page: In what ways is None special

2018-08-16 Thread Jonathan Fine
Hi Neil Thank you for your post, regarding https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy. You've suggested changing "built-in name None" to "keyword None". I think that's a good change. And similar changes might be welcome elsewhere in the docs, perhaps also for T

Re: [Python-ideas] Python docs page: In what ways is None special

2018-08-16 Thread Jonathan Fine
Hi Rhodri Thank you for your message. You wrote: > I disagree. That original text looks like it has been very carefully > written to be (almost) true. What you are proposing to replace it with is > less true and confusing to boot. The decision is neither your's nor mine. It is for the Python d

Re: [Python-ideas] Python docs page: In what ways is None special

2018-08-16 Thread Jonathan Fine
Hi Paul Thank you for your comments. I think different people experience things in different ways, based on who they are. What their background, training, experience are. One person's precision is another's pedantry. An aside. Babbage and Tennyson: https://www.uh.edu/engines/epi879.htm You wrote

Re: [Python-ideas] Python docs page: In what ways is None special

2018-08-16 Thread Jonathan Fine
Hi Paul We wrote >> I'd like to take this to bugs.python.org, if only to provide another >> route to discovering this (very useful) conversation. > > That's perfectly OK, and entirely your choice. However, if you do so, > I'd hope that you present the dissenting views from this list when you > ra

Re: [Python-ideas] Jump to function as an an alternative to call function

2018-08-16 Thread Jonathan Fine
Hi Chris Steve and you wrote: >> there >> are times where I have really wanted to access the caller's environment, >> not the environment where my function was defined. > what am I missing? can't you get that by passing locals() in to a function? I think this will fail when values are changed.

Re: [Python-ideas] Jump to function as an an alternative to call function

2018-08-16 Thread Jonathan Fine
Hi Jacob I really like your previous post. I find it really helps me understand what you want. You wrote > I wanted the called, jumped to function to change state in the caller. > From what I tried to do, passing locals() cannot accomplish this. I have > made it happen in other languages though.

Re: [Python-ideas] Jump to function as an an alternative to call function

2018-08-17 Thread Jonathan Fine
Jacob Solinsky wrote: > So when getx is executed inside a let form, if it tries to read/write the > value of X it interacts with the X entry in the let form's symbol table > before moving to find X in the global environment, right? The context for this is two (very useful) URLs I sent him off lis

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

2018-08-18 Thread Jonathan Fine
Summary: Discussion of the words 'jargon' and 'chatter'. Recommend that we > learn better how to find a compromise (strike a balance) between precision and simplicity. This thread is, in part, about the meaning, use and usefulness of words. And 'jargon' is what we are talking about. What is the me

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

2018-08-18 Thread Jonathan Fine
Summary: I look at the phrase 'strike a balance' in different languages, and rewrite some wikipedia text on accessibility. I found in https://en.wikipedia.org/wiki/Jargon#Accessibility_issues === There is a balance to be struck, as excessive removal of technical terminology from a document leads t

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

2018-08-19 Thread Jonathan Fine
Hi Stephen Thank you for your message. I'll respond just to a few of your comments. HOW MUCH EFFORT ON DOCS == Myself and you wrote: >> Summary: Discussion of the words 'jargon' and 'chatter'. Recommend >> that we learn better how to find a compromise (strike a balance)

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

2018-08-19 Thread Jonathan Fine
Hi Stephen I've just been reading the (excellent) discussion, started by Victor Stinner [Python-Dev] Translated Python documentation https://mail.python.org/pipermail/python-dev/2017-February/147416.html # Start of thread. You wrote, and asked for comments on: > Finally, before getting the pro

[Python-ideas] Documentation of locals()

2018-08-20 Thread Jonathan Fine
Summary: There's prior art in bug.python.org relating to off-thread topic discussion of locals(). Suggest work on closing open documentation issues relating to locals(). In the thread === Jump to function as an an alternative to call function https://mail.python.org/pipermail/python-ideas/2018-Aug

Re: [Python-ideas] Jump to function as an an alternative to call function

2018-08-20 Thread Jonathan Fine
Hi I've created new thread === Documentation of locals() https://mail.python.org/pipermail/python-ideas/2018-August/052843.html Summary: There's prior art in bug.python.org relating to off-thread topic discussion of locals(). Suggest work on closing open documentation issues relating to locals().

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

2018-08-21 Thread Jonathan Fine
Hi Earlier today, I did a search for 'documentation by example python' and found Example of great documentation in Python: Nick Loadholtes (copied) https://ironboundsoftware.com/blog/2017/12/11/great-documentation-python/ The example is: https://docs.python.org/3/library/random.html#examples-and

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

2018-08-21 Thread Jonathan Fine
Nick Loadholtes wrote (elsewhere, quoted in this thread - by me). > Make your docs work as hard as your code does. Clear examples will > make your code stand out in a good way. With a bit more searching I found: https://www.reddit.com/r/Python/comments/70myto/whats_new_in_python_37_python_370a0_

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

2018-08-21 Thread Jonathan Fine
Chris Angelico wrote > Where in the linked-to What's New page is there an example of that? > There are several code blocks that ARE copy/pasteable, even into the > vanilla interpreter. Good question. The reddit user wrote. https://www.reddit.com/r/Python/comments/70myto/whats_new_in_python_37_p

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

2018-08-21 Thread Jonathan Fine
Hi Steve You wrote: > I would just like to point out that the ipython %paste magic very > handily strips leading >, ... & + characters from the pasted block, > (there is also some clever dedenting done). [useful example, snipped] > Which is ideal. I personally find that many beginners get on a

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

2018-08-21 Thread Jonathan Fine
I wrote: > No mention here, or elsewhere on the page, that [>>>] at the top > right of a code example toggles the presence or absence of prompts. Now raised, and cross-referenced as an issue. https://bugs.python.org/issue34451 docs: tutorial/introduction doesn't mention toggle of prompts Perhap

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

2018-08-21 Thread Jonathan Fine
Hi Abe First, I have reservations about the name lambda. But there's a lot of code out there that uses lambda, and I'd like that code to continue to run. You wrote: > func = value[card.suit] if card not in wilds else wild_value with card I thought I'd try this, and variants, in the Python interp

[Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Jonathan Fine
Here's what I call a simple proposal. Some people might find it outrageous. Today is not 1st April. BACKGROUND Many Python users don't like the name lambda. But many Python users don't want any change here. This is true because there are millions of Python users, and even 100 is many

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

2018-08-21 Thread Jonathan Fine
Hi Greg You (and a reddit user) 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? Good idea. Maybe this is something

  1   2   3   4   5   >