asyncio cancellation pattern

2020-12-28 Thread Joseph L. Casale
I've started writing some asyncio code in lieu of using threads and managing concurrency and primitives manually. Having spent a lot of time using c#'s async implementation, I am struggling to see an elegant pattern for implementing cancellation. With the necessity for the loop (that of which I un

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Bischoop
On 2020-12-28, Michael Torrie wrote: > On 12/28/20 10:46 AM, Marco Sulla wrote: >> On Mon, 28 Dec 2020 at 17:37, Bischoop wrote: >>> >>> I'd like to check if there's "@" in a string and wondering if any method >>> is better/safer than others. I was told on one occasion that I should >>> use is th

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Richard Damon
On 12/28/20 8:02 PM, Chris Angelico wrote: > > Yes, many such regexes exist, and they are *all wrong*. Without > exception. I don't think it's actually possible for a regex to > perfectly match all (syntactically) valid email addresses and nothing > else. > > ChrisA Since Email addresses are allow

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Bischoop
On 2020-12-28, Mats Wichmann wrote: > On 12/28/20 10:46 AM, Marco Sulla wrote: >> On Mon, 28 Dec 2020 at 17:37, Bischoop wrote: >>> >>> I'd like to check if there's "@" in a string and wondering if any method >>> is better/safer than others. I was told on one occasion that I should >>> use is tha

RE: Which method to check if string index is queal to character.

2020-12-28 Thread Avi Gross via Python-list
Thanks, Chris, I am not actually up-to-date on such messaging issues but not shocked at what you wrote. Years ago I recall most messages going out of my workplace looked like machine!machine2!ihnp4!more!evenmore!user with no @ in sight and as you mention, you may want to send to a domain and have

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Chris Angelico
On Tue, Dec 29, 2020 at 10:08 AM Avi Gross via Python-list wrote: > > This may be a nit, but can we agree all valid email addresses as used today > have more than an @ symbol? > > I see it as requiring at least one character before the @ that come from a > list of allowed characters (perhaps not A

RE: Which method to check if string index is queal to character.

2020-12-28 Thread Avi Gross via Python-list
This may be a nit, but can we agree all valid email addresses as used today have more than an @ symbol? I see it as requiring at least one character before the @ that come from a list of allowed characters (perhaps not ASCII) but does not include the symbol @ again. It is normally followed by some

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Michael Torrie
On 12/28/20 1:27 PM, Richard Damon wrote: > Validating that it meets the SYNTAX of an email address isn't THAT hard, > but there are a number of edge cases to worry about. Yes one would think that, but in my experience half of all web sites get it wrong, insisting that my perfectly valid and RFC-c

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Grant Edwards
On 2020-12-28, Bischoop wrote: > On 2020-12-28, Stefan Ram wrote: >> >> "@" in s >> > > That's what I thought. > >>>I want check if string is a valid email address. >> >> I suggest to first try and define "valid email address" in English. > > A valid email address consists of an email prefix

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Richard Damon
On 12/28/20 4:52 PM, Michael Torrie wrote: > On 12/28/20 10:37 AM, Bischoop wrote: >> A valid email address consists of an email prefix and an email domain, >> both in acceptable formats. The prefix appears to the left of the @ symbol. >> The domain appears to the right of the @ symbol. >> For exam

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Chris Angelico
On Tue, Dec 29, 2020 at 8:57 AM dn via Python-list wrote: > After such disparagement it is worth remembering that there are checks > and there are checks! It depends upon the purpose of the check, or the > level-of-detail/accuracy desired! > > When accepting user-data it *is* worth (even "necessar

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Cameron Simpson
On 28Dec2020 13:08, Mats Wichmann wrote: >On 12/28/20 10:46 AM, Marco Sulla wrote: >>On Mon, 28 Dec 2020 at 17:37, Bischoop wrote: >>>I'd like to check if there's "@" in a string and wondering if any >>>method is better/safer than others. Others have pointed out: '@' in s >Will add that Yes, y

Re: Which method to check if string index is queal to character.

2020-12-28 Thread dn via Python-list
On 29/12/2020 09:27, Richard Damon wrote: On 12/28/20 3:08 PM, Mats Wichmann wrote: On 12/28/20 10:46 AM, Marco Sulla wrote: On Mon, 28 Dec 2020 at 17:37, Bischoop wrote: ... but probably what you really want is a regular expression. because... Will add that Yes, you should always va

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Michael Torrie
On 12/28/20 10:46 AM, Marco Sulla wrote: > On Mon, 28 Dec 2020 at 17:37, Bischoop wrote: >> >> I'd like to check if there's "@" in a string and wondering if any method >> is better/safer than others. I was told on one occasion that I should >> use is than ==, so how would be on this example. >> >>

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Michael Torrie
On 12/28/20 10:37 AM, Bischoop wrote: > A valid email address consists of an email prefix and an email domain, > both in acceptable formats. The prefix appears to the left of the @ symbol. > The domain appears to the right of the @ symbol. > For example, in the address exam...@mail.com, "example" i

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Richard Damon
On 12/28/20 3:08 PM, Mats Wichmann wrote: > On 12/28/20 10:46 AM, Marco Sulla wrote: >> On Mon, 28 Dec 2020 at 17:37, Bischoop wrote: >>> >>> I'd like to check if there's "@" in a string and wondering if any >>> method >>> is better/safer than others. I was told on one occasion that I should >>> u

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Mats Wichmann
On 12/28/20 10:46 AM, Marco Sulla wrote: On Mon, 28 Dec 2020 at 17:37, Bischoop wrote: I'd like to check if there's "@" in a string and wondering if any method is better/safer than others. I was told on one occasion that I should use is than ==, so how would be on this example. s = 't...@mail

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Chris Angelico
On Tue, Dec 29, 2020 at 6:18 AM Bischoop wrote: > > On 2020-12-28, Stefan Ram wrote: > > > > "@" in s > > > > That's what I thought. > > >>I want check if string is a valid email address. > > > > I suggest to first try and define "valid email address" in English. > > > > > > A valid email add

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Terry Reedy
On 12/28/2020 11:31 AM, Bischoop wrote: I'd like to check if there's "@" in a string Use the obvious "'@' in string". > and wondering if any method is better/safer than others. Any special purpose method built into the language is likely to be fastest. Safest? What danger are you worried a

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Bischoop
On 2020-12-28, Stefan Ram wrote: > > "@" in s > That's what I thought. >>I want check if string is a valid email address. > > I suggest to first try and define "valid email address" in English. > > A valid email address consists of an email prefix and an email domain, both in acceptable for

Re: Which method to check if string index is queal to character.

2020-12-28 Thread MRAB
On 2020-12-28 16:31, Bischoop wrote: I'd like to check if there's "@" in a string and wondering if any method is better/safer than others. I was told on one occasion that I should use is than ==, so how would be on this example. [snip] The shortest and quickest way to check whether "@" is in m

Re: Which method to check if string index is queal to character.

2020-12-28 Thread Marco Sulla
On Mon, 28 Dec 2020 at 17:37, Bischoop wrote: > > I'd like to check if there's "@" in a string and wondering if any method > is better/safer than others. I was told on one occasion that I should > use is than ==, so how would be on this example. > > s = 't...@mail.is' You could do simply if "@"

Which method to check if string index is queal to character.

2020-12-28 Thread Bischoop
I'd like to check if there's "@" in a string and wondering if any method is better/safer than others. I was told on one occasion that I should use is than ==, so how would be on this example. s = 't...@mail.is' I want check if string is a valid email address. code ''' import time email = "t...@

kivy,,, assigning global variable

2020-12-28 Thread Sadaka Technology
class main(..): def init.: super. button = Button(on_release=self.on_click) def on_click(self,screen,*args) self.clear_widgets() if screen == '2nd': float = 2nd() elif screen == '1st': float = 1st()