Hands-On Quantum Computing with Python

2019-01-05 Thread Bhagvan Kommadi
I am coauthoring a packt book : Hands-On Quantum Computing with Python. The 
book will be published around Aug 2019



The book will introduce quantum computing and a comprehensive overview of the 
quantum programming languages currently available, such as QCL, QASM, QUIL, and 
the differences between them. It will have examples and teach the reader how to 
write popular quantum algorithms in some of these languages, such as Grover’s 
search and Shor’s factorization algorithm.



#python #quantumcomputing #cryptography
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: chr - what's this?

2019-01-05 Thread Jon Ribbens
On 2019-01-05, Stefan Ram  wrote:
> r...@zedat.fu-berlin.de (Stefan Ram) writes:
>>print( chr( 0x231E )) # Unicode Character 'BOTTOM LEFT CORNER' (U+231E)
>>  File "~~~\Python\Python37\lib\encodings\cp1252.py", line 19, in encode
>
>   I also have:
>
> print(chr)
>
>
>   . Don't see how the call gets to cp1252.py. I see:
>
>   bltinmodule.c.h
>
> #define BUILTIN_CHR_METHODDEF\
> {"chr", (PyCFunction)builtin_chr, METH_O, builtin_chr__doc__},

It isn't chr() that's throwing the exception, it's print().
chr(0x231e) is returning a unicode string, print() is trying
to display that string on stdout, and apparently on your
machine Python thinks stdout is encoded as cp1252.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hands-On Quantum Computing with Python

2019-01-05 Thread Andrew Z
Good for you.

On Sat, Jan 5, 2019, 06:25 Bhagvan Kommadi  I am coauthoring a packt book : Hands-On Quantum Computing with Python.
> The book will be published around Aug 2019
>
>
>
> The book will introduce quantum computing and a comprehensive overview of
> the quantum programming languages currently available, such as QCL, QASM,
> QUIL, and the differences between them. It will have examples and teach the
> reader how to write popular quantum algorithms in some of these languages,
> such as Grover’s search and Shor’s factorization algorithm.
>
>
>
> #python #quantumcomputing #cryptography
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: the python name

2019-01-05 Thread Grant Edwards
On 2019-01-05, Michael Torrie  wrote:
> On 01/03/2019 06:35 PM, Gene Heskett wrote:
>> On Thursday 03 January 2019 15:28:49 Grant Edwards wrote:
>>> About 20 years ago, the RedHat Linux (way before RHEL) installer
>>> (which was written in Python) was called Anaconda.
>
>> Thanks for rescuing my old wet ram Grant, thats exactly what I was 
>> thinking of. AIR, it wasn't anywhere near a "real installer" and I spent 
>> a decent amount of time turning perfectly good air blue. 
>
> On the other hand I never had any troubles with it, nor have I had any
> problems with it recently.  Not sure what you mean about it not being
> anywhere near a "real installer."
>
> The non-linear redesign that came out a few years ago really threw me,
> and I still don't like it.

Yea, same yere.  I do several dozen Linux installs every year (of
various distros).  About half of the installs are with Anaconda
(CentOS and Fedora).  I find the new Anaconda far more confusing and
difficult than any of the others.

-- 
Grant



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


Re: the python name

2019-01-05 Thread Gene Heskett
On Friday 04 January 2019 20:27:44 Michael Torrie wrote:

> On 01/03/2019 06:35 PM, Gene Heskett wrote:
> > On Thursday 03 January 2019 15:28:49 Grant Edwards wrote:
> >> About 20 years ago, the RedHat Linux (way before RHEL) installer
> >> (which was written in Python) was called Anaconda.
> >
> > Thanks for rescuing my old wet ram Grant, thats exactly what I was
> > thinking of. AIR, it wasn't anywhere near a "real installer" and I
> > spent a decent amount of time turning perfectly good air blue.
>
> On the other hand I never had any troubles with it, nor have I had any
> problems with it recently.  Not sure what you mean about it not being
> anywhere near a "real installer."

It never felt like it was doing things in a logical order to me, so if 
you wanted partitions, you made then before hand, and then turned the 
air blue as it formatted your home partition, destroying a 5 year corpus 
of emails you had saved to help you get thru an upgrade. And the only 
backups I had at the time were on dds2 tapes, but the drive was as 
usual, spending the winter in Oklahoma city in seagates crappy shop. By 
then I'd about outgrown the dds2's, and amanda had just grown the 
ability to use vtapes on a big hard drive which were at least 1000 times 
more dependable than affordable tapes ever thought of being, so I 
converted my backup setup to use them and I've never looked back. The 
drive I just took out, a 1T I replaced with a 2T, has over 80,000 head 
flying hours on it, and is still as usable as ever.  Now thats what I 
call Dependability.
>
> The non-linear redesign that came out a few years ago really threw me,
> and I still don't like it.

Whatever debian has used for the last few years has just worked, except 
as usual, the partitioner has a mind of its own. So the last install I 
just let it do what it thought was right, and its actually not given me 
an excuse to fuss.  I've always got amanda to bail me out. But I always 
install to a bigger fresh drive, so I can just mount the old drive and 4 
hours or less later a 15 year corpus of email has been moved to the new 
drive and I'm a happy camper. Now smaller ssd's are affordable, prices 
are in free fall.  And their speed makes a 10 year old dell fly like a 
787! Love it.

Take care Michael.

Cheers, Gene Heskett
-- 

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


Re: conda/anaconda and pip3 (pip)

2019-01-05 Thread Paulo da Silva
Às 17:39 de 03/12/18, Paulo da Silva escreveu:

Well ... further clarification ...

> Hi!
> 
> I have an environment created with conda (anaconda3).
> There is a package that is unavailable in conda.
The package is sklearn (import sklearn). - Look below before comment pls.

> Installing it with pip3, with conda env activated, the installation goes
> to .local/bin and .local/lib in my home dir (BTW I'm running linux
> kubuntu 18.04).
This is because I used pip3.
pip3 is from the system.
Inside conda MyPy (my conda environment) only pip is available. This
"pip" works with python3.

So:
- I uninstalled sklearn using pip3 and installed it with pip.
- This sucessfully installed sklearn (a very small bunch of small files).
import sklearn didn't work!

I uninstalled sklearn with pip.

Then I searched for sklearn from the top level of anaconda3 dir.
I find few of them, all global to anaconda3 but out of the environment.
This means that these packages are not seen from the environment.
Besides sklearn was inside the scikit-learn package.

So I activated MyPy (my environment) and did
conda install scikit-learn

Now everything is working and coherent.

Still confused, however ...

Thank you all.
Regards.

--- news://freenews.netfront.net/ - complaints: n...@netfront.net ---
-- 
https://mail.python.org/mailman/listinfo/python-list


Best practice for upgrading SQLite C library (DLL, SO, etc) that ships with Python

2019-01-05 Thread Malcolm Greene
I noticed that there's a rather big gap between the latest version of
SQLite and the version of SQLite that ships with Python 3.6/3.7.
Is there best practice advice for upgrading the SQLlite C library that
ships with Python ... without causing havoc and mayhem on my system?
Options
Don't do it - the universe will split
Do it - just replace the DLL/SO library in your Python
installation's folderDo it - but rename the updated version so as not to 
overwrite the
default SQLlite library?Do it - using some type of virtual environment magic so 
your change is
truly isolated Other?

Are there OS specific issues to be concerned with or is there a general
pattern here? I work across Windows, Linux, and macOS.
Thank you,
Malcolm
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: the python name

2019-01-05 Thread Avi Gross
Dennis,

Yes, I remember seeing proofs that a bare-bones Turing Machine with an
infinite bidirectional tape can solve anything done by a classical computer.
I also suggest that in many cases, such a device is a way to transform any
problem that can be solved decently into one that can now be solved in
indefinite and sometimes effectively infinite, time. I wrote my thesis on a
variant of such an automaton.

But many things that are theoretically doable remain far from practical.
There are often shortcuts both in hardware and software that allow simpler
solutions using finite resources for reasonable amounts of data processed.

I recall an example from a version of mathematical LISP that I will rewrite
in python for illustration:

def is_greater(left, right):
if left <= 0 : return False
if right <= 0 : return True
return is_greater(left - 1, right - 1)

That is a beautiful mathematical way of looking at it. Given two
non-negative numbers, keep subtracting one from both sides until one is 0 or
less. At that point, you know. The original version did not use subtraction
but rather an abstract function to return a predecessor. Nice and abstract.
Too abstract.

Yes, this does not handle equality well. Easy enough to amend. But the POINT
is that comparing a trillion to a quadrillion may take some time and without
tail recursion may exhaust the stack long before it completes.

Yet for an amazing number of case, a shorter solution is as simple as
placing left in register A and right in register B and issuing a command
that compares them bitwise or something and returns a True/False in register
A as a bit, or whatever the details. Or, for big numbers, many other
techniques that are still simple and fast enough can be done such as
converting the number into a long string of decimals and comparing one at a
time till they diverge.

So for practical matters, Turing machines are no more than a debating point.
Yes, a language without exponentiation can solve a large set of problems
using repeated multiplication but how easily with it raise the
transcendental number e to the [product of the transcendental number pi
times the odd square root of -1] and get a result of -1?

Heck, who needs multiplication? Repeated addition might do, to a point?

Or, go back to the Turing machine where you, well, why bother?

In the real world, the path to progress in the PRESENT often uses
improvements that let you program at increasing levels of abstraction and
allows underlying details to be handled for you with some confidence. So
even though many programming constructs do an implicit goto when viewed at
machine language levels, they are usually somewhat hidden when viewed as
loops or exception handling. Heck, we now often hide loops.

-Original Message-
From: Python-list  On
Behalf Of Dennis Lee Bieber
Sent: Saturday, January 5, 2019 1:46 PM
To: python-list@python.org
Subject: Re: the python name

On Fri, 4 Jan 2019 22:59:40 -0500, "Avi Gross" 
declaimed the following:

>was badly named when it was among the first to do such things. I am 
>saying that in retrospect, almost any language can do a basic subset of 
>arithmetic operations. And there is nothing in principle that 
>necessarily stops any

CF: https://en.wikipedia.org/wiki/Turing_completeness

Pretty much ANY computer language can be used to do any computation -- it
may be more difficult in some, but it won't be impossible. The hypothetical
Turing machine would, in one way, be the ultimate in symbolic manipulation
given the basics consist of test/move/store...



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/ 

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

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


Re: the python name

2019-01-05 Thread Chris Angelico
On Sun, Jan 6, 2019 at 9:34 AM Avi Gross  wrote:
> I recall an example from a version of mathematical LISP that I will rewrite
> in python for illustration:
>
> def is_greater(left, right):
> if left <= 0 : return False
> if right <= 0 : return True
> return is_greater(left - 1, right - 1)

Possibly:
if left <= 0: return is_greater(-right, -left)

Otherwise it will give incorrect results for, eg, is_greater(-10, -11)

But your point is taken.

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


RE: the python name

2019-01-05 Thread Avi Gross
Chris,

As you noticed, I wanted to focus on a point and simplified the code. The
point was of an example that struck me as both mathematically beautiful and
completely impractical when it comes to decent programming given the
languages and tools available today.

What follows is really off topic so anyone not interested may wish to abort
here. It helps explain my chosen example.

The reality I am behind that function definition was quite a bit weirder. It
was part of an exercise in a world where arithmetic as we know it did not
exist and had to be bootstrapped into existence. Numbers had to be crafted
from nothing starting with the special number zero and a vague function
called successor() that created sort of an ordering on what became a set of
integers. So ONE (1) was DEFINED as successor(0) and TWO (2) was
successor(1) and so on. Of course, they then had to create a function called
predecessor() with the abstract and vague concept that it was a sort of
inverse of successor() so that for all elements x of the set created from 0
onward, there existed a function called predecessor() such that:

predecessor(successor(x)) == x
and of course:
successor(predecessor(x)) == x

So, at this point, negative integers are not quite in existence as nothing
defines predecessor(0), at least not yet. The progression was first to
create functions comparing any two entities (i.e. integers) sort of like the
one I mention above and calling it something like greater_than(a,b) and so
on till you built up a logical structure that included set theory and
eventually all of arithmetic and beyond.

As a philosophical or logical exercise, it indeed is true to suggest that
the lesser of a trillion and a quadrillion is whichever is in a sense closer
to zero. Closer here is defined as fewer calls to predecessor() before
hitting the one known number in this scheme. At that point in the book,
expressions like "5 - 3" are not yet defined.

Now such attempts to do a step by step building of a mathematical structure
from some minimal number of postulates is frequent in mathematics. Think
Euclidean Geometry where if don't take the fifth, you may end up in other
geometries like Riemannian and Lobachevskian. But in programming, we have
other definitions of number and the meaning of "+" uses such definitions. We
do not require multiple steps to add things. (Well, we sort of do by adding
columns and carrying, but relatively few and often hidden.) We not only do
not need multiple additions to do a multiplication, but have extended
arithmetic so you can multiple by real numbers instead of just by integers
as well as by negative ones or even by complex numbers and other extensions.
Ditto for raising numbers to powers not being restricted to an integral
number of multiplications.

My point is that the Turing tape with a head that can maintain states is a
fantasy that can be set up to very laboriously do the simplest things. Just
adding two numbers can require something tedious where two areas of the tape
contain N and M squares in a row that represent each of the two numbers. The
head must march back and forth and copy one square at a time, perhaps to a
new place, while marking the old one in a way that guides it to take the
next one when it returns, or something equally silly and if you count how
many times the head moves one square to the left or right in trying to add a
million to a million by making a third region containing 2 million identical
squares, good luck. 

Back to python. One feature I like in python is how flexible some things
are. Specifically as an example, an integer can grow as large as you want
without special arrangements being made. A dictionary similarly can grow or
a list or many things that normally start with a smaller amount of space
reserved for it. A dictionary may be created with space for a hundred
entries but as it fills, magically, a larger amount of space is created and
things are migrated over but everything already pointing to entries does not
notice or care. When I used to write programs in languages like C or PASCAL
some things that work fine in PYTHON would simply fail. Or, my code would be
full of places where I had to check if space was used up, allocate new
contiguous space and migrate things and try to sew up any loose ends. 

Do I want to go backward on many similar aspects where modern computing does
a better job? How much time need I waste using a limited language that can,
with tons of work, potentially do everything possible if I have to
consciously allocate space, mange my own tables keeping track of what is in
use, returning resources when no longer using them and so on. Languages with
strong typing sometimes got so restrictive and hard to write realistic
programs in that they had to be amended with gimmicks allowing you to go
around them. Languages where nothing was mutable wasted resources by
constantly copying things. It works, but there can be ways to make a
different tradeoff.

Python is a mix

Re: Best practice for upgrading SQLite C library (DLL, SO, etc) that ships with Python

2019-01-05 Thread Frank Millman
"Malcolm Greene"  wrote in message 
news:1546723194.1501226.1626474960.7ac72...@webmail.messagingengine.com...


I noticed that there's a rather big gap between the latest version of

SQLite and the version of SQLite that ships with Python 3.6/3.7.
Is there best practice advice for upgrading the SQLlite C library that
ships with Python ... without causing havoc and mayhem on my system?

Options
Don't do it - the universe will split
Do it - just replace the DLL/SO library in your Python
installation's folderDo it - but rename the updated version so as not to 
overwrite the
default SQLlite library?Do it - using some type of virtual environment magic 
so your change is

truly isolated Other?


Are there OS specific issues to be concerned with or is there a general

pattern here? I work across Windows, Linux, and macOS.

I have done this a few times on Windows.

I download the latest zip file from www.sqlite.org/download, unpack it, and 
replace the dll in the Python DLLs folder. I do back up the existing one 
first, just in case, but I have never had a problem.


I also download the 'tools' zip file, which contains sqlite3.exe, a 
command-line program for executing sql statements. I actually had a problem 
once when things that worked with sqlite3.exe did not work when I ran the 
same command from python. I eventually realised that the two underlying 
versions of sqlite3 were different, so now I make sure I always keep them in 
sync.


I can't comment about Linux or macOS, sorry.

Frank Millman



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


Is distutils deprecated?

2019-01-05 Thread אורי
Is `distutils` deprecated or about to be deprecated?

https://github.com/python-pillow/Pillow/issues/3547

אורי (Uri)
u...@speedy.net
-- 
https://mail.python.org/mailman/listinfo/python-list