>
> So I do not have extensive experience with mypy but I don't see how it
> would help. The entire issue that is that `str` is an instance of
> `Iterable[str]` so how is mypy going to catch my error of passing a single
> string instead of an iterable of strings to a function?
>
> ...
>
> I like t
So I do not have extensive experience with mypy but I don't see how it
would help. The entire issue that is that `str` is an instance of
`Iterable[str]` so how is mypy going to catch my error of passing a single
string instead of an iterable of strings to a function?
However the ability to distin
I guess I'm confused if you want (e.g.) `python json.py` to do something
but not `python -m json` to call the same file (a different way), given
you're in the directory.
nick@lappy386:~/Code$ echo "{}" | python -m json.tool
{}
nick@lappy386:~/Code$ touch json.py
nick@lappy386:~/Code$ echo "{}" | p
I agree, a warning that is never converted to an error indicates that
this is more about style than behavior (and in that sense it is use case
specific). It would also be annoying for people that intentionally
iterate over strings and find this a useful feature.
So this sounds more like the job f
On 2/24/2020 4:20 PM, Alex Hall wrote:
Just add the appropriate code to filter that category of warnings. I
think you have the option of two lines of Python code or one
environment variable.
I can assure you that many users will not know how to do either of those
things.
Eric
On Mon, Feb
I see... never use this feature.
I make extensive use of running modules from local (non-PYTHONPATH)
directories. When these modules import (local) sub-modules, the best and
simplest method I have found is running them from top directory of the
corresponding application. I can run any module in
On Mon, 24 Feb 2020 at 20:13, Alex Hall wrote:
>
> > Conversely, I can't remember a case where I've ever accidentally
> > iterated over a string when I meant not to.
>
> Do you ever return a string from a function where you should have returned a
> list containing one string? Or similarly passed
Eryk Sun wrote:
> On 2/24/20, jdve...@gmail.com jdve...@gmail.com wrote:
> >
> > It is the intended and the expected behaviour. The
> > working directory is
> > always added to the sys.path.
> > You mean always in this particular context, i.e. the working directory
> is added normally when executin
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 us
On 2/24/2020 2:59 PM, Guido van Rossum wrote:
The biggest problem remains that 99% of your explanation (and that of
others who seem to understand what you want) uses the words of the
application domain (statistics, stochastic variables, distributions)
in a way that is unhelpful to convey your n
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 use case for -m that requires adding the working directory
to sys.pat
Yes, at this point I think I must concede the battle. I thought I had discussed
this with core developers in the past, but I couldn't find the results. So here
we have it - making `~` a binary operator as well is a no-go.
Perhaps some better advocate than I will take it up in the future.
Thank
--- Bruce
On Mon, Feb 24, 2020 at 1:19 PM Alex Hall wrote:
> I think maybe you forgot to reply to the list as well?
>
> I did mean to reply to the list, so adding it back in.
> How many scripts do you have where your own code directly iterated over a
> string? How hard do you think it would
On 2/24/20, jdve...@gmail.com wrote:
>
> It is the intended and the expected behaviour. The working directory is
> always added to the sys.path.
You mean always in this particular context, i.e. the working directory
is added normally when executing a command via -c or a module as a
script via -m.
Nick Timkovich wrote:
> > Are you familiar with the -I option for "isolated mode"?
> https://docs.python.org/3/using/cmdline.html#id2
> -I
> Run Python in isolated mode. This also implies -E and -s. In isolated mode
> sys.path contains neither the script’s directory nor the user’s
> site-packages
Alex Hall wrote:
> > Conversely, I can't remember a case where I've ever
> > accidentally
> > iterated over a string when I meant not to.
> > Do you ever return a string from a function where you should have returned
> a list containing one string? Or similarly passed a string to a function?
> Forg
Just add the appropriate code to filter that category of warnings. I think
you have the option of two lines of Python code or one environment variable.
On Mon, Feb 24, 2020 at 11:16 PM David Mertz wrote:
> On Mon, Feb 24, 2020 at 4:08 PM Alex Hall wrote:
>
>> Even when there is a wealth of code
On Tue, Feb 25, 2020 at 8:16 AM David Mertz wrote:
>
> On Mon, Feb 24, 2020 at 4:08 PM Alex Hall wrote:
>>>
>>> Even when there is a wealth of code out there that will become broken
>>> by this change?
>>
>>
>> Not broken, just noisy.
>
>
> Noisy *IS* broken!
>
> In some ways it's one of the wors
On Mon, Feb 24, 2020 at 4:08 PM Alex Hall wrote:
> Even when there is a wealth of code out there that will become broken
>> by this change?
>
>
> Not broken, just noisy.
>
Noisy *IS* broken!
In some ways it's one of the worst kinds of broken. Working with libraries
that import other libraries
I may have led in that direction, and I know R only passingly, not well.
But my understanding is that thinking of a data structure that gets parsed
by an evaluator, e.g. "do a linear regression with this structure (and a
DataFrame)" is better than a lambda.
I'm sure it's possible to describe this
On Mon, Feb 24, 2020 at 9:12 PM Chris Angelico wrote:
> On Tue, Feb 25, 2020 at 5:52 AM Alex Hall wrote:
> >
> > Of course consistency is valuable. I am asking how it is automatically
> more valuable than "better or worse", which isn't an idea that makes sense
> to me. Consistency isn't axiomati
As one of those who 1. thinks there IS a problem, 2. that the problem is
bigger than most of the people on this thread seem to think, I am
nevertheless in agreement that tackling the problem by changing the
language to outlaw direct str iteration would just be far, far too
disruptive. I am much mo
I would like to reiterate a point that I think is very important and many
people seem to be brushing aside. We don't have to *break* existing code.
We can get a lot of value, at least in terms of aiding debugging, just by
adding a warning. That warning never has to evolve into an exception,
certain
On 2/24/20, Guido van Rossum wrote:
>
> The stdlib does very little logging of its own -- logging is up to
> the application.
It's not logging per se, but the standard library does have an
extensive and growing list of audit events that are intended to assist
with testing, logging and security mo
I am no expert on R, but R lazily evaluates arguments to functions; see
https://cran.r-project.org/doc/manuals/r-devel/R-lang.html#Argument-evaluation
(plus
the rest of that page, which is the language spec). Tilde is strictly used
for modeling. Also relevant would be the operator precedence
https:
24.02.20 22:02, Guido van Rossum пише:
Hm, that's actually an interesting take. Can you compare it to the kind
of "quoting" that happens in a lambda? Is there some kind of translation
of the OP's original example (Lottery ~ Literacy + Wealth + Region) to a
lambda involving those words?
I thin
> Conversely, I can't remember a case where I've ever accidentally
> iterated over a string when I meant not to.
Do you ever return a string from a function where you should have returned
a list containing one string? Or similarly passed a string to a function?
Forgotten to put a trailing comma in
I agree with the numerous posters who have brought up the
backward-compatibility concern. This change *would* break lots of code. At the
same time, this bites me consistently, so I'd like to do something soon... at
least sooner than 6.0 ;).
I believe that this is better solved by static analysi
On Mon, Feb 24, 2020 at 11:00 AM David Mertz wrote:
> Well... also, the meaning in R is quite a bit different from any of the
> meanings suggested by Wolfram. In fact, although the most common use in R
> is "depends on", it's technically just a generic delayed evaluation without
> any inherent s
But that behavior is specific to Jupyter and so it could similarly
provide auto-complete or syntax highlighting for usage of
`smf.ols(formula=...)`. Like PyCharm provides syntax highlighting for
strings used as the `pattern` argument for the various functions of the
`re` module. So if it's only fo
The biggest problem remains that 99% of your explanation (and that of
others who seem to understand what you want) uses the words of the
application domain (statistics, stochastic variables, distributions) in a
way that is unhelpful to convey your needs to those who are in a position
to implement a
I'm currently creating my own FOSS platform/course for teaching Python to
beginners: https://github.com/alexmojaki/python_init (sorry, it's very new
and under construction so there's no docs yet). The content moves to for
loops relatively quickly, and for quite a while the only thing they loop
over
On Mon, Feb 24, 2020 at 11:51 AM Brianvanderburg2 via Python-ideas <
python-ideas@python.org> wrote:
> When running a python script directly, the directory of that script gets
> added to sys.path. When running as a module "python -m", it looks like an
> empty string gets added to sys.path, which
Paul Moore wrote:
> On Mon, 24 Feb 2020 at 16:23, Alex Hall alex.moj...@gmail.com wrote:
> you have to establish that your
> behaviour is significantly better than the status quo, and I don't
> think that you're doing that at the moment. And IMO, you're never
> likely to do so simply by quoting num
Brianvanderburg2 wrote:
> This is just an idea, which may not in practice be a major problem but can at
> times be
> an inconvenience. I thought I had posted this in the "python -m" thread a
> little while
> back but checking my history it does't appear I did, I do apologize if this
> is a
> du
On Mon, Feb 24, 2020 at 3:01 PM Alex Hall wrote:
> Snip
>
> From the assumptions in this scenario, we're talking about a beginner -
> specifically one who might have trouble understanding the kinds of things
> we're discussing, and who has never iterated over a string before (which,
> if I am to
On Tue, Feb 25, 2020 at 5:52 AM Alex Hall wrote:
>
> Of course consistency is valuable. I am asking how it is automatically more
> valuable than "better or worse", which isn't an idea that makes sense to me.
> Consistency isn't axiomatically valuable, it's valuable for reasons such as
> what yo
Well... also, the meaning in R is quite a bit different from any of the
meanings suggested by Wolfram. In fact, although the most common use in R
is "depends on", it's technically just a generic delayed evaluation without
any inherent semantics at all. Or, that is to say, tilde is just a certain
Of course consistency is valuable. I am asking how it is automatically more
valuable than "better or worse", which isn't an idea that makes sense to
me. Consistency isn't axiomatically valuable, it's valuable for reasons
such as what you've explained which ultimately boil down to what's better
or w
Aaron Hall wrote:
> The context for this is statistics , so I'll quote Wolfram on tilde in the
> context of
> statistics: http://mathworld.wolfram.com/Tilde.html
> "In statistics, the tilde is frequently used to mean "has the distribution
> (of)," for
> instance, X∼N(0,1) means "the stochastic (r
This is just an idea, which may not in practice be a major problem but can at
times be an inconvenience. I thought I had posted this in the "python -m"
thread a little while back but checking my history it does't appear I did, I do
apologize if this is a duplicate.
When running a python script
The context for this is statistics , so I'll quote Wolfram on tilde in the
context of statistics: http://mathworld.wolfram.com/Tilde.html
"In statistics, the tilde is frequently used to mean "has the distribution
(of)," for instance, X∼N(0,1) means "the stochastic (random) variable X has the
di
This seems like a feature looking for a use-case.
I don't think the use case presented is good enough, since in this thread I've
seen it given three incompatible operator priorities (higher than `+`, lower
than `+`, and one that seems to be a sort of assignment?) and a handful of
loosely relate
On Mon, 24 Feb 2020 09:16:12 -0800
Christopher Barker
wrote:
> This is an honest question:
>
> Is it helpful to anyone taking part in this conversation about the
> conversation to have it?
>
> I don’t think it’s helpful to the list as a whole, honestly.
Agreed. Especially as it seems to be reh
This is an honest question:
Is it helpful to anyone taking part in this conversation about the
conversation to have it?
I don’t think it’s helpful to the list as a whole, honestly.
I suggest next time the conversation gets a bit heated or offensive, and
someone points it out, that everyone invol
On Mon, 24 Feb 2020 at 16:23, Alex Hall wrote:
> Roughly, though I think you might be hearing me wrong. There is lots of
> existing code that correctly and intentionally iterates over strings. And
> code that unintentionally does it probably doesn't live for long. But if you
> took a random sam
On 24.02.20 13:24, Rhodri James wrote:
This seems a lot like trying to shoehorn something in so one can write
idiomatic R in Python. That on the whole sounds like a bad idea; a
friend of mine use to say he could write FORTRAN in any language but
no one else could read it. Wouldn't it be more p
I don't see what's wrong with the status quo:
smf.ols(formula='Lottery ~ Literacy + Wealth + Region', data=df)
If I understand correctly you want to use instead:
smf.ols(formula=df.Lottery ~ df.Literacy + df.Wealth + df.Region)
Or since some people favor indexing over attribute access
On Tue, Feb 25, 2020 at 3:21 AM Alex Hall wrote:
> > It is not a question of right or wrong, better or worse. It is a question
> > of being consistent.
>
> Why would that be the question? Why is consistency more important than
> "better or worse"? How can you make such a bold claim?
>
Inconsis
> Are you implying that we should deprecate the `in` operator for strings
No, we should definitely keep the `in` operator. We can revisit the best
wording for the error/warning message later, my point is just that it
should be more considerate to beginners than "TypeError: 'str' object is
not iter
> A library implemented in a confusing way is not an example of nothing
wrong on Python strings. (I myself has made this stupid mistake many times
and I cannot blame neither Python nor sqlite for being careless.)
> In my humble opinion, your example does not prove that iterable strings
are faulty.
But couldn't you just write a simple helper function/class that handles
your usual workflow? Why does this deserve in the stdlib? (The stdlib does
very little logging of its own -- logging is up to the application.)
On Mon, Feb 24, 2020 at 2:24 AM Rémi Lapeyre wrote:
> Every time I use subproces
On Mon, Feb 24, 2020, 9:27 AM Rhodri James wrote:
> On 23/02/2020 18:33, Steve Jorgensen wrote:
> > In many ways, a string is more useful to treat as a scalar than a
> collection, so drilling down into collections and ending up iterating
> individual characters as the leaves is often 1 step too f
In mathematics, in my recollection, the tilde is used for
1. Unary approximate number
2. Binary equivalence
3. Binary congruence/isomorphism
The last is more formally an equal sign with tilde on top: ≅. I think maybe
just simplified for chalk boards where context makes it clear. Those are
all aki
On 23/02/2020 18:33, Steve Jorgensen wrote:
In many ways, a string is more useful to treat as a scalar than a collection,
so drilling down into collections and ending up iterating individual characters
as the leaves is often 1 step too far.
I think the key word here should be "sometimes". A
As the instigator here, I think it's my duty to clarify my intent on a
few things.
On 24/02/2020 08:49, Ethan Furman wrote:
On 02/23/2020 03:01 PM, Steven D'Aprano wrote:
But I am part of this community, and if I'm too scared to state my
opinions for fear of retaliation, then I'm not really pa
On 2/24/20 7:24 AM, Rhodri James wrote:
This seems a lot like trying to shoehorn something in so one can write
idiomatic R in Python. That on the whole sounds like a bad idea; a
friend of mine use to say he could write FORTRAN in any language but
no one else could read it. Wouldn't it be mo
On 24/02/2020 00:59, Brendan Barnwell wrote:
On 2020-02-23 16:32, Guido van Rossum wrote:
> Assuming that the reader is familiar with the example `Lottery ~
> Literacy + Wealth + Region` is *not* going to work. I have literally no
> idea from what field that is taken or what the purpose of the
On Mon, 24 Feb 2020 at 08:52, Ethan Furman wrote:
> In fact, when I first read Rhodri's post I thought it meant something along
> the lines of: programming language -> pie in the sky perfection. Hence, it
> is possible to be too terse.
I feel that this discussion has got out of hand, and it wo
On Mon, 24 Feb 2020 at 02:44, MRAB wrote:
>
> On 2020-02-24 02:22, Chris Angelico wrote:
> > On Mon, Feb 24, 2020 at 1:00 PM C. Titus Brown wrote:
> >>
> >> WHATS WRONG WITH TOP POSTING IN ALL CAPS AND NO PUNCTUATION!?!?!?!
> >>
> >> :)
> >
> > Oh, it's alright, you just put all the punctuation a
On Sun, 23 Feb 2020 at 02:52, Chris Angelico wrote:
>
> On Sun, Feb 23, 2020 at 1:15 PM Ethan Furman wrote:
> >
> > On 02/22/2020 04:37 PM, Chris Angelico wrote:
> >
> > > Do any of the core devs agree with those two assertions?
> >
> > If posts to -Ideas required core dev agreement this would be
Every time I use subprocess.run and others I find myself writing boilerplate
code to log program calls and their results.
Could we log those directly in subprocess.py so that we could just set a
"subprocess" logger instead?
Rémi
___
Python-ideas mail
24.02.20 02:27, Aaron Hall via Python-ideas пише:
I have no behavior for integers in mind. I would expect high-level libraries to
want to implement behavior for it.
- sympy
- pandas, numpy, sklearn, statsmodels
- other mathematically minded libraries (monadic bind or compose?)
To do this we ne
On 02/23/2020 03:01 PM, Steven D'Aprano wrote:
I've been sitting on this email for the best part of a week. It hasn't
been an easy decision to decide to send it, because I expect it will
ruffle some feathers, including someone who, last time I ruffled his
feathers, banned me from one of the othe
64 matches
Mail list logo