Re: Find word by given characters

2020-11-02 Thread Bischoop
On 2020-11-01, duncan smith  wrote:
>> 
>
> But this generates the letters counts for each word. They only need to
> be generated once (outside the for loop). And using count requires
> iterating over the letters / words for each x in letters (rather than
> once). For a large enough collection of words you'd notice the difference.
>

You're pretty much right, it doesn't go too fast.
I've done this years ago with Python2, had a bit free time now and
wanted to ReLearn Python from starting old projects I've done in past
but can't remember how I made it working lol. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-11-02 Thread Grant Edwards
On 2020-11-01, songbird  wrote:

> to keep a program simple i made it to open in the center.

That's not simple: it actually takes _extra_ work to do that.

> if i ever get back to it i'll have to figure out how to ask
> the windowing system what it wants to do for placement

I've never heard of doing that before. I've written lots of desktop
GUI apps in the past 30 years, and I've never written one line of code
dealing with the location of the top-level window. I just let the
toolkit and window manager handle it.



-- 
https://mail.python.org/mailman/listinfo/python-list


Post request and encoding

2020-11-02 Thread Hernán De Angelis

Hi everyone,

I am writing a program that sends a post request to a server. The post 
request may include keywords with Swedish characters (åöä).


I noticed that requests that include strings without those characters 
return a useful expected response. On the other hand, posts including 
those characters return an 'empty' response. However, if I save that 
same request to a file and send it using wget I do get a useful 
response. This suggests to me that the problem should be in how the post 
is sent or processed before being sent and not in how it is generated.


My request has the form:

header = {'Content-type':'application/xml', 'charset':'utf-8'}
response = requests.post(server, data=request, headers=header)

I have tried of course adding

request.encode('utf-8')

before sending the request but it has not lead to a different result.

I have spent several hours trying to understand whats going on here. I 
thought at first that this had to do with an issue described here: 
https://github.com/psf/requests/issues/5560 but apparently that issue 
was closed as it was deemed to be unrelated to the requests library.



Has anyone experienced this before? Is there something obvious I am 
missing here?


I am not new to programming but relatively new to Python, so bear with 
me please.



Thanks in advance

/H.


If it is of any use, I post the following too:

python3 -m requests.help
{
"chardet": {
"version": "3.0.4"
},
"cryptography": {
"version": "3.1.1"
},
"idna": {
"version": "2.10"
},
"implementation": {
"name": "CPython",
"version": "3.8.5"
},
"platform": {
"release": "5.9.1-1-default",
"system": "Linux"
},
"pyOpenSSL": {
"openssl_version": "1010108f",
"version": "19.1.0"
},
"requests": {
"version": "2.24.0"
},
"system_ssl": {
"version": "1010108f"
},
"urllib3": {
"version": "1.25.10"
},
"using_pyopenssl": true
}

--
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-11-02 Thread Grant Edwards
On 2020-11-01, songbird  wrote:

> certainly it isn't but it is my game and i kept it simple.  if
> people don't like it then they can find something else to play.  i'm
> good with that, but the next time i get back to making changes i'll
> see what i can figure out for saving the location where someone has
> moved it.

I have no objection to saving the most recent window size and using
that on the next startup, but I hate applications that force the
_location_ of the window. I've configured my window manager to open
windows where I want them opened, please respect that.

--
Grant


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Post request and encoding

2020-11-02 Thread Hernán De Angelis

Just reply to myself and whoever might find this useful.

encode() must be done within the request call:

header = {'Content-type':'application/xml', 'charset':'UTF-8'}
response = requests.post(server, data=request.encode('utf-8'), 
headers=header)


not in a previous separate line as I did.

Now it works. This wasn't an obvious way to proceed for me.

/H.


On 2020-11-02 10:06, Hernán De Angelis wrote:

Hi everyone,

I am writing a program that sends a post request to a server. The post 
request may include keywords with Swedish characters (åöä).


I noticed that requests that include strings without those characters 
return a useful expected response. On the other hand, posts including 
those characters return an 'empty' response. However, if I save that 
same request to a file and send it using wget I do get a useful 
response. This suggests to me that the problem should be in how the 
post is sent or processed before being sent and not in how it is 
generated.


My request has the form:

header = {'Content-type':'application/xml', 'charset':'utf-8'}
response = requests.post(server, data=request, headers=header)

I have tried of course adding

request.encode('utf-8')

before sending the request but it has not lead to a different result.

I have spent several hours trying to understand whats going on here. I 
thought at first that this had to do with an issue described here: 
https://github.com/psf/requests/issues/5560 but apparently that issue 
was closed as it was deemed to be unrelated to the requests library.



Has anyone experienced this before? Is there something obvious I am 
missing here?


I am not new to programming but relatively new to Python, so bear with 
me please.



Thanks in advance

/H.


If it is of any use, I post the following too:

python3 -m requests.help
{
"chardet": {
"version": "3.0.4"
},
"cryptography": {
"version": "3.1.1"
},
"idna": {
"version": "2.10"
},
"implementation": {
"name": "CPython",
"version": "3.8.5"
},
"platform": {
"release": "5.9.1-1-default",
"system": "Linux"
},
"pyOpenSSL": {
"openssl_version": "1010108f",
"version": "19.1.0"
},
"requests": {
"version": "2.24.0"
},
"system_ssl": {
"version": "1010108f"
},
"urllib3": {
"version": "1.25.10"
},
"using_pyopenssl": true
}


--
https://mail.python.org/mailman/listinfo/python-list


Re: Post request and encoding

2020-11-02 Thread Chris Angelico
On Tue, Nov 3, 2020 at 4:22 AM Hernán De Angelis
 wrote:
>
> Just reply to myself and whoever might find this useful.
>
> encode() must be done within the request call:
>
> header = {'Content-type':'application/xml', 'charset':'UTF-8'}
> response = requests.post(server, data=request.encode('utf-8'),
> headers=header)
>
> not in a previous separate line as I did.
>
> Now it works. This wasn't an obvious way to proceed for me.
>

I'm not sure of all the context here, but most likely, what you're
seeing is that your data needs to be bytes and you had text. When you
call the encode method, you don't change the data itself - what
happens is that it returns an encoded form of the data. That's why
just calling request.encode() won't do anything - it creates the
encoded form but then does nothing with it.

Hopefully that helps a bit.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Post request and encoding

2020-11-02 Thread Karsten Hilbert
On Mon, Nov 02, 2020 at 06:21:15PM +0100, Hernán De Angelis wrote:

For the record:

> Just reply to myself and whoever might find this useful.
>
> encode() must be done within the request call:

Nope (but it can, as you showed).

> header = {'Content-type':'application/xml', 'charset':'UTF-8'}
> response = requests.post(server, data=request.encode('utf-8'),
> headers=header)
>
> not in a previous separate line as I did.

Your separate line was wrong as much as ayone can guess:

> > I have tried of course adding
> >
> > request.encode('utf-8')
> >
> > before sending the request but it has not lead to a different result.

You would have needed to do:

request = request.encode('utf-8')

because .encode() does not operate in-place.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Post request and encoding

2020-11-02 Thread Hernán De Angelis

I see, my mistake was (tacitly) assuming that encode() could work in place.

Now I see that it should work in a previous line as you wrote.

Thank you!

/H.

On 2020-11-02 18:32, Karsten Hilbert wrote:

On Mon, Nov 02, 2020 at 06:21:15PM +0100, Hernán De Angelis wrote:

For the record:


Just reply to myself and whoever might find this useful.

encode() must be done within the request call:

Nope (but it can, as you showed).


header = {'Content-type':'application/xml', 'charset':'UTF-8'}
response = requests.post(server, data=request.encode('utf-8'),
headers=header)

not in a previous separate line as I did.

Your separate line was wrong as much as ayone can guess:


I have tried of course adding

request.encode('utf-8')

before sending the request but it has not lead to a different result.

You would have needed to do:

request = request.encode('utf-8')

because .encode() does not operate in-place.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B

--
https://mail.python.org/mailman/listinfo/python-list


Re: Post request and encoding

2020-11-02 Thread Ethan Furman

On 11/2/20 9:32 AM, Karsten Hilbert wrote:


because .encode() does not operate in-place.


Yeah, none of the string operations do, and it's embarrassing how many times 
that still bites me.  :-/

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Post request and encoding

2020-11-02 Thread Karsten Hilbert
On Mon, Nov 02, 2020 at 06:43:20PM +0100, Hernán De Angelis wrote:

> I see, my mistake was (tacitly) assuming that encode() could work in place.
>
> Now I see that it should work in a previous line as you wrote.
>
> Thank you!

Sure, and excuse my perhaps slightly terse tone in that earlier mail ...

Karsten

--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find word by given characters

2020-11-02 Thread dn via Python-list

On 02/11/2020 23:29, Bischoop wrote:

On 2020-11-01, duncan smith  wrote:




But this generates the letters counts for each word. They only need to
be generated once (outside the for loop). And using count requires
iterating over the letters / words for each x in letters (rather than
once). For a large enough collection of words you'd notice the difference.



You're pretty much right, it doesn't go too fast.
I've done this years ago with Python2, had a bit free time now and
wanted to ReLearn Python from starting old projects I've done in past
but can't remember how I made it working lol.



If you have a working Py2 version, once print-statements were changed 
into functions, what errors were thrown-up?



Multiple loops written in Python are likely to be slower than same in 
compiled code - which was probably part of the motivation for @Terry's 
response. Plus, "re-use" - why write something ourselves if someone else 
has already done the work?



How about a change of tactics?

- str.find() or .index() will locate a character within the string 
(starting from character[0]/the left-hand side)

- if this fails, tears will fall...
- repeat, from the right
- if both results are the same character/position, it must be unique 
within the string

- repeat for each character in "Letters"

This process assumes that built-in functions are faster than exhaustive 
scans written in Python, and thus (presumably) also that the number of 
"Letters" is small in comparison with the lengths of words.



Once the algorithms are proven, a speed comparison might be an 
interesting exercise...


For extra credit: once you've solved both, and compared the alternatives 
on your machine; post the code (and test data), and ask various 
colleagues 'here' to repeat the speed/performance comparisons on other 
machines.


Will/should the results be identical?
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Post request and encoding

2020-11-02 Thread Variable Starlight
No worries ☺

Den mån 2 nov. 2020 19:05Karsten Hilbert  skrev:

> On Mon, Nov 02, 2020 at 06:43:20PM +0100, Hernán De Angelis wrote:
>
> > I see, my mistake was (tacitly) assuming that encode() could work in
> place.
> >
> > Now I see that it should work in a previous line as you wrote.
> >
> > Thank you!
>
> Sure, and excuse my perhaps slightly terse tone in that earlier mail ...
>
> Karsten
>
> --
> GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Post request and encoding

2020-11-02 Thread Variable Starlight
Thanks, I now learned the lesson. 👍

Den mån 2 nov. 2020 18:58Ethan Furman  skrev:

> On 11/2/20 9:32 AM, Karsten Hilbert wrote:
>
> > because .encode() does not operate in-place.
>
> Yeah, none of the string operations do, and it's embarrassing how many
> times that still bites me.  :-/
>
> --
> ~Ethan~
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Post request and encoding

2020-11-02 Thread Grant Edwards
On 2020-11-02, Ethan Furman  wrote:
> On 11/2/20 9:32 AM, Karsten Hilbert wrote:
>
>> because .encode() does not operate in-place.
>
> Yeah, none of the string operations do, and it's embarrassing how
> many times that still bites me.  :-/

I've been writing Python for a little over 20 years. In another 20
years, maybe I'll stop making that mistake. :)





-- 
https://mail.python.org/mailman/listinfo/python-list


Solaris 11 GUI framework

2020-11-02 Thread Jay Braun
Looking for a GUI framework supported on Solaris 11.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Solaris 11 GUI framework

2020-11-02 Thread Igor Korot
Hi,



On Mon, Nov 2, 2020, 3:57 PM Jay Braun  wrote:

> Looking for a GUI framework supported on Solaris 11.
>

Wxpython, pygtk, Java.

Take you poison.

Thank you.

-- 
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Solaris 11 GUI framework

2020-11-02 Thread Jay Braun
Thank you.  I should have mentioned that I am looking for a Python GUI 
framework.  I neglected to mention that since this is a Python group.  Sorry.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Solaris 11 GUI framework

2020-11-02 Thread Igor Korot
Hi,

On Mon, Nov 2, 2020, 5:02 PM Jay Braun  wrote:

> Thank you.  I should have mentioned that I am looking for a Python GUI
> framework.  I neglected to mention that since this is a Python group.
> Sorry.
>

Well, first 2 are python and base on gtk.

Thank you.

-- 
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find word by given characters

2020-11-02 Thread Bischoop
On 2020-11-02, dn  wrote:
>
>
> If you have a working Py2 version, once print-statements were changed 
> into functions, what errors were thrown-up?
>
>
That was almost 15 if no more years ago when I was learning then had a
long break beacause Life :-) Got married, working as Chef, now have some
more time, working part time so a got back to old hobby and learning
again, however I see now with age everything is going slower lol

> Multiple loops written in Python are likely to be slower than same in 
> compiled code - which was probably part of the motivation for @Terry's 
> response. Plus, "re-use" - why write something ourselves if someone else 
> has already done the work?
>

For educating purposes?
>
> How about a change of tactics?
>
> - str.find() or .index() will locate a character within the string 
> (starting from character[0]/the left-hand side)
> - if this fails, tears will fall...
> - repeat, from the right
> - if both results are the same character/position, it must be unique 
> within the string
> - repeat for each character in "Letters"
>
> This process assumes that built-in functions are faster than exhaustive 
> scans written in Python, and thus (presumably) also that the number of 
> "Letters" is small in comparison with the lengths of words.
>
ha, everything seems easy only if you know that.
Sorry mate, for you it's obvious for me: oh, OK.
>
> Once the algorithms are proven, a speed comparison might be an 
> interesting exercise...
>
> For extra credit: once you've solved both, and compared the alternatives 
> on your machine; post the code (and test data), and ask various 
> colleagues 'here' to repeat the speed/performance comparisons on other 
> machines.
>
> Will/should the results be identical?

I'll look into that tomorrow, your sugestions guys and hopefully I've
achieve these goals.

Thanks again

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to determine user's screensize?

2020-11-02 Thread songbird
Grant Edwards wrote:
> On 2020-11-01, songbird  wrote:
>
>> to keep a program simple i made it to open in the center.
>
> That's not simple: it actually takes _extra_ work to do that.

  this was the first python3 program i wrote, i certainly
do not know python3 or desktop application standards or
much of the other stuff i did, but the program does work
and i'm fine with it as what it is.

  by no means is any program the final statement on any
problem - they are all iterations.  some fail, some go
further.  mayhaps, i'll get further, i can't say at the
present, mainly because my time for programming is not 
that much during the spring/summer/fall.  i'm only taking
a look at this thread because it does touch on issues i'm
curious about and i'm gradually getting more time so 
perhaps there's a chance it will get some updates and 
changes this winter.

  someone commented to me that if that is my attitude then
perhaps nobody will play it.  that's ok, i didn't write it
for anything other a learning experience.  that experience
will perhaps continue...  i may also perhaps get run over
by a mad cow tomorrow and the future will then be left for 
someone else to determine.  :)


>> if i ever get back to it i'll have to figure out how to ask
>> the windowing system what it wants to do for placement
>
> I've never heard of doing that before. I've written lots of desktop
> GUI apps in the past 30 years, and I've never written one line of code
> dealing with the location of the top-level window. I just let the
> toolkit and window manager handle it.

  if there are answers to the following questions this
would go in my file for future efforts.

  1. i'm running Debian testing, lightdm and MATE desktop.

  2. i don't know anything about how those things provide
 information to an application.  pointers would be
 appreciated.

  3. the application is written in python3, using gtk3
 and pyglet.

  it is a very rotten first attempt, i admit that.  :)
but also, for what it is it does work.  note, it does not
work on Windows because i don't have a windows machine
for development and testing nor do i have the inclination
to do that right now (which is why that's not done yet).

  i've posted links to it here before but just so anyone
doesn't have to search for it i'll put the link here too:

  https://github.com/flowerbug/ngfp

  have fun, cheers, etc.  :)


  songbird
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find word by given characters

2020-11-02 Thread duncan smith
On 02/11/2020 19:09, dn wrote:
> On 02/11/2020 23:29, Bischoop wrote:
>> On 2020-11-01, duncan smith  wrote:

>>>
>>> But this generates the letters counts for each word. They only need to
>>> be generated once (outside the for loop). And using count requires
>>> iterating over the letters / words for each x in letters (rather than
>>> once). For a large enough collection of words you'd notice the
>>> difference.
>>>
>>
>> You're pretty much right, it doesn't go too fast.
>> I've done this years ago with Python2, had a bit free time now and
>> wanted to ReLearn Python from starting old projects I've done in past
>> but can't remember how I made it working lol.
> 
> 
> If you have a working Py2 version, once print-statements were changed
> into functions, what errors were thrown-up?
> 
> 
> Multiple loops written in Python are likely to be slower than same in
> compiled code - which was probably part of the motivation for @Terry's
> response. Plus, "re-use" - why write something ourselves if someone else
> has already done the work?
> 
> 
> How about a change of tactics?
> 
> - str.find() or .index() will locate a character within the string
> (starting from character[0]/the left-hand side)
> - if this fails, tears will fall...
> - repeat, from the right
> - if both results are the same character/position, it must be unique
> within the string
> - repeat for each character in "Letters"
> 

[snip]

But he appears to need the count in order to compare against the counts
in letters. I assume letters could be something like 'att', in which
case knowing a word contains more than one 't' doesn't cut it. He could
try iterating over the characters in each word once, checking that no
count from letters is exceeded, and that the number of remaining
characters gives some chance that the relevant counts from letters could
be achieved. In the worst case (e.g. a conforming word) this requires
iterating over all the characters in a word once. That's not to say it
would actually run quicker 'on average' than a solution using Counter.

Duncan
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find word by given characters

2020-11-02 Thread dn via Python-list

On 03/11/2020 12:10, Bischoop wrote:

On 2020-11-02, dn  wrote:

If you have a working Py2 version, once print-statements were changed
into functions, what errors were thrown-up?


That was almost 15 if no more years ago when I was learning then had a
long break beacause Life :-) Got married, working as Chef, now have some
more time, working part time so a got back to old hobby and learning
again, however I see now with age everything is going slower lol


Apologies, I hoped that you had the Py2 code to-hand.



Multiple loops written in Python are likely to be slower than same in
compiled code - which was probably part of the motivation for @Terry's
response. Plus, "re-use" - why write something ourselves if someone else
has already done the work?


For educating purposes?


We are/should all be learning!



How about a change of tactics?

- str.find() or .index() will locate a character within the string
(starting from character[0]/the left-hand side)
- if this fails, tears will fall...
- repeat, from the right
- if both results are the same character/position, it must be unique
within the string
- repeat for each character in "Letters"

This process assumes that built-in functions are faster than exhaustive
scans written in Python, and thus (presumably) also that the number of
"Letters" is small in comparison with the lengths of words.


ha, everything seems easy only if you know that.
Sorry mate, for you it's obvious for me: oh, OK.



You are correct: "any sufficiently advanced technology is 
indistinguishable from magic" [Arthur C Clarke].


I'd like to think that characterisation correct (it would be more 
believable if you cataloged my debonair demeanor and devastatingly-good 
looks -maybe!). However, the reality is that I had to stop and think 
about it. That said, my 'catalog' of Python tactics may/should be wider 
than yours (and yet is probably 'not much' when compared with certain 
others!)


No question: one must start with the basics, even whilst aspiring to 
'the lofty peaks'.


In a parallel response (to @Duncan's post) other approaches - which may 
be beyond your current reach, are discussed.


The 'learning opportunity/ies' (if not for you/me, for the many others 
following this discussion on-list) are (at least) three-fold:

- how to write loops and wrangle strings;
- how sometimes not writing code can be 'faster' (at dev.time and/or in 
prod) because someone else has already coded a solution (or something I 
can 'improve'); and
- there is often more than one way to look at the problem (do I search 
every letter of the candidate word, once for every letter in Letters, or 
vice-versa - or is there yet another way!)


My suggestion: continue with the nested loops approach until you've 
cracked it. Then, working at your own pace, and at your own interest, 
consider implementing the counter() idea. Can you make it work? Can you 
make it meet the spec? Then, take a look at a str.index() alternative. 
Then, look-around for some other approach. Finally (which seems to imply 
an 'end' - hah!), look back, and reflect on both the acquiring of so 
many new skills; and how some solutions are 'faster', some more 
'obvious', and some more "elegant". Hey, it all sounds like "learning" 
to me!




Once the algorithms are proven, a speed comparison might be an
interesting exercise...

For extra credit: once you've solved both, and compared the alternatives
on your machine; post the code (and test data), and ask various
colleagues 'here' to repeat the speed/performance comparisons on other
machines.

Will/should the results be identical?


I'll look into that tomorrow, your sugestions guys and hopefully I've
achieve these goals.


You cast yourself as 'the learner', but if you (whenever) contribute 
something along these lines, there will be many who learn from you...

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Find word by given characters

2020-11-02 Thread dn via Python-list

On 03/11/2020 13:13, duncan smith wrote:

On 02/11/2020 19:09, dn wrote:

On 02/11/2020 23:29, Bischoop wrote:

On 2020-11-01, duncan smith  wrote:

But this generates the letters counts for each word. They only need to
be generated once (outside the for loop). And using count requires
iterating over the letters / words for each x in letters (rather than
once). For a large enough collection of words you'd notice the
difference.



Multiple loops written in Python are likely to be slower than same in
compiled code - which was probably part of the motivation for @Terry's
response. Plus, "re-use" - why write something ourselves if someone else
has already done the work?

...


- str.find() or .index() will locate a character within the string...



But he appears to need the count in order to compare against the counts
in letters. I assume letters could be something like 'att', in which
case knowing a word contains more than one 't' doesn't cut it. He could
try iterating over the characters in each word once, checking that no
count from letters is exceeded, and that the number of remaining
characters gives some chance that the relevant counts from letters could
be achieved. In the worst case (e.g. a conforming word) this requires
iterating over all the characters in a word once. That's not to say it
would actually run quicker 'on average' than a solution using Counter.



The str.index() idea solves both (ie "all") examples given, but beyond 
that, no guarantees!



The (full) specs are not clear. There's certainly room for 
misunderstanding. I'd be happier if I could 'see' a full spec or 
recognise a practical application, because then we'd be better able to 
discuss facts. Meantime, we try to help with what we have been given...



The OP's sample code only realises "conforming word[s]" (good term 
BTW!). The snippet does not report any "count". Similarly, there's no 
facts to avoid ("I assume") an assumption about whether "Letters" may 
include duplication - indeed: whether duplication has meaning or should 
be regarded as user-error.



The point has been made that finding multiple instances of "Letters" 
disqualifies that word.  Does that (also) disqualify having repetition 
of a letter within Letters? (or not?)


What does "att" imply? That there must be one and only one "a" in the 
word, plus a "t", and only one *other* "t"? Can't see it in 'the specs' 
to be able to say "right" or "wrong"! (Nor is it my spec!)


Whereas the OP indicates (first example) that the two characters "a" and 
"t" must appear, there was no apparent, required, linkage (or 
separation) between them, eg "auto" doesn't include the two letters 
consecutively (one of my first (mistaken) thoughts when looking at the OP).


Accordingly, I (again, rightly or wrongly), assumed that the lack of 
linkage between characters in "Letters" reasonably suggested (if not, 
implied) that if "auto" matches "at", it would also match "ta". 
Similarly, and without further detail, I couldn't see good reason why 
Letters itself would contain repetition, eg "att". (or not!)



Aside: that idea might make for a good second-level challenge!
(complicating both the nested-loops and the str.index() ideas - but 
possibly not when using counter()...)



When counter() was suggested, it was necessary to 'count' the characters 
in both the candidate-word and "Letters". Isn't that 'requirement' 
necessary only to be able to perform the final comparison/validation 
step? (there is no equivalent in the .index() algorithm)


Whereas counter() was mentioned as a potential solution, it didn't seem 
to fit. So, I sought another...



Moving to the suggested speed-comparison (and lesson in drawing from 
Python's rich collection of resources) was originally aimed at putting a 
native-Python nested list string manipulation solution, alongside an 
embedded function alternative. (cf anything involving Counter)

- but hey, "the more the merrier..."!

Performing this sort of experiment, and making such an observation (for 
oneself) is a great motivator (should one be needed) to learn Python's 
built-in functions, what is available in the PSL, and locating other 
similar 'riches' offered within the Python 'eco-system'!

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Documenting the Python Community

2020-11-02 Thread Abdur-Rahmaan Janhangeer
Greetings list,

I have a project in mind to help document the
Python community. It involves among others keeping
a within reach info of user groups (name, location, contact)
and checking activity status.

Sending the mail to this list since i could not find a

community  workgroup. I know Mr
Chris is in the Wiki
team and that Mrs McKellar once toured Python usergroup
spaces for a PSF community-related initiative many years ago.
Besides those i don't know any specific person who might be
interested

This occurs after we organised  FlaskCon
. It was an ugly
experience
contacting user groups around the world. The wiki is outdated.
Many user groups are no longer active, some websites are down,
others have weird ways of communicating. This mail is basically
to gather interested folks together with the hope of hatching a
minimum viable plan d'action.

Being myself a usergroup organiser , we'd like to
find a way to
1. make user groups compliant to a minimum standard
2. put the appropriate mechanism in place so that the PSF can
easily have a watch over user groups and give them some
bumps from time to time
3. some kind of onboarding and advices for new user groups

In parallel I am also thinking of documenting user groups histories,
starting with those I have some sort of relationship with. The idea
behind is to reinforce the community touch.

The draft might seem a tedious task for the expected benefits but
with the right approach it will be smooth. Feel free to continue the
conversation!

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

github 
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list