Artemis wrote:
> > So your proposal is reducing features instead of
> > expanding them.
> > Surely, the __name__ variable would remain, so if people needed a more
> > powerful way of doing it they could use that? But then, we introduce
> > multiple ways of
> > doing the same thing...
> >
The OP i
redradist@gmail.com wrote:
> Hi all,
> In Python we often use the following syntax to call the main logic of script
> when it
> was ran:
> def main():
> pass # whatever should be done for `python ./script.py`
>
> if __name__ == '__main__':
> main()
>
> Maybe it is a time to introduce the
Greg Ewing wrote:
> On 6/05/20 7:45 pm, Henk-Jaap Wagenaar wrote:
> > So... say you are solving a problem in 1d, you do
> > that on a real number
> > x, right? Now you solve it in 2d, so you do your work on a pair (x, y),
> > then you might solve it in 3d and do your work on a triplet (x, y, z).
Steven D'Aprano wrote:
> On Tue, May 05, 2020 at 09:34:28AM -, jdve...@gmail.com wrote:
> > (frozenset() == set()) is True shocked
> > me.
> > According to wikipedia https://en.wikipedia.org/wiki/Equality_(mathematics):
> > "equality is a relationship between two quantities or, more generally t
Raymond Hettinger wrote:
> > On May 3, 2020, at 6:19 PM, Steven D'Aprano st...@pearwood.info wrote:
> > frozenset and set make a counterexample:
> > frozenset({1}) == {1}
> > True
> > Nice catch! That's really interesting. Is there reasoning
> > behind
> > frozenset({1}) == {1} but [1] != (1,), or
Alex Hall wrote:
> If you use the word 'even' and tell me it has to do with lengths (or any
> number) I'm going to think of multiples of 2, not equality.
> On Mon, May 4, 2020 at 3:52 PM jdve...@gmail.com
> wrote:
> > Guido van Rossum wrote:
> > I should really stay out of this (hundreds of
> > mes
Guido van Rossum wrote:
> I should really stay out of this (hundreds of messages and still
> bickering^Wbikeshedding :-), but I personally find strict=True less
> confusing than equal=True, both for zip() and for map(). If I didn't know
> what was going on, seeing equal=True would make me wonder ab
André Roberge wrote:
> On Fri, Apr 10, 2020 at 5:26 PM Elliott Dehnbostel pydehnbos...@gmail.com
> wrote:
> > Hello Everyone,
> > If I've done this incorrectly, please let me know so that I can
> > improve/revise. I'm new to the Python community and quite enjoy the more
> > functional features of P
Soni L. wrote:
> On 2020-04-09 8:48 a.m., Rhodri James wrote:
> > [Muchly snipped]
> > On 09/04/2020 12:27, Soni L. wrote:
> > To put it simple, unpacking raises
> > ValueError:
> > But if the iterator raises ValueError, there's no way to tell it
> > apart from the unpacking:
> > I don't see how t
Paul Sokolovsky wrote:
> Hello,
> On Mon, 30 Mar 2020 16:25:07 -0700
> Christopher Barker python...@gmail.com wrote:
> > As others have pointed out, the OP started in a bit
> > of an oblique
> > way, but it maybe come down to this:
> > There are some use-cases for a mutable string type.
> > For av
Nadav Wexler wrote:
> Hi,
> That is my first post here, I hope it's the right place for it.
> so I was using some dicts had the following code:
> env = dict(t for t in os.environ.items() if 'SUBSTRING' not in t[0])
> and I thought: It could have really been nice if i could do:
> env
I completely agree with Andrew Barnert.
I just want to add a little comment about overriding the `+=` (and `+`)
operator for StringIO. Since StringIO is a stream --not a string--, I think
`StringIO` should continue to use the common interface for streams in Python.
`write()` and `read()` are fi
joperez@hotmail.fr wrote:
> There should be one-- and preferably only one --obvious way to do it. (from
> The Zen of
> Python https://www.python.org/dev/peps/pep-0020/)
> However, in something as basic as import syntax, that's not the case. This
> example comes
> from PEP 221 (https://www.python.
Guido van Rossum wrote:
> Looks like NotImplemented is widely misunderstood. It should ONLY be
> returned from binary operator overloads, like __add__.
> On Wed, Mar 11, 2020 at 03:49 jdve...@gmail.com
> wrote:
> > Steven D'Aprano wrote:
> > On Wed, Mar 11, 2020 at 09:42:15AM -, Steve
> > Jorge
Steven D'Aprano wrote:
> On Wed, Mar 11, 2020 at 09:42:15AM -, Steve Jorgensen wrote:
> > I realize this is probably something that would be
> > hard to change for
> > compatibility reasons. Maybe someone can think of a way around that
> > though?
> > It seems to me that not NotImplemented sh
Steve Jorgensen wrote:
> I realize this is probably something that would be hard to change for
> compatibility
> reasons. Maybe someone can think of a way around that though?
> It seems to me that not NotImplemented should result in
> NotImplemented and attempting to convert it to bool should rais
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
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
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
out, and it's unfair to say that quoting people who have
> struggled with these bugs is not evidence for the problem.
> Similarly for jdveiga, I cannot give you "real workable surprising code"
> because I'm talking about code that isn't workable as a result of being
>
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
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
Aaron Hall wrote:
> Currently, Python only has ~ (tilde) in the context of a unary operation (like
> -, with __neg__(self), and +, __pos__(self)).
> ~ currently calls __invert__(self) in the unary context.
> I think it would be awesome to have in the language, as it would allow
> modelling along
Greg Ewing wrote:
> On 24/02/20 9:32 am, jdve...@gmail.com wrote:
> > It is a common "pattern" in any languages to walk
> > along strings,
> > letter by letter.
> > Maybe in some other languages, but I very rarely find myself doing
> that in Python. There is almost always some higher level way of
>
ives would be chosen, of course. But they were not. It is not a
question of right or wrong, better or worse. It is a question of being
consistent. And, I should say, Python is consistent in this particular point.
> I'm out of time, so I'll just quickly say that I prefer .chars as a
Sebastian Berg wrote:
> However, in the same code, often strings are actually not desired to be
> handled as sequences.
> I.e. some code uses strings as sequences of characters, but most code
> probably uses the meaning that a string is a word, or sentence: the
> individual character has no useful
Alex Hall wrote:
> I've also had to special case strings when dealing with iterables
> generically, and it's annoying, but it's not a big deal. The real problem
> is when you meant to pass an iterable of strings and you just passed a
> single string and it produces confusing behaviour - something m
Steve Jorgensen wrote:
> > The only change I am proposing is that the iterability for characters in a
> string be moved from the string object itself to a view that is returned from
> a
> chars() method of the string. Eventually, direct iteratability would be
> deprecated and then removed.
That s
Kyle Stanley wrote:
> In order for this proposal to be seriously considered, I think it's
> necessary to cite many realistic examples where the current behavior is
> problematic enough to justify changing the current behavior, and that
> adding a str.chars() and eventually removing the ability to i
Ok... Though some kind of logging configuration, even a default one, is always
present. For example, when logging.info() module method --or some one similar--
is called for the first time, it creates a basic logger with a last resort
handler if none exists --at least up to my knowledge. So autom
So, are you suggesting that -L must create a basic logger with the given
logging level? Is it right? It can work...
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python
Nice idea... in principle.
But, what if my program has several loggers with several handlers each having
its own logging info level? Would the Python's interpreter CLI argument (or the
ENV variable) override all loggers and handlers logging levels? Why should CLI
/ ENV override those loggers an
May I suggest mark string with comments instead of populating the interpreter
with lost of "string" templates?
Something like
"SELECT * FROM table" # string: sql
Or
"spam ham eggs # template: html
IDEs can read this comment and highlight (and do some other static checks) on
the commented st
Thank you for all your answers. They were all very instructive to me.
However, after further investigation, I feel that I have made a mistake when
putting this topic on the table.
When walrus operator was discussed, it was proposed to restrict assignment
expressions to if, elif, and while state
Sorry, Soni, I do no speak Lua. Can you provide any documentation on that
point? I have found a function called assert but I am not sure that it works
like assertions in Python.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe sen
Good point, Brandt. However, `global` is not used in the assertion itself as
walrus operator can be.
My point is: is it good to add a new way of causing side effects in assertions?
Thank you.
___
Python-ideas mailing list -- python-ideas@python.org
To
Hi,
Recently the idea has come to me that walrus operator can have some issues when
use in assertions.
I have been taught that assertions must not produce side effects at all. This
is a problem in languages such as C. But not in Python (until 3.8) since it
does not allow assignment expressions
38 matches
Mail list logo