Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Marko Rauhamaa
Paul Rubin :

> Marko Rauhamaa  writes:
>> Yes, RHEL, CentOS and OracleLinux still only support Python2. It may
>> be another year before Python3 becomes available on them.
>
> Debian's default Python is also Python2. I don't say it *only*
> supports python2 since you can optionally install python3,

That option is not available for RHEL et al. It is expected that RHEL 8
will include Python3, but nobody knows when RHEL 8 will come out.


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


Re: Curious case of UnboundLocalError

2018-03-31 Thread Johannes Bauer
On 30.03.2018 16:46, Ben Bacarisse wrote:

>> Yup, but why? I mean, at the point of definition of "z", the only
>> definition of "collections" that would be visible to the code would be
>> the globally imported module, would it not? How can the code know of the
>> local declaration that only comes *after*?
> 
> Why questions can be hard.  The language definition says what's supposed
> to happen.  Is that enough of an answer to why?

Absolutely. Don't get me wrong, I dont't doubt either the correctness of
your answer nor question the design choice. I just found it surprising
and cool.

Thanks for clearing it up.

Cheers,
Joe



-- 
>> Wo hattest Du das Beben nochmal GENAU vorhergesagt?
> Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
 - Karl Kaos über Rüdiger Thomas in dsa 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Marko Rauhamaa
Paul Rubin :
> All the scripts that say #!/usr/bin/python at the top will still use
> python2.

Which is how it should be till the end of times.

Unfortunately, ArchLinux decided otherwise, which has caused quite a bit
of grief in the office, where a coworker uses it.

We thought we could get around the problem by specifying

   #!/usr/bin/env python2

in all of our scripts, but, regrettably,

   (1) Not all of our python tools are written by us

   (2) MacOS doesn't have a python2 alias for Python2

> Typing "python" or "python xyz.py" at the shell will also use python2.
> Python3 will have really taken over when it's the other way around and
> python2 is the optional install.

I disagree. It is enough for the oldest supported Linux and MacOS distro
to support Python3 out of the box.


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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Steven D'Aprano
On Sat, 31 Mar 2018 12:32:31 +0300, Marko Rauhamaa wrote:

> Paul Rubin :
> 
>> Marko Rauhamaa  writes:
>>> Yes, RHEL, CentOS and OracleLinux still only support Python2. It may
>>> be another year before Python3 becomes available on them.
>>
>> Debian's default Python is also Python2. I don't say it *only* supports
>> python2 since you can optionally install python3,
> 
> That option is not available for RHEL et al.

Python 3.3 was available for RHEL 6:

https://access.redhat.com/solutions/123273

I would be shocked if RedHat 7 didn't support 3.3, at the very least.



-- 
Steve

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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Steven D'Aprano
On Sat, 31 Mar 2018 12:39:48 +0300, Marko Rauhamaa wrote:

> Paul Rubin :
>> All the scripts that say #!/usr/bin/python at the top will still use
>> python2.
> 
> Which is how it should be till the end of times.

Don't be silly -- they should use Python 1, of course, as nature 
intended. In 20 years time, when we're using Python 5.2 and Python 3 is a 
distant memory, typing "python" at the command prompt should try to 
launch Python1.x.

If you think that's ludicrous, consider that replacing 1.x with 2.x 
doesn't make it any less ludicrous.


> Unfortunately, ArchLinux decided otherwise, which has caused quite a bit
> of grief in the office, where a coworker uses it.
> 
> We thought we could get around the problem by specifying
> 
>#!/usr/bin/env python2
> 
> in all of our scripts, but, regrettably,
> 
>(1) Not all of our python tools are written by us

Nevertheless, they're text files on your server which can easily have a 
tiny sed script run over them as part of the deployment process, or a 
thin wrapper in bash, or your tech staff could add an alias to their bash 
login script (or equivalent).

Or just get the Archlinux guy to add an alias to his logic script.



>(2) MacOS doesn't have a python2 alias for Python2

o_O

Um... is your tech team made up of actual techs or do you ask your 
grandma[1] to administrate your system? How hard is it to add a python2 
alias on MacOS?

That's a rhetorical question -- the answer is, "not hard at all".




[1] For all I know, Marko's grandma could have invented Unix. If that's 
the case, substitute my grandma, who certain did not.



-- 
Steve

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


Re: Curious case of UnboundLocalError

2018-03-31 Thread Peter Otten
Johannes Bauer wrote:

> On 30.03.2018 13:25, Johannes Bauer wrote:
> 
>>> This mention of collections refers to ...
>>>
 }
 for (_, collections) in z.items():
>>>
>>> ... this local variable.
>> 
>> Yup, but why? I mean, at the point of definition of "z", the only
>> definition of "collections" that would be visible to the code would be
>> the globally imported module, would it not? How can the code know of the
>> local declaration that only comes *after*?
> 
> Now that I understand what's going on, this is a much clearer example:
> 
> import collections
> def foo():
> print(collections)
> collections = "BAR"
> foo()
> 
> I would have thought that during the "print", collections (because
> locally undefined) would expand the scope to global scope and refer to
> the module and only after the definition overwrites the binding with the
> local scope, collections would be "BAR".
> 
> But that's not the case. Huh! I wonder if I'm the last one to notice
> that -- it's never come up before for me, I think :-)

While you're at it -- the body of a class behaves the way you expected from 
a function:

>>> x = "outer"
>>> class A:
... print(x)
... x = "inner"
... print(x)
... 
outer
inner

And here's an odd application for exec():

>>> x = "outer"
>>> def f():
... exec("print(x)")
... x = "inner"
... exec("print(x)")
... 
>>> f()
outer
inner

Also:

$ cat tmp.py
x = "outer"
def f():
print(x)
exec("x = 'inner'")
print(x)
f()
$ python2 tmp.py
outer
inner
$ python3 tmp.py
outer
outer


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


Re: How to fill in a dictionary with key and value from a string?

2018-03-31 Thread bartc

On 30/03/2018 21:13, C W wrote:

Hello all,

I want to create a dictionary.

The keys are 26 lowercase letters. The values are 26 uppercase letters.

The output should look like:
{'a': 'A', 'b': 'B',...,'z':'Z' }



I know I can use string.ascii_lowercase and string.ascii_uppercase, but how
do I use it exactly?
I have tried the following to create the keys:
myDict = {}
 for e in string.ascii_lowercase:
 myDict[e]=0


If the input string S is "cat" and the desired output is {'c':'C', 
'a':'A', 't':'T'}, then the loop might look like this:


   D = {}
   for c in S:
   D[c] = c.upper()

   print (D)

Output:

{'c': 'C', 'a': 'A', 't': 'T'}


But, how to fill in the values? Can I do myDict[0]='A', myDict[1]='B', and
so on?


Yes, but the result will be {0:'A', 1:'B',...} for which you don't need 
a dict; a list will do.


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


Beta release of pip version 10

2018-03-31 Thread Paul Moore
On behalf of the PyPA, I am pleased to announce that a beta release
10.0.0b1 of pip has just been released for testing by the community.
We're planning on a final release in 2 weeks' time, over the weekend
of 14/15 April.

To install pip 10.0.0.b1, you can run

python -m pip install --upgrade --pre pip

(obviously, you should not do this in a production environment!)

We would be grateful for all testing that users could do, to ensure
that when pip 10 is released it's as solid as we can make it.

Highlights of the new release:

* Python 2.6 is no longer supported - if you need pip on Python 2.6,
you should stay on pip 9, which is the last version to support Python
2.6.
* Support for PEP 518, which allows projects to specify what packages
they require in order to build from source. (PEP 518 support is
currently limited, with full support coming in future versions - see
the documentation for details).
* Significant improvements in Unicode handling for non-ASCII locales on Windows.
* A new "pip config" command.
* The default upgrade strategy has become "only-if-needed"
* Many bug fixes and minor improvements.

In addition, the previously announced reorganisation of pip's
internals has now taken place. Unless you are the author of code that
imports the pip module (or a user of such code), this change will not
affect you. If you are, please report the issue to the author of the
affected code (refer them to
https://mail.python.org/pipermail/distutils-sig/2017-October/031642.html
for the details of the announcement).

Please note that there is a minor issue with the NEWS file for this
release - the new features in 10.0.0b1 are reported as being for
"9.0.3 (2018-03-31)".

If you discover any bugs while testing the new release, please report
them at https://github.com/pypa/pip/issues.

Thanks to everyone who put so much effort into the new release. Many
of the contributions came from community members, whether in the form
of code, participation in design discussions, or bug reports. The pip
development team is extremely grateful to everyone in the community
for their contributions.

Thanks,
Paul
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Rick Johnson
On Friday, March 30, 2018 at 8:59:16 PM UTC-5, Chris Angelico wrote:
[...]
> You can pooh-pooh any statistic. 

Yeah, except the ones supported by actual _facts_.

> So far, though, you have provided NO statistics of your
> own, just your own gut feeling. 

Uh huh. And what do you call drawing naive conclusions from
statistical data? I'd call it confirmation bias!

> Wanna provide some competing information showing that other
> languages are more used?

Chris, here is how debate works:

PersonA asserts X.

PersonB demands evidence for X.

PersonA either provides evidence for X, or X is rejected as
hooey.

Under no circumstance is PersonB required to prove PersonA'a
assertions. The onerous is on PersonA.

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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Chris Angelico
On Sat, Mar 31, 2018 at 11:29 PM, Rick Johnson
 wrote:
> Under no circumstance is PersonB required to prove PersonA'a
> assertions. The onerous is on PersonA.

Assertion: Rick doesn't know what "onerous" means.

Under no circumstance is Rick required to prove me right. But he
obliged anyway. Very kind of him.

This has nothing to do with any sort of debate; I just thought it interesting.

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


Re: please test the new PyPI (now in beta)

2018-03-31 Thread Sumana Harihareswara
Quick note: we've implemented the fix Terry Jan Reedy suggested
regarding window width and filters to fix
https://github.com/pypa/warehouse/issues/3454 , so thank you to everyone
who helped us nail this down.

The next IRC/Twitter livechat hour with PyPI maintainers is Tuesday,
April 3rd at 15:00 UTC
https://pyfound.blogspot.com/2018/03/warehouse-all-new-pypi-is-now-in-beta.html#livechat
, and if any of you are going to be at PyCon North America in Cleveland
in May, consider joining us for the packaging sprints:
https://wiki.python.org/psf/PackagingSprints

And:

On 03/30/2018 11:03 AM, Paul Moore wrote:
> On 30 March 2018 at 14:38, William Ray Wing  wrote:
>> Sumana, I want to be sure we aren’t just talking past each other.  I notice 
>> that the URL you seem to always reference is:
>>
>> https://pypi.org/search/
>>
>> and if I go there, I get the filter list immediately.  The place I don’t see 
>> it is the home page:
>>
>> https://pypi.org/
>>
>> where I’m invited to “Search” or “Browse”, but where there is no filter 
>> list.  The filter list only appears after I’ve performed my first search.
>>
>> Thanks,
>> Bill
> 
> That's the same behaviour as the existing PyPI. There's a "search" box
> on the main page, and a "Browse" link on that page that takes you to a
> separate page that lets you select packages by category. I don't see
> this as a problem with the new PyPI - far from it, I wouldn't want the
> main page cluttered with category filters, if I need then I'll go to
> the dedicated browse page.
> 
> Just my 2p worth...
> Paul

Thanks for clarifying, Bill! Yes, I thought you were talking about the
dedicated search page, and now I see what you mean. And thanks for your
thoughts on this, Paul. I wonder whether some lookahead search that
includes suggested facets (specifically, classifiers) springing up as
you type would help? I've updated
https://github.com/pypa/warehouse/issues/3462 accordingly.

-- 
Sumana Harihareswara
Warehouse project manager
Changeset Consulting
https://changeset.nyc
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Ian Kelly
On Sat, Mar 31, 2018 at 6:29 AM, Rick Johnson
 wrote:
> On Friday, March 30, 2018 at 8:59:16 PM UTC-5, Chris Angelico wrote:
>> Wanna provide some competing information showing that other
>> languages are more used?
>
> Chris, here is how debate works:
>
> PersonA asserts X.
>
> PersonB demands evidence for X.
>
> PersonA either provides evidence for X, or X is rejected as
> hooey.

PersonB provides evidence fox X.

PersonA asserts that that evidence doesn't count because "it's
nothin' but hype".

PersonC provides a different source of numbers supporting X.

PersonA asserts that those numbers don't count either because most
of them are trolls or sock puppets.

PersonD asks if PersonA has any of their own evidence to provide.

PersonA snarkily responds that they don't need to provide evidence
because they didn't make the assertion, apparently oblivious to the
fact that they've actually made several assertions of their own over
the course of this.

Do I have this right? This is how I understand debate works from
following this thread. I see the same pattern on the Flat-Earth
threads, so I think I have it right.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Gene Heskett
On Saturday 31 March 2018 10:16:13 Ian Kelly wrote:

> On Sat, Mar 31, 2018 at 6:29 AM, Rick Johnson
>
>  wrote:
> > On Friday, March 30, 2018 at 8:59:16 PM UTC-5, Chris Angelico wrote:
> >> Wanna provide some competing information showing that other
> >> languages are more used?
> >
> > Chris, here is how debate works:
> >
> > PersonA asserts X.
> >
> > PersonB demands evidence for X.
> >
> > PersonA either provides evidence for X, or X is rejected as
> > hooey.
>
> PersonB provides evidence fox X.
>
> PersonA asserts that that evidence doesn't count because "it's
> nothin' but hype".
>
> PersonC provides a different source of numbers supporting X.
>
> PersonA asserts that those numbers don't count either because most
> of them are trolls or sock puppets.
>
> PersonD asks if PersonA has any of their own evidence to provide.
>
> PersonA snarkily responds that they don't need to provide evidence
> because they didn't make the assertion, apparently oblivious to the
> fact that they've actually made several assertions of their own over
> the course of this.
>
> Do I have this right? This is how I understand debate works from
> following this thread. I see the same pattern on the Flat-Earth
> threads, so I think I have it right.

Close enough for the girls I go with. 


-- 
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Etienne Robillard

Hi,

I was just wondering, could the fact that the Python community is 
willing to discontinue using and developing Python 2 softwares, does 
that mean we are stopping to support standard computers and laptops as well?


Furthermore, does it bother you to develop code primarly oriented 
towards mobile devices in Python 3 while most of the world still cannot 
afford theses expensive products?


Etienne

--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Michael Torrie
On 03/31/2018 08:58 AM, Etienne Robillard wrote:
> I was just wondering, could the fact that the Python community is 
> willing to discontinue using and developing Python 2 softwares, does
>  that mean we are stopping to support standard computers and laptops
> as well?

I've tried several times but I can't make sense of that paragraph.

> Furthermore, does it bother you to develop code primarly oriented 
> towards mobile devices in Python 3 while most of the world still
> cannot afford theses expensive products?

Or this one.  What are you talking about?

Regarding mobile development, I'd love to write mobile apps with
Python3.  At present, though, that's not very practical.  Python isn't
geared at all towards mobile space, and Apple and Google don't have any
interest in supporting much besides Obj C/Swift or a Java-based language
as a first class development language.

Just as an aside, many more people in the world can afford a smart phone
now than a "standard computer" or laptop. Probably an order of
magnitude.  Just saying.  I've seen smart phones all over the developing
world.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Etienne Robillard



Le 2018-03-31 à 11:40, Michael Torrie a écrit :

On 03/31/2018 08:58 AM, Etienne Robillard wrote:

I was just wondering, could the fact that the Python community is
willing to discontinue using and developing Python 2 softwares, does
  that mean we are stopping to support standard computers and laptops
as well?

I've tried several times but I can't make sense of that paragraph.
Please give me a break. That was just a simple question. Besides, I 
really don't understand why the Python development community is dropping 
support for Python 2 unless for stopping to support standard computers 
altogether...



Furthermore, does it bother you to develop code primarly oriented
towards mobile devices in Python 3 while most of the world still
cannot afford theses expensive products?

Or this one.  What are you talking about?


Are you trolling? Do you understand that a modern mobile device 
typically require a Internet subscription and an additional subscription 
for the smart phone?


Do you really think people in Somalia can afford theses things like in 
the US?



Etienne

--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Chris Angelico
On Sun, Apr 1, 2018 at 2:58 AM, Etienne Robillard  wrote:
>
>
> Le 2018-03-31 à 11:40, Michael Torrie a écrit :
>>
>> On 03/31/2018 08:58 AM, Etienne Robillard wrote:
>>>
>>> I was just wondering, could the fact that the Python community is
>>> willing to discontinue using and developing Python 2 softwares, does
>>>   that mean we are stopping to support standard computers and laptops
>>> as well?
>>
>> I've tried several times but I can't make sense of that paragraph.
>
> Please give me a break. That was just a simple question. Besides, I really
> don't understand why the Python development community is dropping support
> for Python 2 unless for stopping to support standard computers altogether...

How are they related? What does the termination of support for a
ten-year-old version of Python have to do with forcing everyone to
mobile devices that they don't own?

You might as well ask if after 2020 there will be no further support
for OSX, or no further support for compilers other than gcc, or no
further support for 64-bit computers.

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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread bartc

On 31/03/2018 16:58, Etienne Robillard wrote:



Le 2018-03-31 à 11:40, Michael Torrie a écrit :

On 03/31/2018 08:58 AM, Etienne Robillard wrote:

I was just wondering, could the fact that the Python community is
willing to discontinue using and developing Python 2 softwares, does
  that mean we are stopping to support standard computers and laptops
as well?

I've tried several times but I can't make sense of that paragraph.
Please give me a break. That was just a simple question. Besides, I 
really don't understand why the Python development community is dropping 
support for Python 2 unless for stopping to support standard computers 
altogether...



Furthermore, does it bother you to develop code primarly oriented
towards mobile devices in Python 3 while most of the world still
cannot afford theses expensive products?

Or this one.  What are you talking about?


Are you trolling? Do you understand that a modern mobile device 
typically require a Internet subscription and an additional subscription 
for the smart phone?


AIUI, a smartphone or tablet will still work as a small computer without 
an internet or phone connection (ie. without any of WiFi/GSM/3G/4G).


But a temporary WiFi link (eg. a free one at McDonald's) can be useful 
to download extra free apps then they can be used off-line.


Of source it might not be very popular without access to social media if 
that's the main purpose of the device.


--
bartc

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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Anders Wegge Keller
På Sat, 31 Mar 2018 11:58:39 -0400
Etienne Robillard  skrev:

> Are you trolling? Do you understand that a modern mobile device 
> typically require a Internet subscription and an additional subscription 
> for the smart phone?

 I think the question is why you equate python3 with the need for internet
connected tablets. That's quite the non sequitur. 

Consider this my +1 the the request of you to clarify what you mean.

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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Michael Torrie
On Mar 31, 2018 09:58, "Etienne Robillard"  wrote:



Le 2018-03-31 à 11:40, Michael Torrie a écrit :

> On 03/31/2018 08:58 AM, Etienne Robillard wrote:
>
>> I was just wondering, could the fact that the Python community is
>> willing to discontinue using and developing Python 2 softwares, does
>>   that mean we are stopping to support standard computers and laptops
>> as well?
>>
> I've tried several times but I can't make sense of that paragraph.
>
Please give me a break. That was just a simple question. Besides, I really
don't understand why the Python development community is dropping support
for Python 2 unless for stopping to support standard computers altogether...

Why would dropping support for python 2 indicate an abandonment of
conventional desktop computers and operating systems?  Python3 is not a
mobile language. Why do you think it is?



> Furthermore, does it bother you to develop code primarly oriented
>> towards mobile devices in Python 3 while most of the world still
>> cannot afford theses expensive products?
>>
> Or this one.  What are you talking about?
>

Are you trolling? Do you understand that a modern mobile device typically
require a Internet subscription and an additional subscription for the
smart phone?


I'm not trolling. I genuinely don't understand where you're coming from.
What does python3 have to do with mobile development? I know of very little
mobile development happening with any version of python.


Do you really think people in Somalia can afford theses things like in the
US?


I can assure you that smart phones have made waves even in Somalia. As far
as it goes, I'm quite sure a smart phone is way cheaper than a desktop or
laptop.

But again I don't understand why you're talking about mobile as if python
is somehow abandoning desktop. You're coming from a false premise with that
one.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Grant Edwards
On 2018-03-31, Etienne Robillard  wrote:

> Are you trolling? Do you understand that a modern mobile device 
> typically require a Internet subscription and an additional subscription 
> for the smart phone?

Huh?  What is "an internet subscription"?

Why would you need two of them if all you have is a smartphone?

> Do you really think people in Somalia can afford theses things like in 
> the US?

I think you'll find that smartphones are far more widespread in both
rich and poor countries than are traditional computers and laptops.

-- 
Grant




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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Terry Reedy

On 3/31/2018 11:58 AM, Etienne Robillard wrote:

Do you really think people in Somalia can afford theses things like in 
the US?


No, many cannot afford $600 Caddilac-style phones to take 10 megapixel 
pictures and watch UTube videos.  Instead they buy $100 VWBug-style 
phones that let them get competitive prices for their crops and other 
goods instead of accepting low-ball bids from whoever wanders by their 
village.


Africans are ahead of at least the US in using phone minutes as a benign 
practical digital currency.  This, not destructive and useless bitcoins, 
are the real revolution.


--
Terry Jan Reedy

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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Rick Johnson
Grant Edwards wrote:
> Etienne Robillard wrote:
> 
> > Do you understand that a modern mobile device typically
> > require a Internet subscription and an additional
> > subscription for the smart phone?
> 
> Huh?  What is "an internet subscription"?  Why would you
> need two of them if all you have is a smartphone?

Most american cell providers these days offer an unlimited
"0talk and text" plan and then add an additional fee for smart
phones (aka: "Data Plan").
-- 
https://mail.python.org/mailman/listinfo/python-list


GPG signatures invisible in new PyPI (was: Re: new Python Package Index is now in beta at pypi.org)

2018-03-31 Thread Dominik George
Hi,

On Sat, Mar 31, 2018 at 06:16:51PM -0400, Sumana Harihareswara wrote:
> The new Python Package Index at https://pypi.org is now in beta.

Yep!

I read that the new Warehouse does not offer GPG signature files for
download.

Why not?  How can I still get them (append .asc to the source downlaod?),
and how do I find out whether an upload is signed?

I am asking mainly as a Debian developer relying on upstream signatures.

-nik

-- 
PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17  FD26 B79A 3C16 A0C4 F296

Dominik George · Hundeshagenstr. 26 · 53225 Bonn
Phone: +49 228 92934581 · https://www.dominik-george.de/

Teckids e.V. · FrOSCon e.V. · Debian Developer

LPIC-3 Linux Enterprise Professional (Security)


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Beta release of pip version 10

2018-03-31 Thread Mikhail V
Paul Moore writes :

If you discover any bugs while testing the new release, please report
> them at https://github.com/pypa/pip/issues.


Link not working (on pipermail archive -- remove the period on the end)
https://github.com/pypa/pip/issues

PS: was looking forward to PIP improvements on Windows,
on 9.0.3 still some issues. E.g. trying to redirect output
from 'pip search ... > a.txt' gives a wall of errors.
it's on Windows 10.

(logging to file is needed because there is no advanced
search, so need some filtering to restrict the output to
packages only, since it searches in description too and
that may be a lng list of packages).



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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Steven D'Aprano
On Sat, 31 Mar 2018 10:58:51 -0400, Etienne Robillard wrote:

> Hi,
> 
> I was just wondering, could the fact that the Python community is
> willing to discontinue using and developing Python 2 softwares, does
> that mean we are stopping to support standard computers and laptops as
> well?

That seems to be a strange question to ask, when servers and desktops are 
the primary focus of Python 3.


> Furthermore, does it bother you to develop code primarly oriented
> towards mobile devices in Python 3 while most of the world still cannot
> afford theses expensive products?

It doesn't bother me one bit, because I don't do it. Nor is Python mainly 
oriented towards mobile devices. In fact, getting Python working on 
mobile devices is still a bit of a challenge.



-- 
Steve

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


Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-31 Thread Steven D'Aprano
On Sat, 31 Mar 2018 14:07:37 -0400, Terry Reedy wrote:

> On 3/31/2018 11:58 AM, Etienne Robillard wrote:
> 
>> Do you really think people in Somalia can afford theses things like in
>> the US?
> 
> No, many cannot afford $600 Caddilac-style phones to take 10 megapixel
> pictures and watch UTube videos.  Instead they buy $100 VWBug-style
> phones that let them get competitive prices for their crops and other
> goods instead of accepting low-ball bids from whoever wanders by their
> village.
> 
> Africans are ahead of at least the US in using phone minutes as a benign
> practical digital currency.  This, not destructive and useless bitcoins,
> are the real revolution.

What Terry said.

Personally, I dislike smartphones, but I have to say that they way they 
are used in villages across India, Africa and other developing places has 
been far more of a benign revolution than what smartphones are doing to 
the West.


None of this has anything to do with Python though. Python is not 
primarily a device for development on mobile devices, it is not dropping 
support for laptops, desktops and servers, and Etienne's questions are 
based on utterly false premises.


-- 
Steve

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


Re: Beta release of pip version 10

2018-03-31 Thread Steven D'Aprano
On Sun, 01 Apr 2018 03:17:51 +0300, Mikhail V wrote:

> PS: was looking forward to PIP improvements on Windows, on 9.0.3 still
> some issues. E.g. trying to redirect output from 'pip search ... >
> a.txt' gives a wall of errors. it's on Windows 10.


Don't be shy, tell us what those errors are.


-- 
Steve

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


Beta release of pip version 10

2018-03-31 Thread Mikhail V
Steven D'Aprano writes:

>>
>> PS: was looking forward to PIP improvements on Windows, on 9.0.3 still
>> some issues. E.g. trying to redirect output from 'pip search ... >
>> a.txt' gives a wall of errors. it's on Windows 10.
>
>
>
> Don't be shy, tell us what those errors are.


You meant - don't be lazy to figure out how to reproduce it.

UnicodeEncodeError: 'charmap' codec can't encode character

when it meets a non-ascii char.

e.g. tried this:
pip search pygame > a.txt
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Beta release of pip version 10

2018-03-31 Thread MRAB

On 2018-04-01 02:50, Mikhail V wrote:

Steven D'Aprano writes:



PS: was looking forward to PIP improvements on Windows, on 9.0.3 still
some issues. E.g. trying to redirect output from 'pip search ... >
a.txt' gives a wall of errors. it's on Windows 10.




Don't be shy, tell us what those errors are.



You meant - don't be lazy to figure out how to reproduce it.

UnicodeEncodeError: 'charmap' codec can't encode character

when it meets a non-ascii char.

e.g. tried this:
pip search pygame > a.txt


Well, _I_ didn't get an error!

One of the lines is:

kundalini (0.4)- LրVE-like PyGame API

So it's down to what system encoding (active code page) is in use.
--
https://mail.python.org/mailman/listinfo/python-list


Re: GPG signatures invisible in new PyPI (was: Re: new Python Package Index is now in beta at pypi.org)

2018-03-31 Thread Sumana Harihareswara
On 03/31/2018 06:26 PM, Dominik George wrote:
> Hi,
> 
> On Sat, Mar 31, 2018 at 06:16:51PM -0400, Sumana Harihareswara wrote:
>> The new Python Package Index at https://pypi.org is now in beta.
> 
> Yep!
> 
> I read that the new Warehouse does not offer GPG signature files for
> download.
> 
> Why not?  How can I still get them (append .asc to the source downlaod?),
> and how do I find out whether an upload is signed?
> 
> I am asking mainly as a Debian developer relying on upstream signatures.
> 
> -nik

Thanks for your question, Nik.

Once the legacy site shuts down, GPG/PGP signatures for packages will no
longer be visible in PyPI's web UI. But signatures still appear in the
Simple Project API
https://warehouse.readthedocs.io/api-reference/legacy/#simple-project-api
per PEP 503 https://www.python.org/dev/peps/pep-0503/ .

Donald Stufft, who started Warehouse and is one of its core maintainers,
has made no secret of his opinion that "package signing is not the Holy
Grail"
https://caremad.io/posts/2013/07/packaging-signing-not-holy-grail/ , and
current discussion on the distutils-sig mailing list leans towards
further removing signing features from another part of the Python
packaging ecology (the wheel library)
https://mail.python.org/pipermail/distutils-sig/2018-March/032066.html .
There's other relevant discussion in
https://mail.python.org/pipermail/distutils-sig/2016-May/028933.html and
https://github.com/pypa/warehouse/issues/1439  and I believe
https://github.com/pypa/warehouse/pull/2172 .

This is a policy discussion that probably belongs on distutils-sig
and/or in the "packaging problems" issues repository, like in
https://github.com/pypa/packaging-problems/issues/15 . The people
working on Python packaging and distribution tools want to hear from you
and figure out a way forward that works for everyone, if possible.

I've been trying to reach out to the Debian Python community via IRC,
personal connections, tickets, and mailing lists to ensure a smooth
transition; I see now that a post I tried to get onto the debian-python
list a few weeks ago did not get posted there, so I've re-sent it. I'm
sorry that this is (I infer) the first you're hearing about this change.

-- 
Sumana Harihareswara
Warehouse project manager
Changeset Consulting
https://changeset.nyc
-- 
https://mail.python.org/mailman/listinfo/python-list


Beta release of pip version 10

2018-03-31 Thread Mikhail V
MRAB writes:


> > UnicodeEncodeError: 'charmap' codec can't encode character
> >
> > when it meets a non-ascii char.
> >
> > e.g. tried this:
> > pip search pygame > a.txt
> >
> Well, _I_ didn't get an error!
>
> One of the lines is:
>
> kundalini (0.4)- LրVE-like PyGame API
>
> So it's down to what system encoding (active code page) is in use.

Dunno, it gives me error regardless of active codepage,
my default is 866, i've set to 1252 or 65001, same error.

The output itself is fine - I see correct glyphs, so the error
only appears when I redirect to file.
if I try some python script e.g. "a.py":
print ("абв")

and run:
py a.py > a.txt

I get some gibberish in the file.
So it is probably a global issue. Nothing works in this life :)
-- 
https://mail.python.org/mailman/listinfo/python-list


Unified async/sync interface

2018-03-31 Thread Demian Brecht
I might be entirely off my face, but figured I'd ask anyways given I
haven't figured out a clean solution to this problem myself yet:

I'm trying to write a REST API client that supports both async and
synchronous HTTP transports (initially requests and aiohttp). So far,
I've tried a few approaches with `async def` but, of course, you always
run into the issue with the top level API that should either be async
or not, but can't be redefined on the fly (AFAICT). I'm also trying to
limit code duplication. I know I could write async and sync versions of
each method and then instantiate through composition based on the
transport layer but I'd like to avoid that if possible. As an
simplified example of what I'm after:

import requests
import aiohttp

class SyncTransport:
  def get(self, url):
 return requests.get(url)

class AsyncTransport:
  def __init__(self, loop=None):
self.loop = loop

  async def get(self, url):
[...preamble...]
return await response.text()

class MyAPIClient:
  def __init__(self, transport=SyncTransport):
self.transport = transport()

  # biggest issue here atm, not being able to dynamically swap the
  # method definition to async
  def get_something(self):
if isinstance(self.transport, AsyncTransport):
  data = await self.transport.get('https://example.com')
else:
  data = self.transport.get('https://example.com')
return json.loads(data)

# intended synchronous usage
client = MyAPIClient()
data = client.get_something()

# intended async usage
import asyncio
client =
MyAPIClient(transport=AysncTransport(loop=asyncio.get_event_loop())

async def get_something():
  data = await client.get_something()

loop = asyncio.get_event_loop()
loop.run_until_complete(get_something())


Is this perhaps possible through asyncio.coroutine decorators
(admittedly, I haven't looked yet, I've had async/await blinders on)?
Are there any projects that anyone's aware of that does anything
similar that I could use as an example?

The overall point of what I'm trying to achieve here is to write a
client that's supported from 2.7 to 3.x and supports /either/
synchronous or asynchronous transports (not both at the same time).

TIA
Demian

signature.asc
Description: This is a digitally signed message part
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: GPG signatures invisible in new PyPI (was: Re: new Python Package Index is now in beta at pypi.org)

2018-03-31 Thread Dominik George
Hi Sumana,

> I've been trying to reach out to the Debian Python community via IRC,
> personal connections, tickets, and mailing lists to ensure a smooth
> transition; I see now that a post I tried to get onto the debian-python
> list a few weeks ago did not get posted there, so I've re-sent it. I'm
> sorry that this is (I infer) the first you're hearing about this change.

Thank you ☺!

I see that the discussion there now has started.

Cheers,
Nik


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list