Re: [Tutor] Virtual environment question

2018-03-12 Thread Mats Wichmann
you are talking about different sides of isolation. you install into a 
virtualenv and those pkgs don't go into the system area. that says nothing 
about using existing bits of the system...

On March 12, 2018 6:31:47 PM PDT, Jim  wrote:
>On 03/12/2018 04:04 AM, eryk sun wrote:
>> On Mon, Mar 12, 2018 at 12:44 AM, Jim  wrote:
>>>
>>> home = /usr/bin
>>> include-system-site-packages = false
>> [...]
>>>  resp = opener.open(request, timeout=self._timeout)
>>>File "/usr/lib/python3.5/urllib/request.py", line 466, in open
>> 
>> This is normal. Virtual environments are not isolated from the
>standard library.
>
>Interesting. All I know about virtual environments is what I read on
>the 
>net. I always see them recommended as a way to keep from messing up the
>
>default python, so I thought isolation was their purpose.
>
>Thanks,  Jim
>
>
>___
>Tutor maillist  -  Tutor@python.org
>To unsubscribe or change subscription options:
>https://mail.python.org/mailman/listinfo/tutor

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Virtual environment question

2018-03-12 Thread eryk sun
On Tue, Mar 13, 2018 at 1:31 AM, Jim  wrote:
> On 03/12/2018 04:04 AM, eryk sun wrote:
>>
>> On Mon, Mar 12, 2018 at 12:44 AM, Jim  wrote:
>>>
>>> home = /usr/bin
>>> include-system-site-packages = false
>>
>> [...]
>>>
>>>  resp = opener.open(request, timeout=self._timeout)
>>>File "/usr/lib/python3.5/urllib/request.py", line 466, in open
>>
>> This is normal. Virtual environments are not isolated from the standard
>> library.
>
> Interesting. All I know about virtual environments is what I read on the
> net. I always see them recommended as a way to keep from messing up the
> default python, so I thought isolation was their purpose.

You're thinking of isolating packages that are installed in
site-packages, not the standard library. There's no point in copying
and recompiling the entire standard library in every virtual
environment.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Virtual environment question

2018-03-12 Thread Jim

On 03/12/2018 04:04 AM, eryk sun wrote:

On Mon, Mar 12, 2018 at 12:44 AM, Jim  wrote:


home = /usr/bin
include-system-site-packages = false

[...]

 resp = opener.open(request, timeout=self._timeout)
   File "/usr/lib/python3.5/urllib/request.py", line 466, in open


This is normal. Virtual environments are not isolated from the standard library.


Interesting. All I know about virtual environments is what I read on the 
net. I always see them recommended as a way to keep from messing up the 
default python, so I thought isolation was their purpose.


Thanks,  Jim


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


Re: [Tutor] prime factorisation

2018-03-12 Thread Bruce Todd Puls
I think You would do much better if You wrote pseudo code first,
i.e. write each step out in words,
code is much easier to write following pseudo code

Are You trying to factor Prime Numbers?
Prime Number factored (Prime Number and 1)


https://en.wikipedia.org/wiki/Table_of_prime_factors#1_to_100

https://www.mathsisfun.com/prime-factorization.html
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] prime factorisation

2018-03-12 Thread Steven D'Aprano
Hello Bernd,

My comments below, interleaved with yours.

On Sun, Mar 11, 2018 at 04:23:02PM +0100, Bernd Hewener wrote:

> Functions for reading in the number and finding the primes are working 
> alright (of Course, finding primes up to ½ Number would suffice).

Actually you only need to go up to square root of the number.

> Still, the function for finding the factorization itsel does not work. 
> I am not sure, but the number i running through the primes for 
> checking does not seem to work properly.

What do you mean, does not work? In what way?

When you run the code, what does it do?


Some further comments:

[...]
> def readin():
> print ("Readin")
> while True:
> num = input("Please enter a positive integer n for prime 
> factorization. ")
> try:
> n = int(num)
> return n
> except ValueError or num < 1:
> print("Please enter a _positive_ integer!")
> else:
> break

That code doesn't actually do what you think it does. In fact, it is an 
accident that it works at all!

The problem is the line

except ValueError or num < 1

which does *not* catch a ValueError and check that num is less than one. 
Instead, it evaluates to just catching ValueError. So it never checks 
that the entered number is positive.



Regards,



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


Re: [Tutor] Virtual environment question

2018-03-12 Thread eryk sun
On Mon, Mar 12, 2018 at 12:44 AM, Jim  wrote:
>
> home = /usr/bin
> include-system-site-packages = false
[...]
> resp = opener.open(request, timeout=self._timeout)
>   File "/usr/lib/python3.5/urllib/request.py", line 466, in open

This is normal. Virtual environments are not isolated from the standard library.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor