Abdur-Rahmaan Janhangeer writes:
> This whole thread reminds me of a comment of
> Miguel Grinberg i remember somewhere when discussing
> secrets. Some go for .env some for env variables but he suggested
> focusing the attention on not letting people getting access to the
> server instead of t
On Mon, May 24, 2021 at 06:36:47PM -0700, micro codery wrote:
> Basically this would add syntax to python that would transform
> @decorator("spam this") variable
> into
> variable = decorator("variable", "spam this")
That is confusingly different from decorator syntax in other contexts.
Your pr
I had a similar idea ~8 years ago while working on a RAD (rapid application
development) framework [*] that had to manage business objects using a
variety of frameworks: an ORM (SQLAlchemy), a full-text engine (Whoosh), as
well as a specifically developed CRUD Web UI framework, permission system,
a
On Tue, May 25, 2021 at 04:01:35AM -, Joren Hammudoglu wrote:
> > Flat is better than nested.
>
> I remember being confused a lot when I was learning how to write my
> first decorator.
Imagine how confused you would be if they had included multiple
parameter lists. Not only would have neede
On Tue, May 25, 2021 at 10:55:07AM +0200, Stéfane Fermigier wrote:
> I had a similar idea ~8 years ago while working on a RAD (rapid application
> development) framework [*] that had to manage business objects using a
> variety of frameworks: an ORM (SQLAlchemy), a full-text engine (Whoosh), as
>
On Tue, May 25, 2021 at 04:24:39PM +0900, Stephen J. Turnbull wrote:
> In Support For Private, however, we're talking about a positive-sum
> game. Code writers need to communicate with code readers, both human
> and machine, while avoiding mistakes. In fact, this is almost a
> purely cooperative
On Mon, May 24, 2021 at 09:49:13PM -, Joren wrote:
> It's unfortunate that there is no way to have e.g. `'spam' in
> my_symbolic_set` evaluate to something else than a boolean. Also, this
> approach will not work with everything else for which there is no
> dunder method, e.g. `math.sin(my
Sorry for the name conflict. I tried to type Steven D'Aprano but instead it
resulted in Steve D'Aprano
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3
I posted my previous idea regarding this on the mailing list. This idea is a
little different. This idea suggests introducing constant name bindings. This
is similar to const pointer in C/C++. Once a name has been assigned to a data
we can change the data (if mutable) but we cannot change the na
On Tue, May 25, 2021 at 5:29 PM Steven D'Aprano wrote:
> Here's a counter-proposal: we have a special symbol which is transformed
> at compile-time to the left hand assignment target as a string. Let's
> say we make that special expression `@@` or the googly-eyes symbol.
This is sounding promisin
On Tue, May 25, 2021 at 9:55 PM Shreyan Avigyan
wrote:
>
> I posted my previous idea regarding this on the mailing list. This idea is a
> little different. This idea suggests introducing constant name bindings. This
> is similar to const pointer in C/C++. Once a name has been assigned to a data
> >>> solve(x**2 == 1/2)
> >>>
> >>>
> as you might notice, this is fully legal Python syntax. Unfortunately
>
Yes I'm aware of that. That's for typing. I'm talking about implementing it in
Python itself not Python typing.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org
On Tue, May 25, 2021 at 8:11 AM Chris Angelico wrote:
> On Tue, May 25, 2021 at 5:29 PM Steven D'Aprano
> wrote:
> > Here's a counter-proposal: we have a special symbol which is transformed
> > at compile-time to the left hand assignment target as a string. Let's
> > say we make that special exp
On Tue, 25 May 2021 at 13:31, Sergey B Kirpichev wrote:
>
> > >>> solve(x**2 == 1/2)
> > as you might notice, this is fully legal Python syntax. Unfortunately
> > the semantics is such that sympy has no way to determine what is
> > actually going on, this is why they invented all those helper
> >
On 5/25/21 5:23 AM, Chris Angelico wrote:
> On Tue, May 25, 2021 at 9:55 PM Shreyan Avigyan wrote:
>> The proposed syntax is as follows,
>>
>> constant x = 10
>> constant y = ["List"]
>> constant z: str = "Hi"
>
> https://docs.python.org/3/library/typing.html#typing.Final
>
> Already exists :)
O
Greetings,
> In fact, this is almost a
purely cooperative game.
This sums it up the difference between secrets and the private
use case. I was echoing the sentiments of the thread. The
mere putting of private does not ensure complete isolation. It's
for developers to understand that they should
Ethan:
> Optional typing != core Python.
Exactly
___
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 archived at
h
On Tue, May 25, 2021 at 4:02 PM Ethan Furman wrote:
> On 5/25/21 5:23 AM, Chris Angelico wrote:
> > On Tue, May 25, 2021 at 9:55 PM Shreyan Avigyan wrote:
>
> >> The proposed syntax is as follows,
> >>
> >> constant x = 10
> >> constant y = ["List"]
> >> constant z: str = "Hi"
> >
> > htt
It's still a Python feature even if it's not a language feature, it's well
defined by PEP and any type checker wanting to implement type hinting to
spec must include it.
Further type hinting allows developers who want to use a Constant / Final
feature get the benefit already from type hinting, whe
We've already had all of this since long before typing.py existed.
ALLCAPS means "this value should only be set once and not changed."
_underscore means "this is not part of public API, and it may change in
next version.
__double_under means "this is SERIOUSLY not something you should muck with,
First it would seem useless or not necessary but soon this becomes clear. 1) It
would help programmers debug their code easily and help them find out that the
bug's not in the constant, that's for sure. 2) This would allow another branch
of OOP programming to enter Python. Read-only member varia
On Tue, May 25, 2021 at 8:11 AM Chris Angelico wrote:
> On Tue, May 25, 2021 at 5:29 PM Steven D'Aprano
> wrote:
> > Here's a counter-proposal: we have a special symbol which is transformed
> > at compile-time to the left hand assignment target as a string. Let's
> > say we make that special exp
On Tue, May 25, 2021 at 4:41 PM Shreyan Avigyan
wrote:
> First it would seem useless or not necessary but soon this becomes clear.
> 1) It would help programmers debug their code easily and help them find out
> that the bug's not in the constant,
A reasonable type checker will detect cases wher
if you want it for debugging, then static type checkers can do that for you.
2) This would allow another branch of OOP programming to enter Python.
> Read-only member variables. There are Private members in Java and C++.
Then use Java or C++ -- the benefits of Python are not primarily
the syntax
I'm aware that Python is a "Consenting Adults" language but I think Python
should provide this functionality at least. This idea doesn't actually make it
like Java. Because why should we mess around with that member anyway. Sometimes
we want to provide members that users must use but mustn't cha
On Wed, May 26, 2021 at 2:00 AM Shreyan Avigyan
wrote:
>
> I'm aware that Python is a "Consenting Adults" language but I think Python
> should provide this functionality at least. This idea doesn't actually make
> it like Java. Because why should we mess around with that member anyway.
> Someti
Reply to Chris:
Wait. Deployment? Before deploying we *run the code* at least once and then we
get the errors. And I'm not sure but type checking is ok but sometimes
enforcing is a better option. Why? Mypy or typecheckers have to be run manually
and they are also not part of the stdlib. Enforci
On Tue, May 25, 2021 at 5:24 PM Shreyan Avigyan
wrote:
> Reply to Chris:
>
> Wait. Deployment? Before deploying we *run the code* at least once and
> then we get the errors. And I'm not sure but type checking is ok but
> sometimes enforcing is a better option. Why? Mypy or typecheckers have to
>
Greetings,
On Tue, May 25, 2021 at 8:13 PM Chris Angelico wrote:
> Remember: The thing that you declare Final will, some day, need to be
> changed. Probably as part of your own test suite (you do have one of
> those, right?). With MyPy, you could tell it not to validate that
> line, or that fil
I actually suggest a different kind of Constant in Python not the classical
const we see in Java or C/C++.
Constants doesn't mean we can't reassign the name to a different value.
Constants behave like literals. They are sort of literals actually. We
reference a value by a name. Variable is just
On Tue, May 25, 2021 at 12:30 AM Steven D'Aprano
wrote:
>
> Your proposal appears to be:
>
> @decorator(expression) targetname
>
> # transformed into:
>
> targetname = decorator("targetname", expression)
>
Correct
> But in class and function decorator contexts, the equivalent synta
On 5/25/21 8:33 AM, Damian Shaw wrote:
> On Tue, May 25, 2021 at 11:02 AM Ethan Furman wrote:
>> On 5/25/21 5:23 AM, Chris Angelico wrote:
>>> On Tue, May 25, 2021 at 9:55 PM Shreyan Avigyan wrote:
The proposed syntax is as follows,
constant x = 10
constant y = ["List"]
>>>
On Tue, May 25, 2021 at 04:27:41PM +0100, Stestagg wrote:
> On Tue, May 25, 2021 at 4:02 PM Ethan Furman wrote:
> > Optional typing != core Python.
> >
> >
> I mean, it's part of the standard library, so we could argue on personal
> definitions of 'core Python', but it would be more useful to wor
On Tue, May 25, 2021 at 11:37:06AM -0400, David Mertz wrote:
> We've already had all of this since long before typing.py existed.
>
> ALLCAPS means "this value should only be set once and not changed."
`math.pi` says hello.
The existence of math.pi and the fact that probably nobody ever has
int
On Wed, May 26, 2021 at 02:09:58AM +1000, Chris Angelico wrote:
> Remember: The thing that you declare Final will, some day, need to be
> changed. Probably as part of your own test suite (you do have one of
> those, right?). With MyPy, you could tell it not to validate that
> line, or that file. W
On Tue, May 25, 2021 at 06:09:29PM -, Shreyan Avigyan wrote:
> I actually suggest a different kind of Constant in Python not the
> classical const we see in Java or C/C++.
>
> Constants doesn't mean we can't reassign the name to a different
> value.
So... constants aren't constant? They're
On Tue, May 25, 2021 at 9:36 PM Steven D'Aprano wrote:
> > ALLCAPS means "this value should only be set once and not changed."
>
> `math.pi` says hello.
>
(U ⇒ O) ⊬ (¬U ⇒ ¬O)
The existence of math.pi and the fact that probably nobody ever has
> introduced a bug into their code by carelessly ass
On 26/05/2021 02:32, Steven D'Aprano wrote:
`math.pi` says hello.
The existence of math.pi and the fact that probably nobody ever has
introduced a bug into their code by carelessly assigning another value
to it suggests strongly that the benefit of language enforced constants
is not high.
B
On Wed, May 26, 2021 at 11:57 AM Steven D'Aprano wrote:
>
> On Wed, May 26, 2021 at 02:09:58AM +1000, Chris Angelico wrote:
>
> > Remember: The thing that you declare Final will, some day, need to be
> > changed. Probably as part of your own test suite (you do have one of
> > those, right?). With
40 matches
Mail list logo