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
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')
>>
=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
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
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
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
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?
> >
>
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
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
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
> >
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
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.
>
>
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
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,
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
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é
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
"). 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
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
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
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
_
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
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
~>>
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
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://
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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://
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
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
| "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
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
___
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
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
> ___
>
> 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
>
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-
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
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 #
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
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
>>> 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
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
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
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"
&
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
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
60 matches
Mail list logo