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

2017-08-14 Thread Thomas Güttler



Am 13.08.2017 um 02:12 schrieb Steven D'Aprano:

On Fri, Aug 11, 2017 at 02:35:00PM +0200, Thomas Güttler wrote:


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.


Somewhere between 0.1% and 99.9%.

For what little it is worth, out of the 9 versions of Python I have
installed on my personal machines, setuptools is installed for 4 of
them. On work machines, 2 out of 5 have setuptools installed. So in
total, 6 out of 14 Python installations I have access to include
setuptools. So 57% *don't* have setup tools.

Really Thomas, why do you care?


Good question. Why do I care ...

If there is no solid ground, no sane defaults, then young and talented 
programmers
waste time. I just don't know why, but this makes me feel pain.


If you want to require setuptools for
your packages, go right ahead. If you want to tell people that using
setuptools is the best choice, or the most popular choice, or the
smartest choice, do so.

Just don't say it is the "default choice" because that is silly. The
whole purpose of something being *default* is so that you DON'T have to
make a choice. Obviously that doesn't apply to choosing a packaging
library, and especially not to choosing a packaging language which may
not even be present. Even if its only missing 1% of the time.



As a third-party author, the sorts of people who don't have setuptools
installed either won't be installing your software at all, or will be
installing it from source.




--
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] Percentage of installations without setuptools (Was if __name__=='__main__' ...)

2017-08-12 Thread Steven D'Aprano
On Fri, Aug 11, 2017 at 02:35:00PM +0200, Thomas Güttler wrote:

> 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.

Somewhere between 0.1% and 99.9%.

For what little it is worth, out of the 9 versions of Python I have 
installed on my personal machines, setuptools is installed for 4 of 
them. On work machines, 2 out of 5 have setuptools installed. So in 
total, 6 out of 14 Python installations I have access to include 
setuptools. So 57% *don't* have setup tools.

Really Thomas, why do you care? If you want to require setuptools for 
your packages, go right ahead. If you want to tell people that using 
setuptools is the best choice, or the most popular choice, or the 
smartest choice, do so.

Just don't say it is the "default choice" because that is silly. The 
whole purpose of something being *default* is so that you DON'T have to 
make a choice. Obviously that doesn't apply to choosing a packaging 
library, and especially not to choosing a packaging language which may 
not even be present. Even if its only missing 1% of the time.

As a third-party author, the sorts of people who don't have setuptools 
installed either won't be installing your software at all, or will be 
installing it from source.


-- 
Steve
___
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] 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 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 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 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


[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] Percentage

2005-11-11 Thread Sean Perry
Johan Geldenhuys wrote:
 Hi all,
 
 What is the syntax if I want to work out what percentage 42 is out of 250?
 

42 is x percent of 250.

(is / of) = (x / 100)

one of those formulas from school I will always remember.

(42 / 250) = (x / 100.0)
250x = 4200.0
x = 4200.0 / 250
x = 16.8%
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-08 Thread Johan Geldenhuys




Now that I have the answer (16.801), How do I round it of
to 16.80 ? I only need it to be to the closest 1/100.

TIA

Jorge Godoy wrote:

  Frank Moore [EMAIL PROTECTED] writes:

  
  
Johan,

You could try:

percentage = (42 * 250)/100

This gives the answer 105.

  
  
And that sounds weird, doesn't it?  42 is smaller than 250, so I'd expect it
to be less than 100% of the value...  In fact, it is 

  
  

  
42.0/250

  

  
  0.16801
  
  

  
(42.0/250)*100

  

  
  16.801
  
  
I suspect the problem is due to the fact that Python does integer division by
default: 

  
  

  
42/250

  

  
  0
  
  
So, how to make it generic?

  
  

  
a = 42
b = 250
a / b

  

  
  0
  
  

  
float(a)/b

  

  
  0.16801
  
  
One of the members has to be a floating point so that floating point division
is performed instead of integer division.


Be seeing you,
  



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-08 Thread Jorge Godoy
Johan Geldenhuys [EMAIL PROTECTED] writes:

 Now that I have the answer (16.801), How do I round it of to 16.80
  ? I only need it to be to the closest 1/100.

 print %.2f % 16.801
16.80
 a = 16.80001
 b = %.2f % a
 b
'16.80'
 float(b)
16.801
 str(float(b))
'16.8'
 

(The reason for the '0001' is because of the numeric base used to
represent data -- binary -- and the numeric base I'm requesting the answer to
be in -- decimal.)


Be seeing you,
-- 
Jorge Godoy  [EMAIL PROTECTED]

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-08 Thread Johan Geldenhuys




Thanks, that helps.


Jorge Godoy wrote:

  Johan Geldenhuys [EMAIL PROTECTED] writes:

  
  
Now that I have the answer (16.801), How do I round it of to 16.80
 ? I only need it to be to the closest 1/100.

  
  
  
  

  
print "%.2f" % 16.801

  

  
  16.80
  
  

  
a = 16.80001
b = "%.2f" % a
b

  

  
  '16.80'
  
  

  
float(b)

  

  
  16.801
  
  

  
str(float(b))

  

  
  '16.8'
  
  
(The reason for the '0001' is because of the numeric base used to
represent data -- binary -- and the numeric base I'm requesting the answer to
be in -- decimal.)


Be seeing you,
  



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Percentage

2005-11-07 Thread Johan Geldenhuys
Hi all,

What is the syntax if I want to work out what percentage 42 is out of 250?

TIA,
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
Johan Geldenhuys [EMAIL PROTECTED] writes:

 What is the syntax if I want to work out what percentage 42 is out of 250?

If you want it as a factor to multiply / divide by something:

perc = 42/250

If you want it to read as percentage:

perc_100 = (42/250)*100


Sds,
-- 
Jorge Godoy  [EMAIL PROTECTED]

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-07 Thread Frank Moore
Johan Geldenhuys wrote:

Hi all,

What is the syntax if I want to work out what percentage 42 is out of 250?
  

Johan,

You could try:

percentage = (42 * 250)/100

This gives the answer 105.

Cheers,
F.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-07 Thread Johan Geldenhuys




I have it like that, just thought there could be another way.
 8-) 

Jorge Godoy wrote:

  Johan Geldenhuys [EMAIL PROTECTED] writes:

  
  
What is the syntax if I want to work out what percentage 42 is out of 250?

  
  
If you want it as a factor to multiply / divide by something:

perc = 42/250

If you want it to "read" as percentage:

perc_100 = (42/250)*100


Sds,
  



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-07 Thread Pujo Aji
don't forget to use dot or converge into float.perc = 42./250or perc = float(42)/250otherwise:it is treated as integer.pujoOn 07 Nov 2005 11:50:05 -0200, 
Jorge Godoy [EMAIL PROTECTED] wrote:
Johan Geldenhuys [EMAIL PROTECTED] writes: What is the syntax if I want to work out what percentage 42 is out of 250?If you want it as a factor to multiply / divide by something:
perc = 42/250If you want it to read as percentage:perc_100 = (42/250)*100Sds,--Jorge Godoy[EMAIL PROTECTED]___
Tutor maillist-Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-07 Thread Johan Geldenhuys




Wow, you gave 105% on this one.  ;-)


Frank Moore wrote:

  Johan Geldenhuys wrote:

  
  
Hi all,

What is the syntax if I want to work out what percentage 42 is out of 250?
 


  
  Johan,

You could try:

percentage = (42 * 250)/100

This gives the answer 105.

Cheers,
F.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

  



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-07 Thread Steve Nelson
On 07 Nov 2005 11:50:05 -0200, Jorge Godoy [EMAIL PROTECTED] wrote:
 Johan Geldenhuys [EMAIL PROTECTED] writes:

  What is the syntax if I want to work out what percentage 42 is out of 250?

 If you want it as a factor to multiply / divide by something:

 perc = 42/250

Don't you need to specify one of these numbers as a float?

 print 42/250
0
 print 42/250.0
0.168

I recall reading somewhere that all division would be 'true division'
from 3.0 but this isn't the case in 2.x is it?

 Jorge Godoy  [EMAIL PROTECTED]

S.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
Frank Moore [EMAIL PROTECTED] writes:

 Johan,
 
 You could try:
 
 percentage = (42 * 250)/100
 
 This gives the answer 105.

And that sounds weird, doesn't it?  42 is smaller than 250, so I'd expect it
to be less than 100% of the value...  In fact, it is 

 42.0/250
0.16801
 (42.0/250)*100
16.801
 

I suspect the problem is due to the fact that Python does integer division by
default: 

 42/250
0


So, how to make it generic?

 a = 42
 b = 250
 a / b
0
 float(a)/b
0.16801
 

One of the members has to be a floating point so that floating point division
is performed instead of integer division.


Be seeing you,
-- 
Jorge Godoy  [EMAIL PROTECTED]

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
Steve Nelson [EMAIL PROTECTED] writes:

 Don't you need to specify one of these numbers as a float?

You do.  My mistake and I haven't seen both corrections before sending my last
message. :-)

 I recall reading somewhere that all division would be 'true division'
 from 3.0 but this isn't the case in 2.x is it?

There was also some kind of from future import true division method but I
don't remember where I found it.  Oh!  Found it!  

http://mail.python.org/pipermail/python-dev/2001-July/016174.html

 from __future__ import division
 42 / 250
0.16801
 


Be seeing you,
-- 
Jorge Godoy  [EMAIL PROTECTED]

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Percentage

2005-11-07 Thread Jorge Godoy
Pujo Aji [EMAIL PROTECTED] writes:

 don't forget to use dot or converge into float.

Or import division from __future__. 

 from __future__ import division
 42 / 250
0.16801
 

-- 
Jorge Godoy  [EMAIL PROTECTED]

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor