[Python-ideas] Re: Visual Python.

2023-05-19 Thread André Roberge
ost like playing with LEGO > blocks. > > > > Sounds like you want something like Scratch? > > https://scratch.mit.edu/ > > There is also EduBlocks https://edublocks.org/ which supports Python. André Roberge > It's not as powerful as Python, but it's a great way

[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-11 Thread André Roberge
Or, in a more readable way! ;-) ;-) > python -m ideas -t easy_units Ideas Console version 0.0.30. [Python version: 3.9.10] >>> import pint >>> ureg = pint.UnitRegistry() >>> ureg.define('mpg = 1 * mile / gallon') >>

[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-09 Thread André Roberge
=Transformed p2 = 1.0 * Units.N/(Units.m**2) # using ** instead of ^ for Python purists - Admittedly, it is a quick hack and may very well be buggy. But it can be fun to use! ;-) André Roberge ___ Python-ideas ma

[Python-ideas] Re: Native support for units [was: custom literals]

2022-04-06 Thread André Roberge
On Wed, Apr 6, 2022 at 7:05 PM Mike Miller wrote: > > On 2022-04-06 12:36, Paul Moore wrote: > > > And if new syntax is a clear win even with such a library, > > then designing a language feature that enables better syntax for that > > library would still be possible (and there would be a clear

[Python-ideas] Re: A modulo operator consistent with euclidean division.

2022-03-18 Thread André Roberge
On Fri, Mar 18, 2022 at 12:09 PM Nathan Levett wrote: > Howdy python gang, > > First time posting here ~ I've recently encountered that python does not > have an OOTB operator for modulo that is consistent with Euclidean > division. Are you referring to something different than the divmod

[Python-ideas] Re: Please consider mentioning property without setter when an attribute can't be set

2022-02-15 Thread André Roberge
On Fri, Feb 11, 2022 at 5:39 AM Steven D'Aprano wrote: > On Thu, Feb 10, 2022 at 02:27:42PM -0800, Neil Girdhar wrote: > > > AttributeError: can't set attribute 'f' > > > > This can be a pain to debug when the property is buried in a base class. > > > Would it make sense to mention the reason

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

2021-12-01 Thread André Roberge
On Wed, Dec 1, 2021 at 7:51 AM Chris Angelico wrote: > On Wed, Dec 1, 2021 at 10:30 PM André Roberge > wrote: > > >> 2) Independently: Is the syntactic distinction between "=" and "=>" a > >> cognitive burden? > > >

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

2021-12-01 Thread André Roberge
readability, including for beginners. > 5) Do you know how to compile CPython from source, and would you be > willing to try this out? Please? :) > Sorry, I'm not interested enough at this point but, given the amount of work you put in

[Python-ideas] Re: PEP8 mandatory-is rule

2021-09-03 Thread André Roberge
ity/sigs/current/edu-sig/) but it is essentially dead. André Roberge ___ 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/ Me

[Python-ideas] Re: Extension methods in Python

2021-06-21 Thread André Roberge
tom import hook. If you want to "easily" experiment with this, I would suggest having a look at https://aroberge.github.io/ideas/docs/html/index.html which likely has all the basic scaffolding that you would need. André Roberge > > > > ChrisA > >

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

2021-06-01 Thread André Roberge
eally my concern. > Rather, I'm interested in the point André Roberge started the thread with. > Actually, the very first observation I made is that, if you try to assign a value to '...', the traceback includes the message: SyntaxError: cannot assign to Ellipsis which is clearly wrong

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

2021-05-31 Thread André Roberge
On Mon, May 31, 2021 at 4:17 PM Serhiy Storchaka wrote: > 31.05.21 17:37, André Roberge пише: > > For consistency, `Ellipsis` (the name) should **always** refer to the > > same object that `...` refers to, so that both could not be assigned a > > new value. > >

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

2021-05-31 Thread André Roberge
it tests) and probably a hundred or so of various types of other errors. Furthermore, friendly is designed so that the explanations can be translated into other languages; currently, every case friendly covers has explanations available in both English and French. > On Mon, May 31, 2

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

2021-05-31 Thread André Roberge
is', even though you've rebound Ellipsis. > Exactly. Thinking some more about it, perhaps the confusion would be sufficiently reduced if the repr of '...' would be 'Ellipsis (...)', and use this repr to appear in error messages rather than simply the name Ellipsis. > > > > > On Mon,

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

2021-05-31 Thread André Roberge
psis` (the name) should **always** refer to the same object that `...` refers to, so that both could not be assigned a new value. André Roberge ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@p

[Python-ideas] Re: Cleaner tracebacks from Python code

2021-05-29 Thread André Roberge
issing something obvious. In the example I gave, as a user calling date() [from a library], I would only want to see that line show up. > > > Or you can get clever and construct a traceback with only the frames you > want. > > > On Saturday, May 29, 2021, 08:27:18 PM GMT+1, André

[Python-ideas] Re: Cleaner tracebacks from Python code

2021-05-29 Thread André Roberge
On Sat, May 29, 2021 at 3:25 PM Thomas Grainger wrote: > pytest uses __tracebackhide__ > > https://doc.pytest.org/en/latest/example/simple.html#writing-well-integrated-assertion-helpers > Thanks for the reminder. Pytest takes care of traceback formatting for users. Individual projects can of

[Python-ideas] Re: Cleaner tracebacks from Python code

2021-05-29 Thread André Roberge
"). It also talks about filtering some specific modules -- something I already do in one of my projects. Still, interesting to see; thanks for the link. > > > On Saturday, May 29, 2021, 07:19:32 PM GMT+1, André Roberge < > andre.robe...@gmail.com> wrote: > > > With

[Python-ideas] Cleaner tracebacks from Python code

2021-05-29 Thread André Roberge
For end users, this would result in much more readable tracebacks, unencumbered by extra lines of code that are outside of their control. André Roberge ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@py

[Python-ideas] Re: Fractions vs. floats - let's have the cake and eat it

2021-05-20 Thread André Roberge
such a feature has been mentioned? I don't recall seeing any such discussion and would love to find out more about SymPy's perspective on this topic. André Roberge > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscr

[Python-ideas] Re: symbolic math in Python

2021-05-19 Thread André Roberge
I also gave various examples of using import hooks to modify Python's syntax using https://github.com/aroberge/ideas which I wrote to facilitate such experimentation -- although I consider this more of a toy than anything resembling a professional and robust package. André Roberge _

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

2021-05-15 Thread André Roberge
Ps can potentially be huge time savers for the community ... André Roberge > ___ > 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/pyth

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

2021-05-14 Thread André Roberge
On Fri, May 14, 2021 at 3:09 PM Ricky Teachey wrote: > On Fri, May 14, 2021 at 1:14 PM André Roberge > wrote: > >> >> You can already experiment with this. >> >> >> First, install a few packages >> >> python -m pip install ideas # will also in

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

2021-05-14 Thread André Roberge
~>> Appending an "F" after integer fractions literal is all that is needed. André Roberge > > But then I started prototyping, and given that it is not so easy to change > the parser, I just changed the normal division operator. And interestingly, > nearly nothing

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

2021-05-14 Thread André Roberge
on in stdlib. > It already exists. https://docs.python.org/3/library/fractions.html André Roberge > > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://

[Python-ideas] Re: Add support for private variables, methods and functions in Python

2021-05-06 Thread André Roberge
as you do not include any context. My own email specifically referred to two instances where I found it necessary to **modify** methods that are indicated as being private as their names begin with double underscores. So, I am strongly opposed to your

[Python-ideas] Re: Add support for private variables, methods and functions in Python

2021-05-06 Thread André Roberge
using Python. I suspect that I am not the only one. Huge -1 for the idea of introducing truly private variables or methods in Python. André Roberge > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-i

[Python-ideas] Re: On function signature mismatch, include candidate function in traceback

2021-04-20 Thread André Roberge
ile content (and line number, etc.) could be retrieved and included in the traceback. This is often done in other REPLs (such as IPython and IDLE's pyshell). André Roberge ChrisA > ___ > Python-ideas mailing list -- python-ideas@python.org > To

[Python-ideas] Re: Access to source code when using exec()

2021-04-03 Thread André Roberge
mentioned by Alex Hall in the post quoted below. André Roberge On Sat, Jan 2, 2021 at 10:29 AM Alex Hall wrote: > When using `exec(string)`, the standard Python REPL, or `python -c` in a > terminal, the executed source code is not stored anywhere and cannot be > retrieved (except in the

[Python-ideas] Re: Experimental syntax proposal

2020-11-29 Thread André Roberge
Hello Paul (and everyone else), On Sun, Nov 29, 2020 at 12:00 PM Paul Sokolovsky wrote: > ... > > > # Experimental Syntax Proposal > > > > I would like to propose that Python adopts a modified process > > before introducing significant changes of its syntax. > > [] > > > ## New suggested

[Python-ideas] Fwd: Re: Global flag for whether a module is __main__

2020-11-14 Thread André Roberge
Sorry, forgot to use "reply to all" -- Forwarded message ----- From: André Roberge Date: Sat, Nov 14, 2020 at 11:06 AM Subject: Re: [Python-ideas] Re: Global flag for whether a module is __main__ To: Steven D'Aprano On Sat, Nov 14, 2020 at 10:45 AM Steven D'Apr

[Python-ideas] Re: Global flag for whether a module is __main__

2020-11-14 Thread André Roberge
On Sat, Nov 14, 2020 at 7:56 AM Steven D'Aprano wrote: > On Fri, Nov 13, 2020 at 05:59:29AM -0400, André Roberge wrote: > > > As a goal of making it even more obvious what the (new) idiom mans, I > would > > suggest a variable named __imported__ with the opposite value to

[Python-ideas] Re: Global flag for whether a module is __main__

2020-11-13 Thread André Roberge
On Thu, Nov 12, 2020 at 9:46 AM Matt Wozniski wrote: > Currently, the simplest and most idiomatic way to check whether a module > was > run as a script rather than imported is: > > if __name__ == "__main__": > > People generally learn this by rote memorization, because users often want > the

[Python-ideas] Re: Experimental syntax proposal

2020-10-24 Thread André Roberge
hat is proposed there would first be implemented as a third party package. André Roberge ___ 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-i

[Python-ideas] Experimental syntax proposal

2020-10-24 Thread André Roberge
e anything about the `experimental_syntax_encoding` module, which I just worked on today. ## Final thoughts This proposal is really about the idea of adopting a standard process of some sort that enables users to experiment with any proposed new syntax, rather than the specific "silly" exam

[Python-ideas] Re: f-string: empty expression should be allowed

2020-10-22 Thread André Roberge
he braces by doubling them: > >f"INSERT INTO {table} VALUES (1, '{{}}');" > > Thank you for (ugly) workaorund. > It is no different than having to write \\ in a string to get a single backslash : it is part of the syntax of f-s

[Python-ideas] Re: Optimize out setting unused underscored local variables

2020-10-21 Thread André Roberge
alling back to the default (en) as a last resort. As far as I know, a straight gettext.install does not allow that. I admit that my usage might not be typical. André Roberge > ___ > Python-ideas mailing list -- python-ideas@python

[Python-ideas] Re: Custom keywords (from: Decorators for class non function properties)

2020-08-17 Thread André Roberge
eted according to Python's grammar: your notation would raise a SyntaxError. This would stop the entire process. To actually do the import "from mykeywords import ...", one needs to go beyond the parsing stage. This is where a custom encoding or an import hook can help, by transforming the source i

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-08-06 Thread André Roberge
curred when beginners copy-pasted some code from an ebook or a website. This is why the message mentions it ... but I've modified it so that it is, hopefully, less patronizing. Thanks again for your comments. Hopefully, the changes I have made are an acceptable compromise between what you suggested and

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-08-05 Thread André Roberge
tead of a normal single or double quote for a string. = = = This is just one of many cases now correctly identified by friendly-traceback. André Roberge ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email t

[Python-ideas] Re: Decorators for class non function properties

2020-08-05 Thread André Roberge
t;... > AttributeError: cannot delete constant > > However, one can, of course: > > del K > > There is only so much one can do. ;-) > > Actually, it is possible to do with Python, using an import hook. See https://aroberge.github.io/ideas/docs/html/cons

[Python-ideas] Re: New clause in FOR and WHILE instead of ELSE

2020-07-24 Thread André Roberge
ent keyword): https://aroberge.github.io/ideas/docs/html/nobreak.html André Roberge > ChrisA > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://

[Python-ideas] Re: [Python-Dev] Re: Re: Amend PEP-8 to require clear, understandable comments instead of Strunk & White Standard English comments

2020-06-29 Thread André Roberge
political discussions taking over some Python forum, and not having the mental fortitude to speak up, I quietly asked for my status to be converted to Emeritus ( https://www.python.org/psf/members/#emeritus-fellows) and withdrew for a few years. This time, rather than

[Python-ideas] Re: Improve handling of Unicode quotes and hyphens

2020-05-10 Thread André Roberge
imeText and perhaps Jupyter notebooks. It can already work with Mu and Thonny. ( Due to the way Idle runs code and deals with exceptions, it is impossible to add it as a simple plugin to Idle, most unfortunately.) For anyone interested, even if you do not

[Python-ideas] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-01 Thread André Roberge
| "shortest" | "longest" with "shortest" as the default (avoiding causing any breakage with the existing function). André Roberge > > I think it misrepresents the arguments for a separate function and > undersells the advantages—it basically just addresses the

[Python-ideas] Re: Introduce 100 more built-in exceptions

2020-05-01 Thread André Roberge
of the obscure "SyntaxError: Invalid syntax", this would make it really easy to provide translations of error messages in other languages (or in "beginner friendly English") as I'm slowly doing with friendly-traceback. André Roberge ___

[Python-ideas] Re: Introduce 100 more built-in exceptions

2020-05-01 Thread André Roberge
ass for them would just make the exception handling code more complicated than necessary. André Roberge > > > 2. When I get an error, especially from some shitty corporate system that > > truncates the traceback, I want to get as many hints as possible about > what > > wen

[Python-ideas] Re: Introduce 100 more built-in exceptions

2020-05-01 Thread André Roberge
am not necessarily expressing support for adding many new exception types.) You're welcome to start collaborating and help document all possible cases. This invitation to collaborate is, of course open to all. André Roberge > ___ >

[Python-ideas] Re: RFC: For Loop Invariants

2020-04-10 Thread André Roberge
> Gross. Twice nested for a simple count. > > count = 0 for a in chars: count = count + 1 if a in seek else count Once nested -- if nested == gross, then this is not gross. (However, I prefer the twice nested which I find clear and simple -- not gross.) André Roberge >

[Python-ideas] Re: Exception spaces

2020-04-09 Thread André Roberge
ueError(Exception): pass and raise these custom exceptions when necessary. No need to change Python or use convoluted logic. André Roberge > ___ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-

[Python-ideas] Mailman 3 monthly summaries broken for Python-ideas

2020-03-08 Thread André Roberge
note that there is no need to discuss the idea I mentioned in that old thread as it has since been implemented as a separate package. André Roberge ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le

[Python-ideas] Re: IDEA: Allow override of all assignments of a built in type to be a different type

2020-03-05 Thread André Roberge
On Thu, Mar 5, 2020 at 11:09 AM Todd wrote: > On Thu, Mar 5, 2020 at 4:27 AM Steve Barnes > wrote: > >> >> SNIP > >> >> Wouldn’t it be possible to have something along the lines of: >> >> >> >> ``` >> >> from decimal import TreatFloatsAsDecimal >> >> @TreatFloatsAsDecimal >> >> a = 0.1 #

[Python-ideas] Re: IDEA: Allow override of all assignments of a built in type to be a different type

2020-03-05 Thread André Roberge
On Thu, Mar 5, 2020 at 5:55 AM André Roberge wrote: > > > On Thu, Mar 5, 2020 at 5:29 AM Steve Barnes > wrote: > >> One of the lovely things about Python is that we have the capability to >> avoid issues such as the vagaries of the floating point type with l

[Python-ideas] Re: IDEA: Allow override of all assignments of a built in type to be a different type

2020-03-05 Thread André Roberge
nd document it later today, and post it on this list. > Less obviously this sort of approach could also apply to making all > integers into Fractions or other base types into something else. > Also a bit tricky since you don't want to end up with for i in range(Fraction(4)) ... Howe

[Python-ideas] Re: More descriptive error message than "too many values to unpack"

2020-03-01 Thread André Roberge
>>> for key, value in d: ...print(key, value) ... Python exception: ValueError: not enough values to unpack (expected 2, got 1) A ValueError indicates that a function or an operation received an argument of the righ

[Python-ideas] Re: Control adding script path/CWD to sys.path

2020-02-24 Thread André Roberge
On Mon, Feb 24, 2020 at 6:04 PM Eryk Sun wrote: > On 2/24/20, jdve...@gmail.com wrote: > > > > I try to use along with -m (`python -I -m a.b`) and get this error: > "python: > > Error while finding module specification for 'a.b' (ModuleNotFoundError: > No > > module named 'a')". > > This is a

[Python-ideas] Re: Incremental step on road to improving situation around iterable strings

2020-02-24 Thread André Roberge
this was one of the first, if not the first example they used. In fact, I think I was in the minority in not using this type of iteration over strings as an early example of loops. So, I would argue that iterating over strings with beginners is something much more com

[Python-ideas] Re: Meta: ideas for Python [-ideas]

2020-02-23 Thread André Roberge
On Sun, Feb 23, 2020 at 5:17 PM Andrew Barnert wrote: > On Feb 23, 2020, at 05:44, André Roberge wrote: > > > In an attempt to make it easier to create import hooks to "play" with > non-standard syntax, I have created a library that is simply called "ideas" &

[Python-ideas] Re: Meta: ideas for Python [-ideas]

2020-02-23 Thread André Roberge
On Sun, Feb 23, 2020 at 1:01 PM Eric Fahlgren wrote: > I had just started to play with Andrew's code on Friday, but got > distracted by real work and had to drop it. This gets me further into the > parts I wanted to play with, so big thanks! > If you come up with something that you find useful

[Python-ideas] Meta: ideas for Python [-ideas]

2020-02-23 Thread André Roberge
write an import hook for testing your proposed syntax", one could say "you can use transformations similar to that of examples X and Y of ideas to create an import hook for testing your proposed syntax". André Roberge [1] https://mail.python.org/archives/list/python-ideas@python.o