Re: [Tutor] How to find optimisations for code

2018-10-20 Thread Peter Otten
Steven D'Aprano wrote: > We don't need to check that the individual letters are the same, because > checking the counts will suffice. If they are not the same, one string > will have (let's say) two A's while the other will have none, and the > counts will be different. Another great optimisation

[Tutor] When are "__init__.py" files needed and not needed in a project?

2018-10-20 Thread boB Stepp
Linux Mint 19 Cinnamon, Python 3.6.6 I would have sworn that I had read, either on this list or the main Python list, that in the most recent versions of Python 3 that "__init__.py" files were no longer needed in nested project file structures. But when I attempted to run tests for the first time

Re: [Tutor] How to find optimisations for code

2018-10-20 Thread Avi Gross
There are many ways to do some things. I present a fairly straightforward method for consideration. Synopsis. Use two dictionaries to keep track of how many times a letter can be found in the source word and the target word. Loop over the target letters and as soon as you find a letter tha

Re: [Tutor] When are "__init__.py" files needed and not needed in a project?

2018-10-20 Thread Peter Otten
boB Stepp wrote: > Linux Mint 19 Cinnamon, Python 3.6.6 > > I would have sworn that I had read, either on this list or the main > Python list, that in the most recent versions of Python 3 that > "__init__.py" files were no longer needed in nested project file > structures. If you omit the __in

Re: [Tutor] When are "__init__.py" files needed and not needed in a project?

2018-10-20 Thread boB Stepp
On Sat, Oct 20, 2018 at 1:36 PM Peter Otten <__pete...@web.de> wrote: > > boB Stepp wrote: > > > Linux Mint 19 Cinnamon, Python 3.6.6 [snip] > > I was expecting this error and will shortly correct it. So my > > question remains, when are "__init__.py" files needed and when are > > they not? > > I

[Tutor] sftp in python without using pysftp or paramiko

2018-10-20 Thread Asad
hi All , I am looking to create a python script which logs in to the server and copies the fie from ftp to local system .: sftp a...@us.com 2100 password : xxx sftp> cd /to_dir sftp > get file1 sftp >exit Please advice . -- Asad Hasan +91 9582111698 __

Re: [Tutor] sftp in python without using pysftp or paramiko

2018-10-20 Thread Alan Gauld via Tutor
On 20/10/18 21:07, Asad wrote: > hi All , > > I am looking to create a python script which logs in to the server and > copies the fie from ftp to local system .: The obvious answer is use pysftp. But your subject says you don't want to do that. So the next option is for you to write your own ver

[Tutor] What is the best way for a program suite to know where it is installed?

2018-10-20 Thread boB Stepp
I was just re-reading the entire thread at https://www.mail-archive.com/tutor@python.org/msg77864.html And I have asked similar questions previous to that thread. I still do not have a satisfactory answer for the subject line's question that both makes sense to me and seems to be good programm

Re: [Tutor] When are "__init__.py" files needed and not needed in a project?

2018-10-20 Thread Alex Kleider
On 2018-10-20 14:52, boB Stepp wrote: > In case it helps, my current project structure is: > > ~/Projects > data/ > docs/ > tests/ > .git/ > main.py > .gitignore I'm curious to know where under the above structure you keep your code files? (...or is all your code wit

Re: [Tutor] When are "__init__.py" files needed and not needed in a project?

2018-10-20 Thread boB Stepp
On Sat, Oct 20, 2018 at 11:21 PM Alex Kleider wrote: > > On 2018-10-20 14:52, boB Stepp wrote: > > > >> > In case it helps, my current project structure is: > >> > > >> > ~/Projects/solitaire_scorekeeper/# I left off the actual project > >> > folder in my original email > >> > data/ > >>

[Tutor] Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?

2018-10-20 Thread boB Stepp
Use case: I want to allow a user of my Solitaire Scorekeeper program to be able to give any name he wants to each game of solitaire he wishes to record. My thought for permanent storage of each game's parameters is to use a dictionary to map the user-chosen game names to a unique json filename.