Le 20/04/20 à 13:08, Tony Flury via Python-list a écrit :
>
> On 10/04/2020 21:44, Elliott Dehnbostel wrote:
>> *We could do this:*
>>
>> chars = "abcaaabkjzhbjacvb"
>> seek = {'a','b','c'}
>> count = sum([1 for a in chars if a in seek])
>>
>> However, this changes important semantics by creating a
On 10/04/2020 21:44, Elliott Dehnbostel wrote:
*We could do this:*
chars = "abcaaabkjzhbjacvb"
seek = {'a','b','c'}
count = sum([1 for a in chars if a in seek])
However, this changes important semantics by creating an entire new
list before summing.
Creating the list is pointless in this ca
On 2020-04-10 15:44:05 -0500, Elliott Dehnbostel wrote:
> *Consider the following trivial for-loop:*
>
> chars = "abcaaabkjzhbjacvb"
> seek = {'a','b','c'}
> count = 0
> for a in chars:
> if a in seek:
> count += 1
>
> Gross. Twice nested for a simple count.
>
[...]
> I propose th
On 4/10/2020 4:44 PM, Elliott Dehnbostel wrote:
chars = "abcaaabkjzhbjacvb"
seek = {'a','b','c'}
count = 0for a in chars:
if a in seek:
count += 1
Why did you repeatly omit the \n after 0? Please paste code that ran
Gross. Twice nested for a simple count.
Twice indented d
On 10/04/2020 21:44, Elliott Dehnbostel wrote:
Hello Everyone,
I've also posted this to the python-ideas mailing list, but I thought to
post here as well for a more general audience.
If I've done this incorrectly, please let me know so that I can
improve/revise. I'm new to the Python community
Ah yes it's an iterable not a condition. Sorry about that. 😛😛
Souvik flutter dev
On Sat, Apr 11, 2020, 6:38 AM Chris Angelico wrote:
> On Sat, Apr 11, 2020 at 11:04 AM Souvik Dutta
> wrote:
> >
> > How about completely removing the need for an if statement by allowing
> for multiple conditions
On Sat, Apr 11, 2020 at 11:04 AM Souvik Dutta wrote:
>
> How about completely removing the need for an if statement by allowing for
> multiple conditions to be inserted in the for loop?? That would make reading
> and writing a lot easier. Like the count problem could be rewritten as
> for (a in
How about completely removing the need for an if statement by allowing for
multiple conditions to be inserted in the for loop?? That would make
reading and writing a lot easier. Like the count problem could be rewritten
as
for (a in chars and ):
count+=1
On Sat, 11 Apr, 2020, 6:21 am Chris An
On Sat, Apr 11, 2020 at 10:32 AM Juergen Brendel wrote:
>
>
> Hello!
>
> On Fri, 2020-04-10 at 15:44 -0500, Elliott Dehnbostel wrote:
> > chars = "abcaaabkjzhbjacvb"
> > seek = {'a','b','c'}
> > count = 0
> >
> > for a in chars if a in seek: count += 1
>
> Interesting proposal. However, I'm not su
Hello!
On Fri, 2020-04-10 at 15:44 -0500, Elliott Dehnbostel wrote:
> chars = "abcaaabkjzhbjacvb"
> seek = {'a','b','c'}
> count = 0
>
> for a in chars if a in seek: count += 1
Interesting proposal. However, I'm not sure how much benefit it really
will give us in practice. Reason being: Conditi
On 11/04/20 8:44 AM, Elliott Dehnbostel wrote:
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 Python 3, but have I have a peeve about it. I'd like
to propose and discuss the following
Hello Everyone,
I've also posted this to the python-ideas mailing list, but I thought to
post here as well for a more general audience.
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
12 matches
Mail list logo