RE: New Python implementation

2021-02-18 Thread Elliott Roper


Avi and Dennis--

Two thoughtful replies to a deep and interesting question. You have prodded me
to poke my head over the wall to offer a real world point of view.

In the early days before Modula II, I was contracting to a company, quite
large and respected, that had just chucked out Ratfor and adopted Pascal as
their main development tool on VAX-VMS. With long hindsight it was a not
insignificant factor in their going bust.

I was happily developing some of the best code I have ever written using Macro
on a J-11 PDP 11/73, so I was an innocent bystander, with my own OS, with
'borrowed' XDT and CRC table look-up software, courtesy of Dave Cutler and Stu
Wecker respectively. It was a front end for the main project, supporting 1024
terminals feeding 200 transactions a second into the VAX over raw ethernet on
a DEQNA. So I sure learned how to do linked lists, and do them quickly.

The main team was sharing a VAX-750. Watching them trying to use a teaching
language to do real world work was not a joy to behold.

You have both hit on a real-world problem. Script Kiddies and Stack Exchange


A comp sci course must use a real-world language to send confident
practitioners into the real world.

Python is an excellent choice in that regard.

Dennis' point about it being too good is valid. If it were my course (and
there is no chance of that) I'd do an extra credit module where they have to
mine and critique the cPython source etc. for lists and comprehensions and
itertools and all their uncles and aunts. After all c is the nearest they will
get to the metal.

I know this has to work. Two or three of the guys on that project were John
Lion's co-authors of the Red Book on Unix internals. They were awesome! (I
told you this was very long hindsight didn't I?)

On 18 Feb 2021 at 17:26:11 GMT, ""Avi Gross""  wrote:

> Dennis made the interesting comment "... Python has too much built in ..."
> 
> I understand his point. At the same time, I wonder what most people using
> computers today, or in the future, need. Given serious amounts of computer
> power, what many people may want is higher-level ways to get things done
> without worrying how they are done. Python, like many such languages, has a
> very basic core that is augmented by what could be libraries, packages,
> modules and so on but have been chosen to be built-in to one distribution or
> another.
> 
> Some people and organizations use some things so commonly, they want python
> to start up automatically loading say numpy and pandas and other such
> things. They may not care if the programmer knows how to make a linked list
> or binary tree data structure. Many such details are encapsulated within
> objects built and tested already. 
> 
> I have seen subjects taught at various levels and python might qualify too.
> I took a Physics course that required Calculus and used it to derive
> formulas and other things. Others took one that sort of threw equations at
> you without much explanation. I have even seen a course called Physics for
> Poets. But at least the poets taking it  knew science existed and perhaps to
> take it seriously when others who had studied it better shared their
> results, even if they have no interest in the methods.
> 
> We routinely have people learn how to use Word Processors or Spreadsheets
> with no clue on how to build such a thing or anything about the Object
> models used within or even knowing there is such a thing. Do they need to
> know how to use the embedded methods to extend things with Visual Basic or
> Javascript? They like getting closer to a WYSIWYG interface that handles
> most of their usual needs and perhaps farm out harder things to experts when
> needed.
> 
> So what if you teach some aspects of python that are needed all over, like
> how to make things conditional or in a loop, but not how to make every
> possible data structure. What if you deliberately do not teach functional
> aspects of the language at first or ever? For some people that is enough to
> enable them to then use additional instructions on how to find prepared and
> tested chunks to use, even if not always optimally or efficiently. For those
> who really want to be programmers, that still may actually be enough if
> their task is to work using the tools we have developed, not in making new
> tools from scratch. Quite a bit of programming today consists of reading
> manual pages and cobbling together chunks that together do the job.
> 
> But obviously I would choose the classes where I understood more. Many here
> would. But where does it end? Do most of us know how compilers or
> interpreters get built or do we just work on top of existing implementations
> others make available? Can you build an operating system from Scratch or
> make microchips to run them on?
> 
> If the goal is Computer USE literacy, I think python has more than enough if
> you include the modules that make hard things easy.
> 
> Just a thought. Admittedly it is hard these days 

Re: Help! I broke python 3.9 installation on macOS

2020-10-09 Thread Elliott Roper
On 9 Oct 2020 at 02:29:05 BST, "Richard Damon" 
wrote:

> On 10/8/20 7:31 PM, Elliott Roper wrote:
>>  First problem: I can no longer say
>>  Obfuscated@MyMac ~ % python3 pip -m list
> 
> isn't that supposed to be python3 -m pip list

Oh! (insert embarrassed grin here)

Thank you, and Chris.

-- 
To de-mung my e-mail address:- fsnospam$elliott$$
PGP Fingerprint: 1A96 3CF7 637F 896B C810  E199 7E5C A9E4 8E59 E248


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


Help! I broke python 3.9 installation on macOS

2020-10-08 Thread Elliott Roper
First problem: I can no longer say
Obfuscated@MyMac ~ % python3 pip -m list

It cries in pain with:

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3: can't open file
'/Users/Obfuscated/pip': [Errno 2] No such file or directory.
Why is it looking at my $HOME??

Here's some hopefully relevant outputs:

First, this to show terminal has picked up $PATH from .zprofile and runs
python 3.9.0

Obfuscated@MyMac ~ % python3
Python 3.9.0 (v3.9.0:9cf6752276, Oct  5 2020, 11:29:23) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D

however, typing various flavours of pip commands direct into the shell gives
me this:-

Obfuscated@MyMac ~ % pip3 list
PackageVersion
-- ---
pip20.2.3
setuptools 49.2.1

and


Obfuscated@MyMac ~ % pip3.8 list
Package Version
--- -
certifi 2020.6.20
cycler  0.10.0
kiwisolver  1.2.0
matplotlib  3.3.2
numexpr 2.7.1
numpy   1.19.2
pandas  1.1.2
Pillow  7.2.0
pip 20.2.3
pyparsing   2.4.7
python-dateutil 2.8.1
pytz2020.1
scipy   1.5.2
setuptools  49.2.1
six 1.15.0
wheel   0.35.1
Obfuscated@MyMac ~ %

Something has gone wrong with site.py probably unable to fall back to using
the older site-packages because of my $PATH abuse.

which now reads as

echo $PATH
/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Pyt
hon.framework/Versions/3.8/bin:/Users/Obfuscated/bin:/usr/local/bin:/usr/bin:
/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/Library/Appl
e/usr/bin

I tried installing the packages into 3.9 one at a time but got errors
indicating that it was trying to re-compile modules like pandas from source. I
saw a reply to a windows user on this list today who was advised to be patient
because 3.9 might be too new to have all the binary modules in PyPi

I scrubbed all of 3.9 from
/Library/Frameworks/Python.framework/Versions/
and re-installed python 3.9 from Python.org to get back to the same situation
described above.

I have tried to work out what was wrong by reading site.py but got lost.

Am I facing a ruthless deletion of every trace of Python and starting again,
or waiting patiently for the binary modules to appear (3.8 still works OK, so
I can live with that)??

Or is there some piece of obvious magic I have missed blundering in the land
of the Sorcerer's Apprentice?

Thanks
-- 
To de-mung my e-mail address:- fsnospam$elliott$$
PGP Fingerprint: 1A96 3CF7 637F 896B C810  E199 7E5C A9E4 8E59 E248


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


Re: Friday Finking: Beyond implementing Unicode

2020-06-12 Thread Elliott Roper
On 12 Jun 2020 at 09:47:04 BST, "moi"  wrote:

> i) Today there people, who are still not understanding this:
> 
 'Å'.encode('utf-8')
> b'\xc3\x85'
 'Å'.encode('utf-16-le')
> b'\xc5\x00'
 'Å'.encode('utf-32-le')
> b'\xc5\x00\x00\x00'
> 
> ii) On a Western Europen Windows, Py 3 is not even working
> correctly with the *characters* of the Windows-1252 coding
> scheme. (As I understand this issue, you may have the same
> problem on let say an iso-8859-2 platform).
> 
> iii) When it works, I mean when it *by chance* works, the
> result is all by satisfying:
> 
 import timeit
 timeit.timeit("s.encode('utf-8')", "s = 'Universität Zürich' * 1000")
> 50.9616764429
 timeit.timeit("s.encode('utf-8')", "s = 'Universitat Zurich' * 1000")
> 2.488587845973
 
> 
> 
> iv) ...
> v) ...
> vi) ...

i) Who cares?
ii) Breaking News. Windows is mired in backward compatibility.
iii) My 3 year old Mac is 5 times faster than that. Get over it.

Maths always made its greatest advances after notation improved.
Terseness and unambiguity are king.

You are looking backward.
DL Neil is looking forward. A long way forward. It won't be our generation,
our brains are already mis-wired.

-- 
To de-mung my e-mail address:- fsnospam$elliott$$
PGP Fingerprint: 1A96 3CF7 637F 896B C810  E199 7E5C A9E4 8E59 E248


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


Re: How to plot a data including date and time?

2019-08-14 Thread Elliott Roper
On 14 Aug 2019, Elliott Roper wrote
(in article<0001hw.23044901039e772c7ca97...@news.giganews.com>):

> On 14 Aug 2019, amirrezaheidary...@gmail.com wrote
> (in article<23d45668-fa47-4640-832a-5a5c64600...@googlegroups.com>):
>
> > On Tuesday, August 13, 2019 at 11:47:28 PM UTC+2, amirrezah...@gmail.com
> > wrote:

Oh Damn! Here is an attempt to stop the code running into a single line..
> >
> > > I have a .csv file, in first column I have date and hour, and in the 
> > > second
> > > column I have energy use data. How can I make a bar chart with Date and
> > > time as the x axis and the energy use as the Y axis?
> > >
> > > Thanks
> >
> > Thank you for your guidance. I am already using matplotlib but I do not know
> > how to import a column of date and time and to use it properly as the x
> > axis.
> > can you tell me the code?
> >
> > Thanks

>
> If you don't mind using a steam hammer to crack a nut, it is amazing what you
> can do with pandas using just the "10 minute guide" chapter in the (shudder)
> 10,000 page manual. The chief benefit is how thoroughly it protects you from
> Numpy and Matplotlib.
> I solved a similar problem (tracking home blood pressure with exponentially
> weighted means) up and running in half a day from a completely cold start.
> The graphing bit is a delight. However, if you want to do something that the
> 10 minute guide does not cover, you can lose a man-month without really
> trying. Pandas is a beautiful monster!
>
> Here's the relevant bit
>
> import numpy as np
>
> import pandas as pd
>
> import matplotlib.pyplot as plt
>
>
> #preparing the csv from a text file elided as irrelevant
>
> #except that the .csv headings have to be Date Systolic Diastolic for this to
> work as designed
>
> # Plot the intermediate file with pandas after adding exponentially weighted
> means
>
> df = pd.read_csv('Blood pressure.csv')
>
> df['Date'] = pd.to_datetime(df['Date'])
>
> df['Syst EWM'] = df['Systolic'].ewm(span=200).mean()
>
> df['Diast EWM'] = df['Diastolic'].ewm(span=200).mean()
>
> plt.ioff()
>
> df.plot(x='Date')
>
> print(df.tail(60)) #a debug line I left in to watch the EWMs sink to more
> healthy levels
>
> plt.ylabel('mm Hg')
>
> plt.suptitle("Home BP record")
>
> plt.show()
>
> That should give you a start

-- 
To de-mung my e-mail address:- fsnospam$elliott$$ PGP Fingerprint: 1A96 3CF7 
637F 896B C810 E199 7E5C A9E4 8E59 E248

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


Re: How to plot a data including date and time?

2019-08-14 Thread Elliott Roper
On 14 Aug 2019, amirrezaheidary...@gmail.com wrote
(in article<23d45668-fa47-4640-832a-5a5c64600...@googlegroups.com>):

> On Tuesday, August 13, 2019 at 11:47:28 PM UTC+2, amirrezah...@gmail.com
> wrote:
> > I have a .csv file, in first column I have date and hour, and in the second
> > column I have energy use data. How can I make a bar chart with Date and
> > time as the x axis and the energy use as the Y axis?
> >
> > Thanks
>
> Thank you for your guidance. I am already using matplotlib but I do not know
> how to import a column of date and time and to use it properly as the x axis.
> can you tell me the code?
>
> Thanks

If you don't mind using a steam hammer to crack a nut, it is amazing what you 
can do with pandas using just the "10 minute guide" chapter in the (shudder) 
10,000 page manual. The chief benefit is how thoroughly it protects you from 
Numpy and Matplotlib.
I solved a similar problem (tracking home blood pressure with exponentially 
weighted means) up and running in half a day from a completely cold start. 
The graphing bit is a delight. However, if you want to do something that the 
10 minute guide does not cover, you can lose a man-month without really 
trying. Pandas is a beautiful monster!

Here's the relevant bit

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pytz
from pytz import common_timezones, all_timezones

#preparing the csv from a text file elided as irrelevant
#except that the .csv headings have to be Date Systolic Diastolic for this to 
work as designed

# Plot the intermediate file with pandas after adding exponentially weighted 
means
df = pd.read_csv('Blood pressure.csv')
df['Date'] = pd.to_datetime(df['Date'])
df['Syst EWM'] = df['Systolic'].ewm(span=200).mean()
df['Diast EWM'] = df['Diastolic'].ewm(span=200).mean()
plt.ioff()
df.plot(x='Date')
print(df.tail(60)) #a debug line I left in to watch the EWMs sink to more 
healthy levels
plt.ylabel('mm Hg')
plt.suptitle("Home BP record")
plt.show()

That should give you a start
-- 
To de-mung my e-mail address:- fsnospam$elliott$$ PGP Fingerprint: 1A96 3CF7 
637F 896B C810 E199 7E5C A9E4 8E59 E248

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


Re: I lost nearly all my modules installing 3.7

2018-07-02 Thread Elliott Roper
On 2 Jul 2018, Michael Torrie wrote
(in article):

> On 06/30/2018 11:10 AM, Elliott Roper wrote:
> > I should have mentioned that none of this went wrong in 3.6. All I'm after
> > are packages I can install with pip3. I really don't need to go down all the
> > twisty passages installing Fortran
>
> That's because there were likely binary packages available in the PyPi
> repository for matplotlib. Python 3.7 is new enough that there are not
> yet binary "wheels" for matplotlib. So you'll either have to compile it
> from source (hence the fortran compiler), or wait until binary wheels
> show up in pip.
>
> If you're wanting to use SciPy and matplotlib, I suggest you stick with
> Python 3.6. There's little reason to immediately go to Python 3.7.
> Anytime you upgrade to the very latest version of Python, it's going to
> take some time for binary wheels to be built and placed on PyPi,
> installable with pip. Either that, or make sure you do have the
> compilers, dependent libraries and tools (pkg-config) installed. This
> is easy on Linux. On Mac it's more involved and will likely involve
> installing a whole suite of 3rd-party software like MacPorts.

Thanks Michael, Back to 3.6 after a short wait for a miracle or when I really 
need matplotlib. My doctor read the blood pressure riot act to me, so I 
decided to hit the Python big guns to track my BP after some drastic 
lifestyle changes. I have just had my second and last single shot of coffee 
for the day. I used to down 10 shots before lunch! And I'm typing this stone 
cold sober.

Pandas and Numpy are working OK on 3.7 and I think I have fixed the mess I 
had with some packages needing sudo magic to update, so this whole exercise 
has not been wasted.


-- 
To de-mung my e-mail address:- fsnospam$elliott$$ PGP Fingerprint: 1A96 3CF7 
637F 896B C810 E199 7E5C A9E4 8E59 E248

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


Re: I lost nearly all my modules installing 3.7

2018-06-30 Thread Elliott Roper
On 30 Jun 2018, dieter wrote
(in article):

> Elliott Roper  writes:
> > ...
> > install scipy wrote an error message longer than War and Peace that finished
> > with:-
> > 
> > error: library dfftpack has Fortran sources but no Fortran compiler found
>
> An error message of the type I like: precise:
> Install a "Fortran compiler" and try again.
>
> > ...
> > and matplotlib produced a beautifully formatted report that started with:
> > __
> > Complete output from command python setup.py egg_info:
> > IMPORTANT WARNING:
>
> This is a warning only (even though it is marked as important).
>
> > pkg-config is not installed.
> > matplotlib may not be able to find some of its dependencies
>
> And the warning message is precise again: install "pkg-config"
> to get rid of it.
>
> I do not know "pkg-config". The name seems to indicate an
> operating system package; but, it might also be a Python extension
> package (less likely).
> I would start with the "matplotlib"
> installation instructions to look for information about it.

Thanks Jim and dieter.

I should have mentioned that none of this went wrong in 3.6. All I'm after 
are packages I can install with pip3. I really don't need to go down all the 
twisty passages installing Fortran

I DID have pkg-config installed in ~/Library . site-packages. I 
uninstalled it and re-installed with an Admin account, where it appeared in 
/Library ... site-packages
but that made no difference, pip3 install -- user matplotlib still 
complaining about pkg-config not being installed and not being able to find 
png

I was wrong about
Both look like not having write access to
/private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pip-install-
np76k73m/

I do have write access. It looks like a Mac specific per user directory tree 
for temporary stuff and installation records.

I really am out of my depth here.

I have found a post with a very similar problem on Stack Exchange
https://stackoverflow.com/questions/51082934/matplotlib-2-2-2-installation-
error-on-high-sierra
sadly without an answer

-- 
To de-mung my e-mail address:- fsnospam$elliott$$ PGP Fingerprint: 1A96 3CF7 
637F 896B C810 E199 7E5C A9E4 8E59 E248

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


Re: I lost nearly all my modules installing 3.7

2018-06-29 Thread Elliott Roper
On 29 Jun 2018, Terry Reedy wrote
(in article):

> On 6/28/2018 6:45 PM, Elliott Roper wrote:
> > On 28 Jun 2018, Terry Reedy wrote
>
> > > There is a pip command for making an editable file of installed
> > > packages. Run that in 3.6, perhaps after updating everything.
> > >
> > >
> > > There is another pip command for using that file to install everything
> > > listed. Run that in 3.7.
> >
> > I can't see the pip commands you mention for writing a file from 3.6
> and
> > reading it back for 3.7
> > Is it pip freeze -r   followed by pip install -r? If so, what is
> > meant by 'the given requirements file' in the freeze options?
>
> 'pip freeze' sends the requirements list to stdout in alphabetical
> order. You redirect or copy-paste to a file. I have not done this, but
> apparently -r   uses file as a template for selecting and ordering
> the requirements. I presume pip will ignore any versions in the
> template and list the actual installed versions.
Thanks Terry. The freeze worked but the install -r looked like it was doing 
the right thing but ended up doing nothing after complaining about matplotlib 
being unable to install one of its dependencies IIRC

I have deleted every trace of python following every element on sys.path for 
every version I had except for Apple's 2.6 and then reinstalled 3.7 from 
python.org's downloads. Then using the output from my 3.6 freeze, I installed 
each package on that list one by one with the --user option.

That worked well except for two of the biggies I wanted to play with -- scipy 
and matplotlib.
I did get numpy and pandas to install that way, which is a large part I need 
for what I am playing with.

install scipy wrote an error message longer than War and Peace that finished 
with:-

error: library dfftpack has Fortran sources but no Fortran compiler found


Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u 
-c "import setuptools, 
tokenize;__file__='/private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pi
p-install-np76k73m/scipy/setup.py';f=getattr(tokenize, 'open', 
open)(__file__);code=f.read().replace('\r\n', 
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record 
/private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pip-record-
0norcg4s/install-record.txt --single-version-externally-managed --compile 
--user --prefix=" failed with error code 1 in 
/private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pip-install-
np76k73m/scipy/
__
_
and matplotlib produced a beautifully formatted report that started with:
__
Complete output from command python setup.py egg_info:
IMPORTANT WARNING:
pkg-config is not installed.
matplotlib may not be able to find some of its dependencies

Edit setup.cfg to change the build options
___
and finished with
* The following required packages can not be built:
* png


Command "python setup.py egg_info" failed with error code 1 in 
/private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pip-install-
3fnvrt2b/matplotlib/
___

Both look like not having write access to 
/private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pip-install-
np76k73m/

since I was installing with the --user switch, it looks like a bug in pip. It 
should have guessed I was a non-priviliged user. But then that "Edit 
setup.cfg to change the build options" is intriguing, especially since 'pip3 
config list' returns nothing.

Still. I have got a fair way there. Thanks so much for your help. It would be 
great if there were a Mac user with as much patience for numpties.

To de-mung my e-mail address:- fsnospam$elliott$$ PGP Fingerprint: 1A96 3CF7 
637F 896B C810 E199 7E5C A9E4 8E59 E248

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


Re: I lost nearly all my modules installing 3.7

2018-06-28 Thread Elliott Roper
On 28 Jun 2018, Terry Reedy wrote
(in article):

> On 6/28/2018 1:08 PM, Elliott Roper wrote:
> > I have done something stupid. Don't know what.
>
> It appears that you ran 3.7 expecting that modules installed for 3.6
> would magically be available for 3.7.
Yes indeed. It worked for 3.4, 3.5, and 3.6
>
>
> There is a pip command for making an editable file of installed
> packages. Run that in 3.6, perhaps after updating everything.
>
>
> There is another pip command for using that file to install everything
> listed. Run that in 3.7.

I can't see the pip commands you mention for writing a file from 3.6 and 
reading it back for 3.7
Is it pip freeze -r   followed by pip install -r? If so, what is 
meant by 'the given requirements file' in the freeze options?
>
>
> > My $PATH looks like this
> > XXXMac:~ elliott$ echo $PATH
> > /Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Py
> > th
> > on.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/
> > 3.
> > 5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/elliott/b
> > in
> > > /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local
> > > /MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/git/bin
> >
> > pip3 list or pip3.7 list gives me
> > Package Version
> > -- ---
> > pip 10.0.1
> > setuptools 39.0.1
>
> This is the content of the 3.7 site-packages.
>
> > > > > import numpy as np
> > Traceback (most recent call last):
> > File "", line 1, in 
> > ModuleNotFoundError: No module named 'numpy'
> > So it is not lying to me!!!
> >
> > pip list or pip3.6 list
> > gives the whole caboodle I was expecting with a far smaller version number
> > for setuptools.
>
> The content of the 3.6 site-packages directory.

When I look inside site-packages in ~/Library (see below) I see many packages 
that pip lists, but by no means all. F'instance numpy and scipy. They can be 
found in /Library's site-packages however.
>
>
> > My understanding is that the whole $PATH is searched in order to resolve an
> > import, but it isn't.
>
> The OS searches the OS path, which you listed above.
> Python searches its sys.path, which it creates when started.
> Run >>>  import sys; sys.path to see the contents.
> Unless macOS is more different than I think, you should see a 3.7
> site-packages when running 3.7.

Aha! That is most helpful

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(python prompt)>>>  import sys
.>>>sys.path
['', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', # 
no such file 
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', # 207 
items, none matching pip intstallable modules 
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-
dynload',# 69 items, none matching pip installable modules
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
packages'] # just pip and setuptools are in here
.>>>  ^D

EiPro:~ elliott$ python3.6
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
.>>>  import sys
(python prompt)>>>  sys.path
['', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', # 
no such file 
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', # 207 
items, none matching pip intstallable modules 
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-
dynload',# 65 items, none matching pip installable modules
'/Users/elliott/Library/Python/3.6/lib/python/site-packages', # 103 items 
some matching items that appear in pip3.6 list 
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages'] # numpy, scipy, pandas etc. are here. These might have been 
modules I needed sudo -H to update
.>>>

What I did not make clear that my 'elliott' user is not an Administrator. If 
I log into my admin account (which I hardly ever do), it thinks my Python3 is 
3.7, list there also shows the hugely abbreviated collection of modules 
namely pip and setuptools. pip list shows a list of modules so old as to be 
unrecognisable.

It looks like I have a tangled mess. Is there a way of getting rid of all the 
pythons except Apple's museum piece and starting again? It is a hobby for me. 
I have no need for backward compatibility. I think if I could install 3.7 
site wide from m

I lost nearly all my modules installing 3.7

2018-06-28 Thread Elliott Roper
I have done something stupid. Don't know what.

My $PATH looks like this
XXXMac:~ elliott$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Pyth
on.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.
5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/elliott/bin
:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/git/bin

pip3 list or pip3.7 list gives me
Package Version
-- ---
pip 10.0.1
setuptools 39.0.1
> > > import numpy as np
Traceback (most recent call last):
File "", line 1, in 
ModuleNotFoundError: No module named 'numpy'
So it is not lying to me!!!

pip list or pip3.6 list
gives the whole caboodle I was expecting with a far smaller version number 
for setuptools.

My understanding is that the whole $PATH is searched in order to resolve an 
import, but it isn't.

It might be relevant that I have had a bit of hassle installing module 
updates in the past. I would get an error saying the module version being 
replaced could not be deleted with permissions errors which I resolved with a 
bit of sudo -H.

Python 3.6 is still working properly when invoked explicitly

-- 
To de-mung my e-mail address:- fsnospam$elliott$$ PGP Fingerprint: 1A96 3CF7 
637F 896B C810 E199 7E5C A9E4 8E59 E248

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


Re: Enumerating all 3-tuples

2018-03-12 Thread Elliott Roper
On 10 Mar 2018, Paul Moore wrote
(in article):

> On 10 March 2018 at 02:18, MRAB  wrote:
> > On 2018-03-10 01:13, Steven D'Aprano wrote:
> > >
> > > I am trying to enumerate all the three-tuples (x, y, z) where each of x,
> > > y, z can range from 1 to ∞ (infinity).
> > >
> > > This is clearly unhelpful:
> > >
> > > for x in itertools.count(1):
> > > for y in itertools.count(1):
> > > for z in itertools.count(1):
> > > print(x, y, z)
> > >
> > > as it never advances beyond x=1, y=1 since the innermost loop never
> > > finishes.
> > >
> > > Georg Cantor to the rescue! (Well, almost...)
> [...]
> > > Can anyone help me out here?
> > Think about the totals of each triple. You'll get totals of 3, then totals
> > of 4, etc.
> >
> > This might help, although the order they come out might not be what you
> > want:
> >
> > def triples():
> > for total in itertools.count(1):
> > for i in range(1, total):
> > for j in range(1, total - i):
> > yield i, j, total - (i + j)
>
> Mathematically, that's the usual generalisation of Cantor's diagonal argument.
>
> Paul

Would a multi-dimensional Hilbert curve do the job? See the Wikipedia article 
for starters

-- 
To de-mung my e-mail address:- fsnospam$elliott$$ PGP Fingerprint: 1A96 3CF7 
637F 896B C810 E199 7E5C A9E4 8E59 E248

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