On Sat, 23 Dec 2023 at 07:13, DL Neil via Python-ideas
wrote:
>
> On 12/23/23 02:09, Eric V. Smith via Python-ideas wrote:
> > On 12/21/2023 4:38 PM, Steve Jorgensen wrote:
> >> I am finding that it would be useful to be able to define a dataclass that
> >> is an abstract base class and define
On Mon, 23 Oct 2023 at 01:14, Juancarlo Añez wrote:
>
> The re module is a black swan, because most of stdlib raises exceptions on
> invalid arguments or not being able to deliver.
>
This is a comparison function, and like every other comparison
function, it signals its results with a return
On Sun, 22 Oct 2023 at 11:29, MRAB wrote:
> I think what the OP wants is to have re.match either return a match or
> raise an exception.
Yes, and my point is that simply attempting to access an attribute
will do exactly that. It's not a silent failure.
Why create a new argument, then mandate
On Sun, 22 Oct 2023 at 06:37, Ram Rachum wrote:
>
> On Sat, Oct 21, 2023 at 10:30 PM Chris Angelico wrote:
>>
>>
>> > I love that, but it mostly makes sense for "if there's a match do this,
>> > otherwise do that" where most cases fall into &
On Sun, 22 Oct 2023 at 06:11, Ram Rachum wrote:
>
> On Sat, Oct 21, 2023 at 10:01 PM Chris Angelico wrote:
>>
>> On Sat, 21 Oct 2023 at 21:57, Ram Rachum wrote:
>>
>> What about an if with the match inside it?
>>
>> if m := re.match(...):
>>
On Sat, 21 Oct 2023 at 21:57, Ram Rachum wrote:
>
> It's a little similar to the reasoning behind PEP 618 (adding the `strict`
> argument to `zip`).
Not quite, since without strict, zip will truncate - it doesn't have a
different return value.
> A keyword argument is easier to add, and makes
On Mon, 25 Sept 2023 at 22:04, Dom Grigonis wrote:
>
> I think a lot has been said by this time and I have nothing to add.
>
> If this is something that is of value, I am sure it will be picked up when
> the time is right.
>
> One last thing that I think could be of some use is a poll:
>
>
On Mon, 25 Sept 2023 at 10:05, Dom Grigonis wrote:
>
> What is your position on this?
>
> Do you think that such thing is worth having?
>
> If yes, do any of the 3 final options seem sensible to you?
>
My position is that so far, you haven't shown it to be of much value.
Which might be because
On Mon, 25 Sept 2023 at 07:05, Dom Grigonis wrote:
> What I meant is that functions in __builtins__ are low level, with
> functionality which is hidden from the user.
>
What does that even mean?
ChrisA
___
Python-ideas mailing list --
On Mon, 25 Sept 2023 at 00:15, Dom Grigonis wrote:
> I see what you mean, but this property is arguably intrinsic to what it is.
> And is part of f-strings vs explicit formatting property too:
>
> variable = 1
> print(f'{variable=} and b={variable}')
> # VS
> msg = 'variable={v} and b={v}'
>
On Sat, 16 Sept 2023 at 19:48, Jeff Allen wrote:
> It needs language (parser) support because it does what you identified early
> on: "take whatever is given and put it in quotes", where "whatever is given"
> is the text of the expression only available at run-time.
>
I didn't say "and put it
On Sat, 16 Sept 2023 at 10:20, Dom Grigonis wrote:
>
> So following this thread, from your perspective and from what has been said
> you can’t see or noticed any parts of it needing interpreter?
Correct. Trying to get a variable name from an object is nonsensical,
and trying to get a variable
On Sat, 16 Sept 2023 at 10:07, Dom Grigonis wrote:
>
>
> > def nameof(x): return x
> >
> > print("This " + nameof("thing") + " is:", thing)
> Can you explain what you meant by this code? How would this work in editor?
>
Frankly, I have no idea, because your **entire proposal** is
predicated on
On Sat, 16 Sept 2023 at 08:50, Jeff Allen wrote:
> The parallel with f-string = is helpful, for which compile-time support is
> essential, of course.
It's really something that needs editor support, not compiler support.
As far as the Python interpreter is concerned, this is just a string.
So
On Tue, 12 Sept 2023 at 20:05, Dom Grigonis wrote:
>
> Please read the next part of my e-mail too. It actually answer your question.
>
I did read it, and it didn't answer the question. Your desired
semantics are not clear.
ChrisA
___
Python-ideas
On Tue, 12 Sept 2023 at 19:51, Dom Grigonis wrote:
>
> It wouldn’t. I know this is weird and not in line of how things work. This is
> more about simply getting reference variable name in locals() from the
> reference itself. But how would one access the variable name, when once
> called it
On Thu, 7 Sept 2023 at 23:51, Daniel Walker wrote:
>
> Perhaps this is a solution in search of a problem but I recently encountered
> this situation in one of my projects.
>
> I have an object, foo, which, due to the references it contains, I'd rather
> not keep around longer than necessary.
>
On Thu, 31 Aug 2023 at 18:55, Tim Hoffmann via Python-ideas
wrote:
>
> The standard pattern to create a sentinel in Python is
>
> >>> Unset = object()
>
> While this is often good enough, it has some shortcomings:
>
> - repr(Unset) is unhelpful:
>
Looks like you may be thinking of this:
On Tue, 22 Aug 2023 at 05:34, Wes Turner wrote:
>
> On Sat, Aug 19, 2023, 7:27 PM Celelibi wrote:
>>
>> 2023-08-04 8:18 UTC+02:00, daniil.arashkev...@gmail.com
>> :
>> > Currently in Python we have construction like this:
>> >
>> > tt = 5
>> > while t:
>> > # do something
>> > tt -= 1
>>
On Sun, 20 Aug 2023 at 09:28, Celelibi wrote:
> Just as a reminder of C/C++: {pre,post}-{inc,dec}rementations bring
> their lot of issues with the language. Mostly the infamous *undefined
> behavors*. If you've done some C or C++ this very expression might
> send shivers down your spine.
The
On Tue, 8 Aug 2023 at 00:09, Celelibi wrote:
> Actually, now that I think about it, I guess a 'try' block without an
> 'except' and just a 'finally' would probably be a good candidate for a
> context manager. (Which I'm a big fan of. ^^)
Yeah, context managers are often a good way of writing a
On Sat, 5 Aug 2023 at 22:49, Dom Grigonis wrote:
> 3. The Python syntax is easily understandable to anyone who knows English as
> it follows English syntax: "What are you doing tonight?" "I'm going to the
> movies, if I manage to leave work on time, otherwise I'll just stay home.”
> * Is the
On Sat, 5 Aug 2023 at 22:49, Dom Grigonis wrote:
> 9. Python has a syntax for conditional expressions. Learn it, if you want to
> use Python. No need to create multiple syntaxes for the same thing.
> * Hello Chris A? :)
Nope.
ChrisA
___
On Wed, 2 Aug 2023 at 08:22, Mitch wrote:
>
> If `except` is omitted, then catch the generic exception and do nothing and
> exit.
>
Not sure what you mean here. If you have a try-finally with no except
clause, no exceptions will be caught; the try will be run, then the
finally, and then you'll
On Wed, 2 Aug 2023 at 04:03, Mitch wrote:
> I'll ask the same question as OP: "Is there a reason why else without except
> has to be invalid syntax?"
>
A better question is: "Is there a reason why else without except
should be valid syntax?"
ChrisA
On Wed, 2 Aug 2023 at 02:02, Celelibi wrote:
> If later on an "except" is added, the developper doing the
> modification should be reminded to move the call to
> no_error_occurred() into an "else". With real-world non-trivial code,
> it might not be so simple to see.
>
Can you give us an example
On Wed, 26 Jul 2023 at 01:20, Jonathan Crall wrote:
>
> > On Mon, Jul 24, 2023 at 10:04 AM Chris Angelico wrote:
> > can you tell me what this vetting procedure proves that isn't already
> > proven by mere popularity itself?
>
> I think that's what this thread is t
On Tue, 25 Jul 2023 at 01:03, Dom Grigonis wrote:
> I think what would be nice to have is a set of dimensions that are deemed to
> be of importance when deciding on a language constructs.
> plot(dim1, dim2, dim3)
> dim1 - number of lines
> dim2 - number of terms
> dim3 - number of operations
>
On Mon, 24 Jul 2023 at 23:28, Jonathan Crall wrote:
>
> If popular packages weren't favored that would be a problem. Popularity
> should be correlated with "trustworthiness" or whatever the metric this
> curated repo seeks to maximize. I think the important thing is that the
> packages are
On Mon, 24 Jul 2023 at 21:02, James Addison via Python-ideas
wrote:
> ... some thoughts on how to build a scalable, resilient trust network based
> on user ratings; I can't guarantee that it'll change your opinion, though!
>
This still has the fundamental problems of any sort of user rating
On Sun, 23 Jul 2023 at 14:08, Dom Grigonis wrote:
>
> IT IS AN OBJECT. Never said otherwise.
One that you can't do any of the operations I described. There is no
way to use it as an object.
> `inspect.getcallargs` can seemingly be modified for such behaviour. I just
> wrote a decorator, which
On Sun, 23 Jul 2023 at 12:20, Dom Grigonis wrote:
>
>
> > There is no way to have a value that isn't a value, in Python. The
> > concept doesn't make sense and would break all kinds of things.
> > (That's why, when a special function like __getitem__ has to be able
> > to return literally
On Sun, 23 Jul 2023 at 09:15, Dom Grigonis wrote:
> This works ok:
>
> ```
> def foo(bar=None):
> if bar is None:
> bar = A()
>
> class A:
> pass
> ```
>
> If PEP is aiming to replace the latter example, then it would be great if it
> kept all of its advantages. I.e. not having
On Fri, 21 Jul 2023 at 19:58, Dom Grigonis wrote:
>
> Did not mean that it is easy, but it seems achievable and although a deep dig
> might be needed, my gut feeling is that it is possible to achieve this fairly
> elegantly. I might be wrong ofc.
>
Start on that deep dig, then, and figure out
On Fri, 21 Jul 2023 at 19:15, Dom Grigonis wrote:
> However, it could be done differently as well. If `Break()` takes effect in
> the scope where it is evaluated. Then:
>
You say that as if it's easy. How would this work? How do you have a
function that, when called, causes the current loop to
On Fri, 21 Jul 2023 at 11:08, Dom Grigonis wrote:
> Also, can't find a way to ONLY force evaluation without any additional
> operations in this specific library. A simple callable which evaluates if
> unevaluated & returns would do. Then:
>
> def IF(condition, when_true, when_false):
> if
On Fri, 21 Jul 2023 at 05:53, Random832 wrote:
>
> On Mon, Jul 17, 2023, at 16:41, Dom Grigonis wrote:
> > Would be interesting to see if my preference is an outlier or not really.
>
> I think this is a false dichotomy. We should consider VB-like conditional
> expressions if(condition,
On Thu, 20 Jul 2023 at 22:27, Stephen J. Turnbull
wrote:
>
> Chris Angelico writes:
> > On Thu, 20 Jul 2023 at 15:33, Stephen J. Turnbull
> > wrote:
>
> C'mon Chris, "that was then, this is now". Catch up, I've changed my
> position. ;-)
>
That's f
On Thu, 20 Jul 2023 at 19:34, Dom Grigonis wrote:
> And ideally, adding 2 builtin(or imported from stdlib) functions: `Break` and
> `Continue`, which if called act as `break` and `continue` statements.
>
How would they work? Would every function call have to provide the
possibility to return to
On Thu, 20 Jul 2023 at 18:16, Greg Ewing wrote:
>
> On 20/07/23 6:30 pm, James Addison via Python-ideas wrote:
> > result = default if bar is None else bar
> > or if you prefer
> > result = bar if bar is not None else default
>
> Would it shut anyone up if we had another logical
On Thu, 20 Jul 2023 at 17:09, Dom Grigonis wrote:
>
> On 20 Jul 2023, at 09:48, anthony.flury wrote:
> In Python then a better way might be
>
> result = temp := bar() if temp else default
>
> This way only bar() and default are evaluated and invoked once.
>
I presume you want a more complicated
On Thu, 20 Jul 2023 at 15:33, Stephen J. Turnbull
wrote:
> I didn't like that PEP then; I was in the camp of "let's get genuine
> Deferreds, and use them to cover some of the use cases for PEP 671."
You're almost certainly never going to get that, because "genuine
Deferreds", as well as being
On Wed, 19 Jul 2023 at 11:51, Dom Grigonis wrote:
>
> Coming back to deferred evaluation,
>
> https://peps.python.org/pep-0671/
> These 2 aren’t really orthogonal in functionality. Maybe in implementation.
> But PEP671 is a certain subset of deferred evaluation as it can achieve the
> same with
On Wed, 19 Jul 2023 at 06:41, Dom Grigonis wrote:
>
> When you put it from this perspective, it seems to make sense, however, I do
> not agree.
>
> To me, from first principles it seems it’s all about condensing more
> complexity in smaller modular packages.
>
> That is why I am a bit confused,
On Wed, 19 Jul 2023 at 00:55, Dom Grigonis wrote:
> Here I am a bit confused, how is this the case in the language containing
> list comprehensions?
>
Do you understand the difference between expressiveness and terseness?
You still seem to be focused on the completely wrong thing here. List
On Tue, 18 Jul 2023 at 23:41, Stephen J. Turnbull
wrote:
> 2. Comparing floats, even against zero, is a bad idea. So I would
> wrap them in math.isclose:
>
> val = a ? (not isclose(c, 0) ? c : d) : (not isclose(d, 0) ? d : c)
That's overly simplistic; there are a lot of times when it's
On Tue, 18 Jul 2023 at 19:02, Dom Grigonis wrote:
>
> Thank you.
>
> I meant “superset of 671, not 505”…
>
> One question:
>
> def bar(a => None);
> return foo(a)
>
> def foo(a => object()):
> return a
>
> How would I force foo’s default from bar’s call?
That's a known-hard problem. The
On Tue, 18 Jul 2023 at 16:25, Dom Grigonis wrote:
>
> Yes, thank you, this would definitely be nice to have.
>
> Although, "A generic system for deferred evaluation has been proposed at
> times“ sound better if it was a superset of PEP505. Could you refer me to any
> resources about such
On Tue, 18 Jul 2023 at 14:07, Dom Grigonis wrote:
> PEP505 would solve this nicely, but it only applies to None and would not
> apply to say user-defined sentinels and many other cases where permutations
> of different conditionals arise.
>
PEP 671 would solve this nicely too.
ChrisA
On Tue, 18 Jul 2023 at 10:37, Dom Grigonis wrote:
> As opposed to
>
> if a == 0:
>foo, bar = var1, variable2
> else:
>foo, bar = default, default2
>
>
> Again, one is `a == 0`, another is `b == 0`. I didn’t do a good job conveying
> this did I… Will try to be more precise and leave less
On Tue, 18 Jul 2023 at 08:56, Dom Grigonis wrote:
>
> Just to add, I think your statement actually works in my favour rather than
> against my proposal.
>
> People from this group are potentially biased and lack objectivity against
> what I am proposing because they are familiar with python and
On Tue, 18 Jul 2023 at 08:38, Dom Grigonis wrote:
>
> > Was that really the intention? Because I was there when PEP 572 was
> > written, and I don't recall "beautiful one-liners" as one of the
> > justifying reasons. Use around if/while conditions was a strong
> > reason, and yes, that can save a
On Tue, 18 Jul 2023 at 08:34, Dom Grigonis wrote:
>
> I still feel that compared to list comprehension and other functional and
> elegant python constructs, python's if-else expression is lacking. I often
> choose to go multi-line much more verbose code as opposed to more brief
> constructs
On Tue, 18 Jul 2023 at 06:43, Dom Grigonis wrote:
>
> Hi everyone,
>
> I am not very keen on long discussions on such matter as I do not think there
> is much to discuss: there is no technical complexity in it and it doesn’t
> really change or introduce anything new. It is only a matter of
On Tue, 18 Jul 2023 at 06:40, Dom Grigonis wrote:
>
> We even got a new operator “:=“ to help us with those beautiful one-liners
> (or not) to move towards aesthetics and brevity.
>
Was that really the intention? Because I was there when PEP 572 was
written, and I don't recall "beautiful
On Tue, 18 Jul 2023 at 04:37, Dom Grigonis wrote:
>
> This is NOT a good example, my first language was R, second - python, third
> matlab, etc.
>
> I only became familiar with C/C++ after several years of coding experience.
>
> This is why, I would dare to say that this preference of mine is
On Tue, 18 Jul 2023 at 03:13, Dom Grigonis wrote:
> Maybe for someone who majored in languages python’s if-else is more easily
> understood. To me, personally, 2nd one is unbearable, while 1st one is fairly
> pleasant and satisfying.
>
This is a REALLY good example of how hard it is to be
On Sun, 16 Jul 2023 at 04:07, Jothir Adithyan wrote:
>
> Chris Angelico wrote:
> > On Tue, 11 Jul 2023 at 08:05, Jothir Adithyan adithyanjot...@gmail.com
> > wrote:
> > > Assumptions:
> > > The problem statement is based on a few assumptions:
> > &g
On Tue, 11 Jul 2023 at 08:05, Jothir Adithyan wrote:
> Assumptions:
>
> The problem statement is based on a few assumptions:
> - You prefer chaining `get` statements for cleaner code.
> - You expect at least some of the `get` methods to return `None`.
> - You want to avoid the hassle of using
On Sun, 9 Jul 2023 at 18:06, James Addison via Python-ideas
wrote:
>
> On Sun, 9 Jul 2023 at 02:11, Cameron Simpson wrote:
> > I have always thought that any community scoring system should allow
> > other users to mark up/down other reviewers w.r.t the scores presented.
> > That markup should
On Thu, 6 Jul 2023 at 04:08, Gregory Disney
wrote:
>
> Why not just use gpg signatures and maintain trusted signing keys? There’s no
> reason to reinvent the wheel. If a user wants to use a unsigned or untrusted
> packages, they have to accept the risk.
>
As an alternative to a blockchain? No
On Thu, 6 Jul 2023 at 04:02, Dom Grigonis wrote:
> What I would alternatively propose is to introduce a couple of (meaningless
> operators), so that library developers can make use of them as they wish.
> What characters aren't used? “$, ?, `” (or are they?).
>
What should their precedences
On Thu, 6 Jul 2023 at 03:57, James Addison via Python-ideas
wrote:
> I also agree with a later reply about avoiding the murkier side of
> blockchains / etc. That said, it seems to me (again, sample size one
> anecdata) that creating a more levelled playing field for package publication
>
On Wed, 5 Jul 2023 at 17:12, Stephen J. Turnbull
wrote:
> > 4) A self contained repository of packages that you could point
> > pip to -- it would contain only the packages that had met some
> > sort of "vetting" criteria. In theory, anyone could run it, but
> > a stamp of
On Wed, 5 Jul 2023 at 17:00, Christopher Barker wrote:
> I'm noting this, because I think it's part of the problem to be solved, but
> maybe not the mainone (to me anyway). I've been focused more on "these
> packages are worthwhile, by some definition of worthwhile). While I think
> Chris A is
On Wed, 5 Jul 2023 at 15:07, Jonathan Crall wrote:
>
> I like the idea of a vetted package index that pip can point to. The more I
> think about it, the more I think that it needs some sort of peer review
> system as the barrier to entry, and my thoughts to to establishing some DeSci
> DAO
On Wed, 5 Jul 2023 at 10:26, Christopher Barker wrote:
> The :problem", as I see it.
>
> - The Python standard library is not, and will never be fully comprehensive
> -- most projects require *some* third party packages.
> - There are a LOT of packages available on PyPi -- with a very wide
On Sun, 2 Jul 2023 at 16:36, Christopher Barker wrote:
>
> However, the amount of time the two of us have spent on this thread could
> have been used to review the status of quite a few packages :-)
>
>>
>> Indeed. But I expect it'd be easier to get one person to write one
>> blog post about
On Sun, 2 Jul 2023 at 15:48, Christopher Barker wrote:
>> Only re (the one in the stdlib)? What if you want PCREs -
>> there's no package called "pcre" but there's "pcre2", "python-pcre",
>> and probably others.
>
>
> And are those three (and others?) actually useful maintained packages? Or
>
On Sun, 2 Jul 2023 at 15:11, Christopher Barker wrote:
> The OP of this thread is not alone -- folks want an authoritative source --
> they may not get that
An authoritative source is absolutely perfect for someone who wants
less choices. "Just give me the one and only option and promise me
On Sun, 2 Jul 2023 at 07:00, Dom Grigonis wrote:
>
> If it’s curated by more experienced members of this mailing list I would feel
> more confident in depending on it and more keen to contribute and review PRs.
> Maybe, with luck, if some good robust solution arises, it could be
> streamlined
On Sat, 1 Jul 2023 at 22:32, Dom Grigonis wrote:
>
> Another idea, maybe this group could host a simple git repo.
>
This has the same problem of who is curating it. If it's uncurated,
that's PyPI as it already is. If it's controlled by the PyPA or PSF,
then it gives too much authority.
ChrisA
On Sat, 1 Jul 2023 at 18:43, Stephen J. Turnbull
wrote:
>
> Chris Angelico writes:
> > On Sat, 1 Jul 2023 at 01:15, Christopher Barker
> > wrote:
>
> > > Totally different topic, but I do think that a "curated" package
> > > repo wo
On Sat, 1 Jul 2023 at 16:09, Christopher Barker wrote:
>If the PSF recommends a package
>
> Who said anything about the PSF? ;-) -- but yes, that would be another way
> to go -- a tightly curated collection -- lower barrier to entry than the
> standard library, but still pretty high.
Who
On Sat, 1 Jul 2023 at 01:15, Christopher Barker wrote:
> Totally different topic, but I do think that a "curated" package repo would
> be helpful -- there is a lot of cruft on PyPi :-(
>
That idea gets thrown around every once in a while, but there are a
few problems with it. When you "bless"
On Thu, 15 Jun 2023 at 06:04, Dom Grigonis wrote:
> So following Chris’ logic...
> If there are 10,000,000 python users on Stack…
> And we assume, that every user encounters such need at least 2 times a year
> (being very speculative here, would say conservative?).
That was me being VERY
On Wed, 14 Jun 2023 at 09:05, BoppreH via Python-ideas
wrote:
>
> @ChrisA: There are already flags for enabling warnings on dangerous bytearray
> comparisons[1] or relying on locale-dependent encodings[2], not to mention a
> whole Development Mode flag[3] that adds extra checks. Some of those
On Wed, 14 Jun 2023 at 07:52, BoppreH via Python-ideas
wrote:
>
> Sorry, I'm new to the list and was not aware the burden of proof was so high.
> Can you point me to one or two successful posts in Python-ideas where I can
> learn how to show there's a real need for a feature?
>
It's more a
On Wed, 14 Jun 2023 at 07:02, BoppreH via Python-ideas
wrote:
>
> > In close to 10 years of experience with python I have never encountered
> > anything like this.
>
> Here's a small selection of the StackOverflow questions from people who
> encountered this exact issue:
But now try to find
On Wed, 14 Jun 2023 at 01:07, BoppreH via Python-ideas
wrote:
> And I have to say I'm surprised by the responses. Does nobody else hit bugs
> like this and wish they were automatically detected?
>
Nope, I've never had that happen to me, and I *have* made use of
calling iter() on
On Tue, 13 Jun 2023 at 21:03, BoppreH via Python-ideas
wrote:
>
> Any thoughts on logging a warning, perhaps behind an opt-in flag? I could not
> find a single false positive scenario, so I expect the signal-to-noise ratio
> to be high and prevent lots of bugs.
>
Shadow the iter() function and
On Tue, 13 Jun 2023 at 14:54, Greg Ewing wrote:
>
> On 13/06/23 11:38 am, Chris Angelico wrote:
> > (Fun fact: Pike looked at what Python was doing, and came up with a
> > concept of "continue functions"
>
> And I gather that the "async" and "awa
On Tue, 13 Jun 2023 at 09:33, Greg Ewing wrote:
>
> On 13/06/23 9:29 am, Dom Grigonis wrote:
> > Also, could anyone point me in the direction, where it is explained why new
> > await/async syntax was introduced instead of making use of already existing
> > yield coroutine functionality?
>
> To
On Tue, 13 Jun 2023 at 07:33, Dom Grigonis wrote:
>
> I was wandering if there are any issues in making `yield` usage to be the
> same as that of `await`
>
> Most importantly:
> l.append(yield Object())
You should be able to use that, since yield *is* an expression. The
only oddity is, you have
On Sat, 3 Jun 2023 at 10:12, David Mertz, Ph.D. wrote:
>
> Let's call the styles a tie. Using the SOWPODS scrabble wordlist (no
> currency symbols, so False answer):
>
> >>> unicode_currency = {chr(c) for c in range(0x) if
> >>> unicodedata.category(chr(c)) == "Sc"}
> >>> wordlist =
On Sat, 3 Jun 2023 at 09:42, David Mertz, Ph.D. wrote:
>
> Yeah... oops. Obviously I typed the version in email. Should have done it in
> the shell. But you got the intention of set-ifying the characters in the
> large string.
Yep. I thought of that as I was originally writing, but absent
On Sat, 3 Jun 2023 at 08:28, David Mertz, Ph.D. wrote:
>
> This is just bar talk at this point. I think we've shown that this is
> easy enough to do that programmers can roll their own.
>
> But as idle chat goes, note that in your code:
>
>set(unicodedata.category(ch) for ch in s)
>
> If `s`
On Sat, 3 Jun 2023 at 07:28, David Mertz, Ph.D. wrote:
>
> Sure. That's fine. With a sufficiently long strings my code is faster, but
> for "typical" strings yours will be.
Really? How? Your code has to build a set of every character in the
string; mine builds a set of every category in the
On Sat, 3 Jun 2023 at 07:08, David Mertz, Ph.D. wrote:
>
> def does_string_have_currency_mark(s):
> return bool(set(s) & set(unicode_categories['Sc'])
>
> def does_string_have_numeric_digit(s): ...
>
> ... and so on. Those seem like questions one asks often enough. Not
> every day, but more
On Sat, 3 Jun 2023 at 06:54, David Mertz, Ph.D. wrote:
>
> If we're talking PyPI, it would be nice to have:
>
> unicode_categories = {"Zs": [...], "Ll": [...], ...}
>
> For all the various categories. It would just take one pass through
> all the characters to generate it, but then every
On Fri, 2 Jun 2023 at 02:27, David Mertz, Ph.D. wrote:
>
> It feels to me like "split on whitespace" or "remove whitespace" are
> quite common operations. I've been frustrated a number of times by
> settling for the ASCII whitespace class when I really wanted the
> Unicode whitespace class.
>
On Sat, 20 May 2023 at 02:53, Michael R wrote:
>
> To whom it may concern:
>
> Is it possible to create a Visual Python with options and editing tools
> similar to Excel?
> In the beginning it could be a combo with a command-docker, calling for a
> visual Routine.
> Indented structure of coding
On Thu, 18 May 2023 at 05:14, Daniel Guffey wrote:
>
> Apologies, I didn't mean to imply PyPI was inherently untrustworthy,
> unusable, or irrelevant. Clearly, it has a place and I use it for packages
> that I am familiar with and trust.
Then I would advise being careful how you word things,
On Sat, 29 Apr 2023 at 23:01, wrote:
>
> Ad 4) Wouldn't "<=" be a little more logical than "=>"? The perceived
> direction of the "flow" of the default value is exactly opposite, i.e., the
> default value is always evaluated and then put *into* the argument.
>
Using arrows to represent
On Wed, 26 Apr 2023 at 11:18, Joao S. O. Bueno wrote:
> Worst case scenario, one goes from one non-running program to a running
> program producing partially incorrect output.
>
Wording that another way: Buggy code, instead of raising an immediate
exception, now produces wrong output.
This is
On Fri, 21 Apr 2023 at 22:57, Jordan Macdonald wrote:
> However, I then encountered an issue: I could define a Protocol that
> specified the 'stop()' method easily enough, but if I annotated the manager
> as taking that, it would accept any class which implemented a method named
> 'stop()',
On Mon, 3 Apr 2023 at 17:57, Benedict Verhegghe wrote:
>
> Well, it's not an object of type 'type' like the list or dict mentioned
> by the OP, for which len() give a
> TypeError: object of type 'type' has no len()
I'm not sure what you mean here. Enum is of type EnumMeta, which is a
subclass of
On Mon, 3 Apr 2023 at 15:54, Benedict Verhegghe wrote:
>
> Enum is not a type, like the OP suggested:
>
Well, it is:
>>> isinstance(Enum, type)
True
but it has a metaclass, meaning that the type of Enum is a subclass of type.
>>> type(Enum)
>>> type(Enum).__bases__
(,)
I mean, we wouldn't
On Mon, 3 Apr 2023 at 08:28, Greg Ewing wrote:
>
> On 2/04/23 6:36 pm, Benedict Verhegghe wrote:
> > An Enum is functionally a container with a limited set of constants. Why
> > should it not be legitimate to ask for the number of constants in it?
>
> But Enum itself isn't an enum, it's a
On Fri, 24 Mar 2023 at 13:02, Will Bradley wrote:
> It would be nice if I could just write "birthDate":
> date.strftime(r'%m/%d/%Y') as str, like in C#.
I'm sure it would - for you. Unfortunately it would most definitely
NOT be nice to write:
with something as str:
and then be unsure whether
1 - 100 of 2585 matches
Mail list logo