Working with graphs - Kevin Bacon game

2019-01-09 Thread jskako
I am working on Kevin Bacon game.

I have "movies.txt" text file that looks like:

Apollo 13 (1995);Bill Paxton;Tom Hanks;Kevin Bacon
Begyndte ombord, Det (1937);Aage Schmidt;Valso Holm
Bersaglio mobile (1967);Dana Young;Bebe Drake
Bezottsovshchina (1976);Yelena Maksimova;Lev Prygunov
Dark, The (1979);Angelo Rossitto;William Devane
etc,...

So in first row we have movie name, and in other rows we have actors for that 
movie.

I am trying to make Kevin Bacon game with breath-first search.

My source code (Python 3.X):



class cvor:
__slots__ = ('ime','susjed')


def kreiranjeCvora(ime):
n = cvor()
n.ime = ime
n.susjed = []
return n

def pronadiCvor(cvorlist, ime):
for n in cvorlist:
if n.ime == ime:
return n


def ucitajGraf(file):  
graph = []
for line in file:
imeGlumaca = []
mojaLinija = line.split(";")
imeFilma = mojaLinija[0]
for i in range (1,len(mojaLinija)):
imeGlumaca.insert(len(imeGlumaca), mojaLinija[i])   

cvorFilm = pronadiCvor(graph, imeFilma)
if cvorFilm == None:
cvorFilm = kreiranjeCvora(imeFilma)
graph.append(cvorFilm)
for glumac in imeGlumaca:
glumacCvor = pronadiCvor(graph,glumac)
if glumacCvor == None:
glumacCvor = kreiranjeCvora(glumac)
graph.append(glumacCvor)
glumacCvor.susjed.append(cvorFilm)
cvorFilm.susjed.append(glumacCvor)
return graph


def main():
f = open("movies.txt")
graf = ucitajGraf(f)
print (graf)

main()


My problem is that when I print graph with "print (graph)" I am getting:

"[<__main__.cvor object at 0x01475275EBE0>, <__main__.cvor object at 
0x01475275EEF0>, <__main__.cvor object at 0x01475275EFD0>, 
<__main__.cvor object at 0x01475275EE80>, <__main__.cvor object at 
0x01475275EB70>, <__main__.cvor object at 0x01475275ED68>,..."

And I know why but I don't know how to fix it and get "name" there.

What would be the best way to perform breath-first search between two entered 
names?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Working with graphs - Kevin Bacon game

2019-01-09 Thread Chris Angelico
On Wed, Jan 9, 2019 at 8:56 PM  wrote:
> class cvor:
> __slots__ = ('ime','susjed')
>
> My problem is that when I print graph with "print (graph)" I am getting:
>
> "[<__main__.cvor object at 0x01475275EBE0>, <__main__.cvor object at 
> 0x01475275EEF0>, <__main__.cvor object at 0x01475275EFD0>, 
> <__main__.cvor object at 0x01475275EE80>, <__main__.cvor object at 
> 0x01475275EB70>, <__main__.cvor object at 0x01475275ED68>,..."
>

When you print out a collection of arbitrary objects, Python shows you
the *repr* ("representation") of each one. The default repr for a
custom class just shows the class name and the object's unique ID,
which isn't terribly useful. Create your own custom representation by
adding a method to your cvor class:

def __repr__(self):
return "some nice descriptive string"

It's up to you to decide how to build that string, but that's what
will be shown.

Incidentally, you may want to consider the namedtuple type; it might
be more what you want.

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


Re: Working with graphs - Kevin Bacon game

2019-01-09 Thread MRAB

On 2019-01-09 09:53, [email protected] wrote:

I am working on Kevin Bacon game.

I have "movies.txt" text file that looks like:

Apollo 13 (1995);Bill Paxton;Tom Hanks;Kevin Bacon
Begyndte ombord, Det (1937);Aage Schmidt;Valso Holm
Bersaglio mobile (1967);Dana Young;Bebe Drake
Bezottsovshchina (1976);Yelena Maksimova;Lev Prygunov
Dark, The (1979);Angelo Rossitto;William Devane
etc,...

So in first row we have movie name, and in other rows we have actors for that 
movie.

I am trying to make Kevin Bacon game with breath-first search.

My source code (Python 3.X):



class cvor:
 __slots__ = ('ime','susjed')
 
 
def kreiranjeCvora(ime):

 n = cvor()
 n.ime = ime
 n.susjed = []
 return n

def pronadiCvor(cvorlist, ime):
 for n in cvorlist:
 if n.ime == ime:
 return n
 
It would be better if a function that returns a value _always_ 
explicitly returns a value:


 return None

 
def ucitajGraf(file):

 graph = []
 for line in file:


These lines:


 imeGlumaca = []
 mojaLinija = line.split(";")
 imeFilma = mojaLinija[0]
 for i in range (1,len(mojaLinija)):
 imeGlumaca.insert(len(imeGlumaca), mojaLinija[i])


do the same as:

 mojaLinija = line.split(";")
 imeFilma = mojaLinija[0]
 imeGlumaca = mojaLinija[1 : ]


 cvorFilm = pronadiCvor(graph, imeFilma)
 if cvorFilm == None:
 cvorFilm = kreiranjeCvora(imeFilma)
 graph.append(cvorFilm)
 for glumac in imeGlumaca:
 glumacCvor = pronadiCvor(graph,glumac)
 if glumacCvor == None:
 glumacCvor = kreiranjeCvora(glumac)
 graph.append(glumacCvor)
 glumacCvor.susjed.append(cvorFilm)
 cvorFilm.susjed.append(glumacCvor)
 return graph


def main():



 f = open("movies.txt")
 graf = ucitajGraf(f)


It's recommended to use 'with':

 with open("movies.txt") as f:
 graf = ucitajGraf(f)

because it'll close the file immediately.


 print (graf)
 
main()



My problem is that when I print graph with "print (graph)" I am getting:

"[<__main__.cvor object at 0x01475275EBE0>, <__main__.cvor object at 0x01475275EEF0>, 
<__main__.cvor object at 0x01475275EFD0>, <__main__.cvor object at 0x01475275EE80>, <__main__.cvor 
object at 0x01475275EB70>, <__main__.cvor object at 0x01475275ED68>,..."

And I know why but I don't know how to fix it and get "name" there.

What would be the best way to perform breath-first search between two entered 
names?


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


Re: Working with graphs - Kevin Bacon game

2019-01-09 Thread Josip Skako
Thank You for your answer, I fixed everything as You said.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Working with graphs - Kevin Bacon game

2019-01-09 Thread Josip Skako
Thank You for Your answer,

I am not sure what to try anymore, I guess I have to return "ime" from 
__slots__ at cvor() class to show proper strings and I am not able to do it.

Now I am not sure that I am going at right direction to do Kevin Bacon game and 
will I be able to load this data into graph and find shortest way?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Working with graphs - Kevin Bacon game

2019-01-09 Thread MRAB

On 2019-01-09 12:46, Josip Skako wrote:

Thank You for Your answer,

I am not sure what to try anymore, I guess I have to return "ime" from 
__slots__ at cvor() class to show proper strings and I am not able to do it.


With:

class cvor:
__slots__ = ('ime','susjed')

def __repr__(self):
return self.ime

if you say:

print(kreiranjeCvora('Kevin Bacon'))

you get:

Kevin Bacon


However, that might not be desirable because it means that:

print([kreiranjeCvora('Kevin Bacon')])

gives you:

[Kevin Bacon]

so it might be better with:

class cvor:
__slots__ = ('ime','susjed')

def __repr__(self):
return ascii(self.ime)

so that you get:

['Kevin Bacon']


Now I am not sure that I am going at right direction to do Kevin Bacon game and 
will I be able to load this data into graph and find shortest way?


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


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread dude . jimbo
On Wednesday, January 9, 2019 at 6:06:35 AM UTC+1, Matthew Lemon wrote:
> Hi,
> 
> I would start from scratch with this.
> 
> 1. You have latest Python 2 version.
> 2. Use virtualenv to create and activate a new virtual environment.
> 3. pip install wxPython and other dependencies.
> 4. Get your application running from the command line first and follow up any 
> DLL exceptions.
> 5. Use pyinstaller (https://pyinstaller.readthedocs.io/en/stable/) to create 
> a new exe file once you know everything works. 
> 
> Matt
> 
> On 8 January 2019 10:38:16 GMT, I wrote:
> >Hello,
> >
> >first time using python groups (and long time since using any other
> >group for that matter). This might not be the right group due to wx
> >being involved.
> >
> >Long story as short as possible. I have an old python script that I did
> >~10 years ago, and have forgotten basically everything about Python
> >since then (sorry!). Converted it to EXE way back when, and have kept
> >using the EXE ever since then (on XP, and on Win7).
> >
> >I've just gotten a new PC, Windows10 (!), needed to update the script,
> >so needed to recompile the EXE, and now it no longer compiles/works. It
> >was fine on Windows7 (I'm not specifically stating that the problem is
> >with windows10 - I simply don't remember all the hoops I jumped through
> >on my previous machine).
> >
> >Here is the compile error:
> >The following modules appear to be missing
> >['_sysconfigdata']
> >
> >And here is the runtime error:
> >Traceback (most recent call last):
> >  File "AutoArchive.py", line 3, in 
> >  File "wx\__init__.pyc", line 45, in 
> >  File "wx\_core.pyc", line 4, in 
> >  File "wx\_core_.pyc", line 12, in 
> >  File "wx\_core_.pyc", line 10, in __load
> >ImportError: DLL load failed: %1 is not a valid Win32 application.
> >
> >Here is how I compile: python setup.py py2exe
> >
> >And this is my setup.py:
> >from distutils.core import setup
> >import py2exe
> >
> >setup(console=['AutoArchive.py'])
> >
> >Yes, that says 'console' for a Windows EXE, but swapping it to 'window'
> >didn't help. Besides which, the setup.py file is straight from the old
> >computer, so 'it used to work'.
> >
> >What I have installed:
> >. python 2.7.13 (this in itself may be a problem - I don't even
> >remember which version I was using earlier, other than knowing for sure
> >it wasn't a 3.x release)
> >. wxpython  (since I also got an error that wx module was missing -
> >that rang some bells, since the script uses a Windows pop-up window to
> >inform me about its progress, and I remember using wx for that, so I
> >installed it, but don't know how to get its' version. using "python -c
> >"import wx;print wx.__version__" just gives runtime errors).
> >
> >Any help would be appreciated.
> >
> >And yes, I googled, but can't really find anything (well, d'Uh!, I
> >wouldn’t be here then would I?) - there's ~some~ references, but
> >usually it's about similar issues on Linux, with solutions that are not
> >applicable at all. Except one I thought: I found some link stating that
> >_sysconfigdata is part of sysconfig, and that this needed to be
> >installed with pip, so I used the pip that came with my python distro
> >and did 'pip install [[_]sys]config[data]' (all possible combo's) but
> >pip claims it can't find said module, and TBH, I can't seem to find
> >anything myself about said module.
> >
> >Thx,
> >Jimbo
> >-- 
> >https://mail.python.org/mailman/listinfo/python-list
> 
> -- 
> Sent from my Android device

Thx for your feedback. I am a tad afraid you're giving me a bit too much credit 
though; it's all a bit Chinese to me. (I'm not Chinese, BTW, but I'm not making 
up these expressions myself so there's that).

Step 2 you've lost me already. What is virtualenv, and why do I need it (this 
time round, not last time when I got it to work)? You don’t really need to 
respond, this is more of a rethorical question :).

Step 3 is I think the real issue. At first I was missing 'wx' and 
'_sysconfigdata', so I installed wxPhyton (via a windows installer that I 
found, not with pip), and that made the compile error go away (though it still 
throws runtime errors, of course). But what is '_sysconfigdata', and how do I 
install it? I - and pip :) - can't find a repo with that name!?

step 5, pyinstaller, is yet another hurdle I hope to avoid. It worked with 
py2exe, and it should still work with py2exe (within the efforts I'm prepared 
to put into this). Of course py2exe might be ancient and horrible and a bunch 
of other things that pyinstaller is not (I woulnd't know either way), but, to 
be honest, as well a tad cocky, I am not interested nor prepared to find out. 
Sorry about that, but hopefully one can understand. I'm not trying to 'get back 
into Python' , I just want something from the past back working again with 
minimal effort.

Trying to get it to work in console sounds like a (backup) plan though. I don't 
really need the 'progress' popup window, so I could keep the script

Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread Chris Angelico
On Thu, Jan 10, 2019 at 12:46 AM  wrote:
> step 5, pyinstaller, is yet another hurdle I hope to avoid. It worked with 
> py2exe, and it should still work with py2exe (within the efforts I'm prepared 
> to put into this). Of course py2exe might be ancient and horrible and a bunch 
> of other things that pyinstaller is not (I woulnd't know either way), but, to 
> be honest, as well a tad cocky, I am not interested nor prepared to find out. 
> Sorry about that, but hopefully one can understand. I'm not trying to 'get 
> back into Python' , I just want something from the past back working again 
> with minimal effort.
>

You want it to work with minimal effort? Then forget about py2exe and
just distribute your .py files. WAY easier.

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


Re: Working with graphs - Kevin Bacon game

2019-01-09 Thread Josip Skako
I get it now, basically you are accessing class atributes with 
"self.something", thank You.

So now I get this:

"['Apollo 13 (1995)', 'Bill Paxton', 'Tom Hanks', 'Kevin Bacon\n', 'Begyndte 
ombord, Det (1937)', 'Aage Schmidt', 'Valso Holm\n', 'Bersaglio mobile (1967)', 
'Dana Young', 'Bebe Drake\n', 'Bezottsovshchina (1976)', 'Yelena Maksimova', 
'Lev Prygunov\n', 'Dark, The (1979)', 'Angelo Rossitto', 'William Devane\n', 
'Death to Smoochy (2002)',..."

That is great.
What would be the best way now to find shortest path between ex. Tom Hanks and 
ex. William Devane?

I should get something like: https://oracleofbacon.org/

Should I insert this data into networkx somehow, would it be easier?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread Grant Edwards
On 2019-01-09, Chris Angelico  wrote:
> On Thu, Jan 10, 2019 at 12:46 AM  wrote:
>> step 5, pyinstaller, is yet another hurdle I hope to avoid. It worked with 
>> py2exe, and it should still work with py2exe (within the efforts I'm 
>> prepared to put into this). Of course py2exe might be ancient and horrible 
>> and a bunch of other things that pyinstaller is not (I woulnd't know either 
>> way), but, to be honest, as well a tad cocky, I am not interested nor 
>> prepared to find out. Sorry about that, but hopefully one can understand. 
>> I'm not trying to 'get back into Python' , I just want something from the 
>> past back working again with minimal effort.
>>
>
> You want it to work with minimal effort? Then forget about py2exe and
> just distribute your .py files. WAY easier.

It may be easier, but it may not be feasible.  That depends on what
dependencies are involved and whether your target audience is capable
of installing Python and those dependencies.  Distributing .py files
to my Windows customers is absolutely out of the question.  There's no
way I can expect them to install Python and whatever other
dependenceis are required by my applications.

That said, I've recently switched from py2exe to cx_freeze.  However,
even that isn't simple enough for my users, and I bundle the output
from those with Inno Setup.

-- 
Grant Edwards   grant.b.edwardsYow! I'll show you MY
  at   telex number if you show me
  gmail.comYOURS ...

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


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread songbird
Chris Angelico wrote:
...
> You want it to work with minimal effort? Then forget about py2exe and
> just distribute your .py files. WAY easier.

  which then forces the work onto every other
person who might install it, if they are on a
different architecture or system it even gets
worse if you add in that they may need to figure
out how to get a C compiler installed and 
available (if a bdist/wheel isn't available
because the developer couldn't figure out how
to generate one).

  for a novice user who just wants to get 
something done this isn't a very good solution.

  a build farm for common architectures would
help a lot of developers avoid all this thrashing.


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


Re: Working with graphs - Kevin Bacon game

2019-01-09 Thread MRAB

On 2019-01-09 14:09, Josip Skako wrote:

I get it now, basically you are accessing class atributes with 
"self.something", thank You.

So now I get this:

"['Apollo 13 (1995)', 'Bill Paxton', 'Tom Hanks', 'Kevin Bacon\n', 'Begyndte ombord, 
Det (1937)', 'Aage Schmidt', 'Valso Holm\n', 'Bersaglio mobile (1967)', 'Dana Young', 
'Bebe Drake\n', 'Bezottsovshchina (1976)', 'Yelena Maksimova', 'Lev Prygunov\n', 'Dark, 
The (1979)', 'Angelo Rossitto', 'William Devane\n', 'Death to Smoochy (2002)',..."

I notice that some of the strings end with '\n'. The best way to deal 
with that is to use .rstrip() on the line before splitting it.



That is great.
What would be the best way now to find shortest path between ex. Tom Hanks and 
ex. William Devane?

I should get something like: https://oracleofbacon.org/

Should I insert this data into networkx somehow, would it be easier?


No, I wouldn't bother.

You have 2 dicts:

person_dict: the key is a person and the value is a list of films 
that contained that person.


film_dict: the key is a film and the value is a list of persons in 
that film.


You're looking for a list of links. Let's call that a "chain".

You're working breadth-first, so you have a multiple chains, i.e. a list 
of lists.


Start with a person.

Initially you have a list that contains a list that in turn contains the 
starting person.


[[person]]

For each chain, look in person_dict for all of the films that the last 
person is in and duplicate the chain however many times you need, 
putting a film at the end of each.


[[person, film], [person, film], ...]

Then, for each chain, look in film_dict for all of the people who are in 
the last film and duplicate the chain however many times you need, 
putting a person at the end of each.


[[person, film, person], [person, film, person], ...]

Repeat until the last person in a chain is the target person (success!) 
or there are no chains remaining (no chain possible with the available 
information).


Also, remove cycles, e.g. ['Bill Paxton', 'Apollo 13', 'Tom Hanks', 
'Apollo 13', 'Bill Paxton'].

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


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread MRAB

On 2019-01-09 14:56, songbird wrote:

Chris Angelico wrote:
...

You want it to work with minimal effort? Then forget about py2exe and
just distribute your .py files. WAY easier.


   which then forces the work onto every other
person who might install it, if they are on a
different architecture or system it even gets
worse if you add in that they may need to figure
out how to get a C compiler installed and
available (if a bdist/wheel isn't available
because the developer couldn't figure out how
to generate one).

   for a novice user who just wants to get
something done this isn't a very good solution.

   a build farm for common architectures would
help a lot of developers avoid all this thrashing.

.py files work on any platform that supports Python: Windows, Linux, 
MacOs, ...


How many platforms support .exe files that were compiled for Windows?
--
https://mail.python.org/mailman/listinfo/python-list


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread Grant Edwards
On 2019-01-09, MRAB  wrote:

> .py files work on any platform that supports Python: Windows, Linux, 
> MacOs, ...

Only after python has been installed along with any other required
libraries.

> How many platforms support .exe files that were compiled for Windows?

None.

But when your requirement is to support Windows users who are not
capable of installing Python, WxWindows, and a half-dozen other
libraries, you can't simply hand out .py files, push your fingers into
your ears, close your eyes, and start yelling "your problem now, not
mine, na, na, na, na, na, "

-- 
Grant Edwards   grant.b.edwardsYow! YOU PICKED KARL
  at   MALDEN'S NOSE!!
  gmail.com

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


How to find files with a string

2019-01-09 Thread anton . gridushko
Hello everyone!

I need to find a file, that contains a string TeNum

I try to 

import os
import sys
def find_value(fname):
value = 0
with open(fname, encoding='cp866') as fn:
try:
for i in fn:
if 'TeNam' in i:
print(fname)
except IndexError:
pass
return {fname}
def main():
dirname = ('H:\\1\\3')
os.chdir(dirname)
res = {}
for i in os.listdir(dirname):
res.update(find_value(i))
print('Filename is: ')
if __name__ == "__main__":
main()

But there are mistakes like
C:\Users\Anton\AppData\Local\Programs\Python\Python36-32\python.exe 
"C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор файлов из 
папки.py"
Traceback (most recent call last):
  File "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор 
файлов из папки.py", line 21, in 
main()
  File "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор 
файлов из папки.py", line 18, in main
res.update(find_value(i))
ValueError: dictionary update sequence element #0 has length 35; 2 is required

Process finished with exit code 1

Could you help me to solve this thread?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to find files with a string

2019-01-09 Thread Peter Otten
[email protected] wrote:

> Hello everyone!
> 
> I need to find a file, that contains a string TeNum
> 
> I try to
> 
> import os
> import sys
> def find_value(fname):
> value = 0
> with open(fname, encoding='cp866') as fn:
> try:
> for i in fn:
> if 'TeNam' in i:
> print(fname)
> except IndexError:
> pass

What's the purpose of that try...except?

> return {fname}
> def main():
> dirname = ('H:\\1\\3')
> os.chdir(dirname)
> res = {}

For historical reasons {} is the literal for an empty dict; you probably 
want a set:

  res = set()

> for i in os.listdir(dirname):
> res.update(find_value(i))
> print('Filename is: ')
> if __name__ == "__main__":
> main()
> 
> But there are mistakes like
> C:\Users\Anton\AppData\Local\Programs\Python\Python36-32\python.exe
> "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор файлов
> из папки.py" Traceback (most recent call last):
>   File "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор
>   файлов из папки.py", line 21, in 
> main()
>   File "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор
>   файлов из папки.py", line 18, in main
> res.update(find_value(i))
> ValueError: dictionary update sequence element #0 has length 35; 2 is
> required

You get the error because the dict.update() methods expects pairs:

>>> d = {}
>>> d.update({(1, 2)})
>>> d
{1: 2}

A string of length 2 will be taken as a pair,

>>> d.update({"xy"})
>>> d
{1: 2, 'x': 'y'}

but a string of any other length will not:

>>> d.update({"xyz"})
Traceback (most recent call last):
  File "", line 1, in 
ValueError: dictionary update sequence element #0 has length 3; 2 is 
required

> 
> Process finished with exit code 1
> 
> Could you help me to solve this thread?


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


Re: How to find files with a string

2019-01-09 Thread Brian Oney via Python-list
On Wed, 2019-01-09 at 08:29 -0800, [email protected] wrote:
> Hello everyone!
> 
> I need to find a file, that contains a string TeNum
> 
> I try to 
> 
> import os
> import sys
> def find_value(fname):
> value = 0
> with open(fname, encoding='cp866') as fn:
> try:
> for i in fn:
> if 'TeNam' in i:
> print(fname)
> except IndexError:
> pass
> return {fname}
> def main():
> dirname = ('H:\\1\\3')
> os.chdir(dirname)
> res = {}
> for i in os.listdir(dirname):
> res.update(find_value(i))
> print('Filename is: ')
> if __name__ == "__main__":
> main()
> 
> But there are mistakes like
> C:\Users\Anton\AppData\Local\Programs\Python\Python36-32\python.exe 
> "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор файлов из 
> папки.py"
> Traceback (most recent call last):
>   File "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор 
> файлов из папки.py", line 21, in 
> main()
>   File "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор 
> файлов из папки.py", line 18, in main
> res.update(find_value(i))
> ValueError: dictionary update sequence element #0 has length 35; 2 is required
> 
> Process finished with exit code 1
> 
> Could you help me to solve this thread?

the error message is somewhat clear. You need to add a key-value pair to
a dictionary. You may consider changing 'res' to a 'list'. You then need
to 'append'. 

Either way, 'find_value' will return the filename regardless of whether
the value is present or not. That should get you started.


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


Email blast management?

2019-01-09 Thread Tobiah

I'm tasked with adding the ability for users of a website to
send bulk emails out to their customers.  Before I write it all
from scratch, are there any good tools that will allow me to provide:


* A place to compose their email, with images and links

* A way to manage their list of recipients

Perhaps most important:

* A way to verify emails, track (as much as possible) receipt
  of the email, and track bounce-backs, click-throughs, etc.

The solution could be anywhere from close to an entire solution, like
some free, light CRM package, down to recommendations on some good supporting
libraries that will help me with any of these tasks.


Thanks,


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


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread Chris Angelico
On Thu, Jan 10, 2019 at 2:37 AM Grant Edwards  wrote:
>
> On 2019-01-09, MRAB  wrote:
>
> > .py files work on any platform that supports Python: Windows, Linux,
> > MacOs, ...
>
> Only after python has been installed along with any other required
> libraries.
>
> > How many platforms support .exe files that were compiled for Windows?
>
> None.
>
> But when your requirement is to support Windows users who are not
> capable of installing Python, WxWindows, and a half-dozen other
> libraries, you can't simply hand out .py files, push your fingers into
> your ears, close your eyes, and start yelling "your problem now, not
> mine, na, na, na, na, na, "

This is true - but on the flip side, it's a bit unfair to say "blah
blah Python sucks because py2exe is hard". That's not Python's fault.
You have an additional requirement ("support people who can't install
Python"), and that's going to have extra hassles. LOTS of them, in
this case.

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


RE: Working with graphs - Kevin Bacon game - WOT

2019-01-09 Thread Avi Gross
[HUMOR ALERT]

Others have given answers that are on topic so mine is not needed. I was
amused by the understandable spelling error about doing the unusual variant
of a Breath First Search when it is clear they meant Breadth.

But it may apply in this case. The Keven Bacon Game is a variation on
calculating the Erdős number. It relates to finding people who were in a
film alongside Kevin Bacon and presumably were at some point in close enough
proximity to share some component of Breath. They are the closest degree you
can get to Kevin without being him. Anyone in a film with one of those
people but not directly in a film with Kevin is of a second degree and so
on. Still others get the third degree and I won't question that.

There are several problems with an approach based on breath. The first is
that movies are often made in which the participants work in different areas
and never meet. Simply being in the same film does not guarantee that level
of closeness. And, I have seen convincing arguments that suggest the
likelihood we have all shared the recycled breath of historical figures and
very possibly have incorporated atoms that once resided within their bodies
into our own. I will spare you the calculations except to say that in some
ways we are all one. We have all breathed air that includes minor amounts
once in not only a particular Pharaoh in Egypt but also from just about
anyone in his kingdom that lived a moderately long life -- no matter where
on earth we live.

A modern figure like Kevin Bacon gets around and certainly if you live in an
area like parts of California he lived in, you may be very close in a Breath
First search but without much Depth.

And, yes, pythons breathe the same air we do, as do python programmers, just
to bring this back to whatever it is we are supposed to waste our breath
"talking" about here.

-Original Message-
From: Python-list  On
Behalf Of [email protected]
Sent: Wednesday, January 9, 2019 4:54 AM
To: [email protected]
Subject: Working with graphs - Kevin Bacon game

I am working on Kevin Bacon game.

I have "movies.txt" text file that looks like:

Apollo 13 (1995);Bill Paxton;Tom Hanks;Kevin Bacon Begyndte ombord, Det
(1937);Aage Schmidt;Valso Holm Bersaglio mobile (1967);Dana Young;Bebe Drake
Bezottsovshchina (1976);Yelena Maksimova;Lev Prygunov Dark, The
(1979);Angelo Rossitto;William Devane etc,...

So in first row we have movie name, and in other rows we have actors for
that movie.

I am trying to make Kevin Bacon game with breath-first search.

My source code (Python 3.X):



class cvor:
__slots__ = ('ime','susjed')


def kreiranjeCvora(ime):
n = cvor()
n.ime = ime
n.susjed = []
return n

def pronadiCvor(cvorlist, ime):
for n in cvorlist:
if n.ime == ime:
return n


def ucitajGraf(file):  
graph = []
for line in file:
imeGlumaca = []
mojaLinija = line.split(";")
imeFilma = mojaLinija[0]
for i in range (1,len(mojaLinija)):
imeGlumaca.insert(len(imeGlumaca), mojaLinija[i])   

cvorFilm = pronadiCvor(graph, imeFilma)
if cvorFilm == None:
cvorFilm = kreiranjeCvora(imeFilma)
graph.append(cvorFilm)
for glumac in imeGlumaca:
glumacCvor = pronadiCvor(graph,glumac)
if glumacCvor == None:
glumacCvor = kreiranjeCvora(glumac)
graph.append(glumacCvor)
glumacCvor.susjed.append(cvorFilm)
cvorFilm.susjed.append(glumacCvor)
return graph


def main():
f = open("movies.txt")
graf = ucitajGraf(f)
print (graf)

main()


My problem is that when I print graph with "print (graph)" I am getting:

"[<__main__.cvor object at 0x01475275EBE0>, <__main__.cvor object at
0x01475275EEF0>, <__main__.cvor object at 0x01475275EFD0>,
<__main__.cvor object at 0x01475275EE80>, <__main__.cvor object at
0x01475275EB70>, <__main__.cvor object at 0x01475275ED68>,..."

And I know why but I don't know how to fix it and get "name" there.

What would be the best way to perform breath-first search between two
entered names?
--
https://mail.python.org/mailman/listinfo/python-list

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


Re: Email blast management?

2019-01-09 Thread Chris Angelico
On Thu, Jan 10, 2019 at 4:19 AM Tobiah  wrote:
>
> I'm tasked with adding the ability for users of a website to
> send bulk emails out to their customers.  Before I write it all
> from scratch, are there any good tools that will allow me to provide:
>
>
> * A place to compose their email, with images and links
>
> * A way to manage their list of recipients
>
> Perhaps most important:
>
> * A way to verify emails, track (as much as possible) receipt
>   of the email, and track bounce-backs, click-throughs, etc.
>
> The solution could be anywhere from close to an entire solution, like
> some free, light CRM package, down to recommendations on some good supporting
> libraries that will help me with any of these tasks.

TBH, I'd recommend using a service like MailChimp, avoiding the entire
Python question at all.

Though if you want to use Python specifically, Mailman (the mailing
list software) can be used for announcements. Wouldn't help you with
composing the email, but it covers a lot of the rest.

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


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread Matthew Lemon
If the OP was able to take the time to familiarise himself with the 
technologies, rather than bemoan the difficulty of deploying a ten year old 
code-base without mininal effort, he might have some success. Code rot is an 
issue after weeks sometimes, never mind ten years, and Python deployment is a 
weakness. However the tools do exist if you are prepared to give it a go. I've 
had most successful with pyinstaller, which is why I linked to it. Good luck!

On 9 January 2019 17:57:47 GMT, Chris Angelico  wrote:
>On Thu, Jan 10, 2019 at 2:37 AM Grant Edwards
> wrote:
>>
>> On 2019-01-09, MRAB  wrote:
>>
>> > .py files work on any platform that supports Python: Windows,
>Linux,
>> > MacOs, ...
>>
>> Only after python has been installed along with any other required
>> libraries.
>>
>> > How many platforms support .exe files that were compiled for
>Windows?
>>
>> None.
>>
>> But when your requirement is to support Windows users who are not
>> capable of installing Python, WxWindows, and a half-dozen other
>> libraries, you can't simply hand out .py files, push your fingers
>into
>> your ears, close your eyes, and start yelling "your problem now, not
>> mine, na, na, na, na, na, "
>
>This is true - but on the flip side, it's a bit unfair to say "blah
>blah Python sucks because py2exe is hard". That's not Python's fault.
>You have an additional requirement ("support people who can't install
>Python"), and that's going to have extra hassles. LOTS of them, in
>this case.
>
>ChrisA
>-- 
>https://mail.python.org/mailman/listinfo/python-list

-- 
Sent from my Android device
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: How to find files with a string

2019-01-09 Thread Avi Gross
Anton,

OVERVIEW: SET vs DICT

Some of us have less experience decoding Cyrillic error messages. The part we 
can read suggests the program objected to the way a dictionary was being 
updated. 

ValueError: dictionary update sequence element #0 has length 35; 2 is required

(The Russian said something like: Working with the file system / Searching 
files from the .py folder)

The normal method is to provide something that evaluates to a key/value 
combination. You made an empty dictionary with {} NOT an empty set which is 
only created using the notation set().

Your find_value() function returns a SET containg the filename unconditionally 
this way:
return {fname}

That is not a dictionary entry. It is a set and this is not something you can 
add to a dictionary as it has no key.

Why the 35 above? I would guess it may be seen as a list of 35 charcaters or 
something.

Two more points. Your text says searching for TeNum but the function searches 
for TeNam.

Worse, the function seems to be wrong for the purpose intended. If the goal is 
to search line by line and if found any number of times, return the filename, 
it does not do that. It seems to print the filename when any line matches. No 
idea why you do some other things but the return is unconditional so it should 
return every filename it finds.

-Original Message-
From: Python-list  On 
Behalf Of [email protected]
Sent: Wednesday, January 9, 2019 11:30 AM
To: [email protected]
Subject: How to find files with a string

Hello everyone!

I need to find a file, that contains a string TeNum

I try to 

import os
import sys
def find_value(fname):
value = 0
with open(fname, encoding='cp866') as fn:
try:
for i in fn:
if 'TeNam' in i:
print(fname)
except IndexError:
pass
return {fname}
def main():
dirname = ('H:\\1\\3')
os.chdir(dirname)
res = {}
for i in os.listdir(dirname):
res.update(find_value(i))
print('Filename is: ')
if __name__ == "__main__":
main()

But there are mistakes like
C:\Users\Anton\AppData\Local\Programs\Python\Python36-32\python.exe 
"C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор файлов из 
папки.py"
Traceback (most recent call last):
  File "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор 
файлов из папки.py", line 21, in 
main()
  File "C:/Users/Anton/PycharmProjects/Работа с файловой системой/Перебор 
файлов из папки.py", line 18, in main
res.update(find_value(i))
ValueError: dictionary update sequence element #0 has length 35; 2 is required

Process finished with exit code 1

Could you help me to solve this thread?
-- 
https://mail.python.org/mailman/listinfo/python-list

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


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread Grant Edwards
On 2019-01-09, Chris Angelico  wrote:
> On Thu, Jan 10, 2019 at 2:37 AM Grant Edwards  
> wrote:
>
>> > How many platforms support .exe files that were compiled for Windows?
>>
>> None.
>>
>> But when your requirement is to support Windows users who are not
>> capable of installing Python, WxWindows, and a half-dozen other
>> libraries, you can't simply hand out .py files, push your fingers into
>> your ears, close your eyes, and start yelling "your problem now, not
>> mine, na, na, na, na, na, "
>
> This is true - but on the flip side, it's a bit unfair to say "blah
> blah Python sucks because py2exe is hard". That's not Python's fault.

Of course not.

> You have an additional requirement ("support people who can't install
> Python"), and that's going to have extra hassles. LOTS of them, in
> this case.

Supporting distribution of any "real-world" application in any
language on Microsoft Windows involves most of the same problems.

It's slightly easier for some languages than it is for others.

Just handing out .exe files built with nothing but the global default
C run-time library is possible -- but, when was the last time you saw
an application distributed like that?

-- 
Grant Edwards   grant.b.edwardsYow! People humiliating
  at   a salami!
  gmail.com

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


Re: How to find files with a string

2019-01-09 Thread Terry Reedy

On 1/9/2019 11:29 AM, [email protected] wrote:


I need to find a file, that contains a string TeNum


IDLE's 'Find in Files' is a mid-level grep with GUI interface.  The code 
is in idlelib/grep.py if you want to copy code.



--
Terry Jan Reedy

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


curses textpad.py UTF-8 support

2019-01-09 Thread elig0n
is non existent. Unicode input text won't show up.

It probably needs to be rewritten with get_wch() as was suggested in the 
following SO question before get_wch() was implemented, together with proper 
key code parsing (in do_command()) and probably more as to prevent breakage
[ 
https://stackoverflow.com/questions/42510606/python-curses-textpad-textbox-keyboard-input-not-working-with-german-umlauts
 ]. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread songbird
Chris Angelico wrote:
...
> This is true - but on the flip side, it's a bit unfair to say "blah
> blah Python sucks because py2exe is hard". That's not Python's fault.
> You have an additional requirement ("support people who can't install
> Python"), and that's going to have extra hassles. LOTS of them, in
> this case.

  i'm not as much worried about the python 3 install
as much as the C compiler that the graphics libs seem
to want to use during install from source.  that is
likely not as easy to do.  as i don't even have a
Windows machine here at all i can only read up on it
as much as i can and try to take some notes with me
of things to check and try out and hope that is 
enough.  i should be ok, but i'm not a Windows
expert by far.  so ...  :)


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


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread songbird
MRAB wrote:
> On 2019-01-09 14:56, songbird wrote:
>> Chris Angelico wrote:
>> ...
>>> You want it to work with minimal effort? Then forget about py2exe and
>>> just distribute your .py files. WAY easier.
>> 
>>which then forces the work onto every other
>> person who might install it, if they are on a
>> different architecture or system it even gets
>> worse if you add in that they may need to figure
>> out how to get a C compiler installed and
>> available (if a bdist/wheel isn't available
>> because the developer couldn't figure out how
>> to generate one).
>> 
>>for a novice user who just wants to get
>> something done this isn't a very good solution.
>> 
>>a build farm for common architectures would
>> help a lot of developers avoid all this thrashing.
>> 
> .py files work on any platform that supports Python: Windows, Linux, 
> MacOs, ...

  .py isn't the point as somehow the modules i am 
using compile C code during the install.  i'd be 
happier if they didn't, but i don't have a way to
easily generate those files myself that i know of.


> How many platforms support .exe files that were compiled for Windows?

  depends upon the versions...

  i have some pretty ancient Windows/DOS programs
that work fine under dosbox in my Debian Linux testing
setup.  i haven't checked them out lately though to
see if they're still runnable (good chance they're
ok).  been busy with other things and besides i 
finally moved the ancient spreadsheets from Multiplan 
to Libreoffice.


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


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread songbird
Grant Edwards wrote:
...
> That said, I've recently switched from py2exe to cx_freeze.  However,
> even that isn't simple enough for my users, and I bundle the output
> from those with Inno Setup.

  i looked at the one and stopped at that because
alas, i have no Windows or MacOS machines to
generate any binaries, though i would guess that
the MacOS may have an easier path to getting
a C compiler installed (but i don't know, my MacOS
person hasn't said anything yet).

  in looking at the Python install for Windows it
looks like i will probably want to do it to make
sure that the paths are set up correctly.  the C
compiler, don't know how easy that might be until 
i do it, which i hate when sitting in someone 
else's house with them hovering.  considering i 
haven't touched Windows since XP and really am 
not an expert these days it should be entertaining.

  my code is all python 3 so that at least should
simplify some things.


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


Re: The following modules appear to be missing ['_sysconfigdata']

2019-01-09 Thread songbird
Matthew Lemon wrote:
> If the OP was able to take the time to familiarise himself with the 
> technologies, rather than bemoan the difficulty of deploying a ten year old 
> code-base without mininal effort, he might have some success. Code rot is an 
> issue after weeks sometimes, never mind ten years, and Python deployment is a 
> weakness. However the tools do exist if you are prepared to give it a go. 
> I've had most successful with pyinstaller, which is why I linked to it. Good 
> luck!

  i looked at it, will require further reading/testing.

  i see part of my list of modules are supported but 
not sure all are without a test.  will have to look into 
it further.  tks.  :)


  songbird  (not the OP, but in a similar and perhaps
 more complicated boat...
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: How to find files with a string ++

2019-01-09 Thread Avi Gross
[This message comments on three different items being discussed and also on
how to find out what kind of help is actually requested and warranted.]

People don't usually provide enough context in their requests and I see
wildly different attempts to help. When some code is supplied along with
perhaps an error message, some people try to see what may be wrong and
assume they want to use a slightly improved version of the code to solve
whatever their goal is. Others point to where some other code does it
perhaps a very different way such as the code in IDLE. Some tell you to go
elsewhere and use a finished product as below. So, sure, you can just go and
use grep. And some focus on things like efficiency or portability or how
pythonic its is, whatever that means to THEM.

What is missing at times is the question of what do you want to do next or
even before. That may help guide what is wanted.

It is not easy to guess especially since Anton may not be using the data
structures he might if he was more experienced in python. He seems to be
wanting to use a set which may not seem very focused if the file names are
all unique already. Some might use something simpler and ordered like a
list. If his purpose is to do something like show which files do NOT match,
sure he could make a set of all files and subtract this set but that is not
needed as it is quite simple to record just files that don't match in the
first place.

I am left with a few other anomalies that make me think it would be better
to stop and ask what they want in clearer terms because their overall
approach does not lead me to something obvious.

When people post here, there is no way to enforce their telling us their
general goals. It can be anything from a student trying to solve a problem
using very basic methods they are supposed to have covered in class to
someone just trying to get a task done just once and not caring much what
tools is used and hoping someone on this forum has a quick answer.

If someone says they want to code each one of dozens of algorithms they read
about from SCRATCH, that means they are willing to reinvent the wheel. They
may literally not want any comment on any aspect of their code except asking
how to fix the one error they got. In this case, I am not clear if the
answer is to initialize a set rather than a dictionary, or to use a list in
the first place, or if using a dictionary, supply a key. Perhaps they do not
(yet) want to hear their entire function always returns the filename or
maybe it should return an item instead of a set containing an item or ...

I am reading a book about Clean Code and I note that sometimes here we
ignore fairly simple things and fall for a more gimmicky, if brilliant,
attempt to make something non-obvious. The example was one that comes up
regularly, how to see if two items are equal. In this case, the question was
how to tell if a list of N items contained N identical items. A fairly
straightforward answer would be to loop starting with a second item and keep
comparing the current item to the withheld first. Optionally, quit as soon
as a discrepancy was found. It would depend on using a binary "==" on two
items at a time. Others offered more inline solutions that hide a loop, such
as "any" ad many such variations are possible. 

I am not saying they are all good solutions, and many are fairly horrible
such as trying to compare all permutations.. But one suggested solution was
beautiful and elegant (as in short) and boiled down to comparing the list to
its top-level reversal. It is true that anything with N identical copies
will be shown that way but only as a special case as it is a palindrome.
And, it begs the question of how python evaluates "list1 == list2" as that
may be just syntactic sugar for a method similar or different to the
straightforward ones.

I am surprised nobody suggested this one. First in English. Take the
original list. Assuming it is long enough, rotate it a notch so the former
first item is now at the end and the former second item is in front. Compare
the two versions of the list. A palindrome would be ruined by this simple
manipulation assuming you started with three or more. 

Before I present the trivial code, I want to remind everyone this is NOT a
suggested method. I do NOT want to get lectured at as if I suggested it. It
is what I call an academic exercise. It is a minor variant designed to foil
the darn palindrome case. For argument's sake, a list with no items or a
single item would be solved without calling the function below. Something
with two can harmlessly passed to the function but does not need to be. Only
three and above need apply. I have no doubt there are better ways but this
method would allow something small and nice like:

a == sh(a)

Anyway, here is the code followed by the output just for ILLUSTRATION. If
you can show test cases where it fails, feel free. 

def shift_eq(listing):
"""Compare a list to a rotated version."""

RE: dangerous class neighborhood

2019-01-09 Thread Avi Gross
This message is a delayed reply to what Chris wrote late last year and I 
initially chose not to reply to. My fault, as I was having a few bad days and 
did not see the content as constructive. But as things are fine now and I have 
seen more of what Chris posts, I will reply, but not in-line as I want to make 
a few focused replies. And I note Chris has a sense of humor that oddly may 
align with mine so I regret the misunderstanding. No unending back and forth 
messages are needed. I think we may understand each other. Those not 
interested, feel free to escape.

FOREPLAY: Like some of my posts, I wrote a fairly long message asking questions 
about choices people might want to make and offering perhaps uncommon 
solutions. I have no actual current interest in the specific problem for any 
actual programming I am doing. Just a discussion.

As such, some of my questions in the original message should NOT have a 
definite answer as much as a range of opinions depending on the circumstance. 
The overall scenario, to remind some readers,  was some unusual behavior when 
someone was doing calculations within the body of a class definition that 
involved evaluating  constants into an assortment of class variables with some 
massaging.

I asked this:

> Question 2: Do you want the variables available at the class level or  at the 
> instance level?

That again is a question to which I deny there is a specific answer. I was 
asking if the USER at that moment preferred or needed one or the other. I mean 
python allows you to do it quite a few ways. If you want a counter of how many 
objects have been instantiated that are descended from that class, for 
instance, then the counter makes perfect sense as being a variable stored  in 
the single shared object representing the class. Constants also probably do not 
need to be defined and created in every single instance of a class. But there 
may be times you do want it there such as if you want to modify them or perhaps 
use them up with each instance starting with the same ones.

CHRIS: For constants, definitely put them on the class. They'll be available on 
instances as well ("for free", if you like). For mutables, obviously you need 
to decide on a case-by-case basis.

In that light, Chris answered well enough except I think I reacted to the word 
"definitely" as a suggestion that the question of what the user might want as 
being silly. A closer look now indicates that the second part allows different 
choices for something like mutables. So I have no disagreement. As always, I 
can think of other reasons why the lunch is not free as it takes extra work to 
search for variables higher up in the class chain and it gets ridiculous with 
multiple inheritance.

My next question was focused on how to work within the rules to avoid this 
anomaly. If you need a reminder, it had something to do with the scope within a 
class definition and whether it was visible to functions deeper within the 
scope visually but not by the rules python currently  has.

> Question 3: Which python variations on syntactic sugar, such as list 
> comprehensions, get expanded invisibly in ways that make the problem 
> happen by asking for variables to be found when no longer in the visible 
> range?

CHRIS: The oddities with comprehensions were tackled partly during the 
discussion of PEP 572. If you want to know exactly why this isn't changing, go 
read a few hundred emails on the subject. A lot of the main points are 
summarized in the PEP itself:

Now on the one hand, the reply was full of PEP but did not directly seem to 
address my point, at first. My first take was GO READ IT. HUNDREDS of emails? 
Reasonable but I had too much else to work on so a bit frustrating. What I had 
hoped for was a list of specific python varieties of code such as a list 
comprehension and so on. In later discussions with Chris I realize he was 
probably frustrated as he saw the ultimate cause of the original problem as 
rather artificial and not quite due to the scope rules "effect" I seemed to be 
asking about. In particular, I was looking (elsewhere in the post) for ways to 
find a more hospitable and reliable place where you could use ANY python 
functionality you wished and get a valid result and simply EXPORT the results 
to whatever place (class, instance, or something external) to be used when 
needed. Chris may have wondered what problem I was solving as there wasn't one.

I won't copy all the rest, as it can be seen below, I presented some ways this 
could be done. One was to do it in an initializer and save the results in the 
instance, or if needed overwrite it in the class) or do it all in a single 
function (all local scope) and return multiple outputs that can be instantiated 
in the class. The comments Chris made were not focused in the direction I was 
trying to do as he did not necessarily see it as a problem to solve. Fair 
enough. I may be a bit poisoned in that my reading has shown that dee