Re: [Tutor] What exactly does the three dots do? Why such as thing?

2017-08-11 Thread Mats Wichmann
On 08/10/2017 05:23 PM, Alan Gauld via Tutor wrote:
> On 10/08/17 14:39, C W wrote:
> 
>> I suppose it's just a place holder, though I don't know when I would use it
>> in my every day life.
> 
> Probably never.
> 
> Like most programming languages Python has a load of rarely used,
> obscure features. Most Python programmers never use ellipses,

I guess what this means is when I post code snippets with some lines
elided for greater readability of the point being made I should not use
ellipses for that, as they're actually a syntactic element!   :)

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Percentage of installations without setuptools (Was if __name__=='__main__' ...)

2017-08-11 Thread Thomas Güttler

I start a new thread, since this is a new topic.

I don't have the deep knowledge like Chris, Steven or Alan.

I guess most python installations have setuptools. But this is only my naive 
vague guess.

How high is the percentage of python installation which don't have setuptools?

I have no clue. Is it 5%, 10%, 15% ...?

I know there is no definite answer to this question. But you can guess this 
better than me.

Regards,
 Thomas Güttler



Am 10.08.2017 um 12:01 schrieb Chris Warrick:
> On 9 August 2017 at 23:15, Steven D'Aprano  wrote:
>> On Tue, Aug 08, 2017 at 12:56:56PM +0200, Chris Warrick wrote:
>>
>>> While setuptools is not officially part of the stdlib,
>>
>> This is the critical factor. How can you use *by default* something that
>> is *NOT* supplied by default?
>>
>> Obviously you cannot. It is physically impossible.
>
>
> The problem with setuptools (and pip) is that they are not first-party
> stdlib members, but they are not third-party packages either. They’re
> somewhere in between. They have been blessed by the core developers.
> And yes, setuptools might be in all the places you mentioned:
>
>> But this does NOT hold for everyone, possibly not even for the majority
>> of Python users. For example:
>>
>> - students using their school's computers;
>>
>> - corporate and government users using a SOE (Standard Operating
>>Environment);
>>
>> - people using a system where, for policy reasons, only the
>>standard library is permitted.
>
> * If those computers run Windows (as they often do) and run a recent
> Python version (3.4 or newer/2.7.9 or newer), setuptools will be
> installed, unless the IT people explicitly disabled ensurepip.
> * On macOS, setuptools will be installed if they’re using the system
> Python, the python.org installers (which are not uninstallable), or
> Python from Homebrew. The last two also have pip, and system Python
> has ensurepip.
> * On Linux, setuptools/pip is likely to be there, but it’s not
> required in all distributions. (Fedora mandates setuptools; Debian
> even rips out ensurepip by default and hides it in python3-venv
> because reasons…)
>
> If the users are meant to install Python packages, their system
> administrators would take care of that — either by setting up
> setuptools/pip and perhaps virtualenv, or taking install requests from
> users. If users are not supposed to be running setuptools/pip, they
> probably shouldn’t, but they can still install it from ensurepip or
> downloading get-pip.py.
>
>> I've worked in places where installing unauthorized software was a
>> firing offence.
>
> Those people don’t need setuptools. Those people should not be using
> distutils either. They might not even be allowed to download packages
> and run __main__.py without installation.
>
--
Thomas Guettler http://www.thomas-guettler.de/


--
Thomas Guettler http://www.thomas-guettler.de/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What exactly does the three dots do? Why such as thing?

2017-08-11 Thread Alan Gauld via Tutor
On 11/08/17 14:57, Mats Wichmann wrote:

>> obscure features. Most Python programmers never use ellipses,
> 
> I guess what this means is when I post code snippets with some lines
> elided for greater readability of the point being made I should not use
> ellipses for that, as they're actually a syntactic element!   :)

Good point, because I often do that when replying to posts

def foo():...

I certainly don't mean the ellipses to be a syntactic element!


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage of installations without setuptools (Was if __name__=='__main__' ...)

2017-08-11 Thread Alan Gauld via Tutor
On 11/08/17 13:35, Thomas Güttler wrote:

> I guess most python installations have setuptools. 

I guess so too, although I don't know.
Those that don't are probably in one of two categories
a) people who just downloaded Python and never installed
   anything else
b) people working for large paranoid corporates. Although
   in this case there is probably only one installation,
   albeit with hundreds of users.

So far as I can tell I don't have it on any of my
Python installs on my Linux box, but I may just be looking
in the wrong place... I know I have it on my Windows box.

> But this is only my naive vague guess.

Me too :-)

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage of installations without setuptools (Was if __name__=='__main__' ...)

2017-08-11 Thread Mats Wichmann
On 08/11/2017 09:54 AM, Alan Gauld via Tutor wrote:
> On 11/08/17 13:35, Thomas Güttler wrote:
> 
>> I guess most python installations have setuptools. 
> 
> I guess so too, although I don't know.
> Those that don't are probably in one of two categories
> a) people who just downloaded Python and never installed
>anything else
> b) people working for large paranoid corporates. Although
>in this case there is probably only one installation,
>albeit with hundreds of users.
> 
> So far as I can tell I don't have it on any of my
> Python installs on my Linux box, but I may just be looking
> in the wrong place... 

Most Linux distributions choose to make it a separate package.  I have
it (them - one for Py2 and one for Py3) installed everywhere, but I'd
guess it's not a default install then.

Fedora:
python2-setuptools-36.2.0-1.fc26.noarch
python3-setuptools-36.2.0-1.fc26.noarch

Ubuntu:
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name  Version  Architecture Description
+++-=---=
ii  python-setuptools 33.1.1-1 all  Python Distutils
Enhancements
ii  python3-setuptools33.1.1-1 all  Python3 Distutils
Enhancements
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage of installations without setuptools (Was if __name__=='__main__' ...)

2017-08-11 Thread Chris Warrick
On 11 August 2017 at 19:54, Mats Wichmann  wrote:
> On 08/11/2017 09:54 AM, Alan Gauld via Tutor wrote:
>> On 11/08/17 13:35, Thomas Güttler wrote:
>>
>>> I guess most python installations have setuptools.
>>
>> I guess so too, although I don't know.
>> Those that don't are probably in one of two categories
>> a) people who just downloaded Python and never installed
>>anything else

False since Python 3.4/2.7.9. ensurepip installs Python on every new
Python install.

> Most Linux distributions choose to make it a separate package.  I have
> it (them - one for Py2 and one for Py3) installed everywhere, but I'd
> guess it's not a default install then.
>
> Fedora:
> python2-setuptools-36.2.0-1.fc26.noarch
> python3-setuptools-36.2.0-1.fc26.noarch
>
> Ubuntu:
> Desired=Unknown/Install/Remove/Purge/Hold
> |
> Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> ||/ Name  Version  Architecture Description
> +++-=---=
> ii  python-setuptools 33.1.1-1 all  Python Distutils
> Enhancements
> ii  python3-setuptools33.1.1-1 all  Python3 Distutils
> Enhancements

On Fedora, setuptools is mandatory:

package: python3-3.6.2-1.fc26.x86_64
[snip some unrelated stuff]
  dependency: python3-pip
   provider: python3-pip-9.0.1-9.fc26.noarch
  dependency: python3-setuptools
   provider: python3-setuptools-36.2.0-1.fc26.noarch

On other distributions, it usually isn’t, although many users will
eventually end up with a copy.

-- 
Chris Warrick 
PGP: 5EAAEA16
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage of installations without setuptools (Was if __name__=='__main__' ...)

2017-08-11 Thread Alan Gauld via Tutor
On 11/08/17 19:13, Chris Warrick wrote:

>>> a) people who just downloaded Python and never installed
>>>anything else
> 
> False since Python 3.4/2.7.9. ensurepip installs Python on every new
> Python install.

Sorry Chris, that's not making sense? Do you mean ensurepip
installs setuptools on every install? How does it do that if
I don't have the internet connected? Does it wait for
a connection then automatically do a download?

How would I tell if it is installed? Where do I look and
for what? Because its not where I thought it would be
- (in the libs)...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage of installations without setuptools (Was if __name__=='__main__' ...)

2017-08-11 Thread eryk sun
On Fri, Aug 11, 2017 at 6:27 PM, Alan Gauld via Tutor  wrote:
> On 11/08/17 19:13, Chris Warrick wrote:
>
>> False since Python 3.4/2.7.9. ensurepip installs Python on every new
>> Python install.
>
> Sorry Chris, that's not making sense? Do you mean ensurepip
> installs setuptools on every install? How does it do that if
> I don't have the internet connected? Does it wait for
> a connection then automatically do a download?

The Windows installer defaults to running ensurepip, which bundles
wheels for pip and setuptools. They may not be the latest versions.

> How would I tell if it is installed? Where do I look and
> for what? Because its not where I thought it would be
> - (in the libs)...

On Windows, look in "Lib\site-packages". In general you can `import
pip` and check pip.__file__. You should also have pip and pip3
commands. Run `pip3 show pip` to check the location.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] What exactly does the three dots do? Why such as thing?

2017-08-11 Thread Steven D'Aprano
On Fri, Aug 11, 2017 at 07:57:09AM -0600, Mats Wichmann wrote:
> On 08/10/2017 05:23 PM, Alan Gauld via Tutor wrote:
> > On 10/08/17 14:39, C W wrote:
> > 
> >> I suppose it's just a place holder, though I don't know when I would use it
> >> in my every day life.
> > 
> > Probably never.
> > 
> > Like most programming languages Python has a load of rarely used,
> > obscure features. Most Python programmers never use ellipses,
> 
> I guess what this means is when I post code snippets with some lines
> elided for greater readability of the point being made I should not use
> ellipses for that, as they're actually a syntactic element!   :)

No, go right ahead and continue using ... for elided lines. Python 3 
makes that syntactically legal, and the fact that elided code may be 
syntactically correct is one of the reasons that was done.

In Python 2, ... was just the *display* form of Ellipsis, and wasn't 
legal except in slice notation: a[...]. Python 3 made ... syntactic 
sugar for Ellipse everywhere, not just in slices, which makes:

x = ...

class X:
...

perfectly legal code. (Perhaps not *meaningful* code, but that's okay.)


-- 
Steve
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor