On Wed, May 26, 2021 at 11:20 PM Shreyan Avigyan
<pythonshreya...@gmail.com> wrote:
>
> Reply to Chris:
>
> Yes I know that. sys.stdout exists there for that reason only. But if we 
> can't print then it means we changed it somewhere. I just gave an example.

Yes, an example where you're trying to show... something. Which I
still don't understand, because you're advocating constants, and then
citing an example of something that is specifically there for the
purpose of being changed/replaced.

> I've seen code where constants can be really necessary. Python lets us use 
> these things because it's a programming language. But libraries are not 
> programming languages. They are there to enhance the programming. Suppose 
> we're testing out a library. Now maybe there's something really critical we 
> shouldn't change. We must access but mustn't change. And we mistakenly 
> changed it. Now we're not gonna deploy our application. So we don't run a 
> type checker. Now we run and the program crashes and yet we can't find where 
> is the bug. Why should tools be needed to solve such an obvious problem? Why 
> can't Python itself help us like it does when we add int and str?
>

So........ if you think you have a problem, your program crashes, and
you're having trouble finding the bug... then...... maybe that would
be a good time to use a type checker? I don't know. Your examples are
so extremely vague, and you're assuming that (a) the library author
can and does declare that something shouldn't ever be changed, (b) the
program author can and does attempt to change it, (c) the library
author was correct and the program author was wrong, and (d) the
program author couldn't figure this out by the fact that the name was
in ALL_CAPS. That is a lot of big assumptions, especially the third
one.

Plus, you're assuming that this constness will be detected if the
mutation happens in some other module, which is NOT part of several
iterations of the proposal.

Need a more specific example. Yaknow, an actual example, not just
"this might happen in some universe".

Figure out what you're actually proposing. Figure out what real
problems it is supposed to be able to solve. The problems you're
solving should govern the feature you're proposing.

ChrisA
_______________________________________________
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 
https://mail.python.org/archives/list/python-ideas@python.org/message/UEUVY4HCNMHZT6BUV2FBEKO25XS3IU5P/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to