Re: Creating a reliable sandboxed Python environment

2015-05-25 Thread Paul Rubin
davidf...@gmail.com writes: > Has anyone on this list attempted to sandbox Python programs in a > serious fashion? I'd be interested to hear your approach. There is something like that for C++ and it is quite complicated: https://github.com/Eelis/geordi I expect that for Python you'd have to do

Re: a more precise distance algorithm

2015-05-25 Thread ravas
On Monday, May 25, 2015 at 10:16:02 PM UTC-7, Gary Herron wrote: > It's probably not the square root that's causing the inaccuracies. In > many other cases, and probably here also, it's the summing of two > numbers that have vastly different values that loses precision. A > demonstration: > >

Re: a more precise distance algorithm

2015-05-25 Thread Christian Gollwitzer
Am 26.05.15 um 05:11 schrieb Steven D'Aprano: mismatch after 3 trials naive: 767.3916150255787 alternate: 767.3916150255789 hypot: 767.3916150255787 which shows that: (1) It's not hard to find mismatches; (2) It's not obvious which of the three methods is more accurate. The main problem is

Re: a more precise distance algorithm

2015-05-25 Thread Gary Herron
On 05/25/2015 09:13 PM, ravas wrote: On Monday, May 25, 2015 at 8:11:25 PM UTC-7, Steven D'Aprano wrote: Let's compare three methods. ... which shows that: (1) It's not hard to find mismatches; (2) It's not obvious which of the three methods is more accurate. Thank you; that is very helpful!

Re: a more precise distance algorithm

2015-05-25 Thread ravas
Oh ya... true >_< Thanks :D On Monday, May 25, 2015 at 9:43:47 PM UTC-7, Ian wrote: > > def distance(A, B): > > """ > > A & B are objects with x and y attributes > > :return: the distance between A and B > > """ > > dx = B.x - A.x > > dy = B.y - A.y > > a = min(dx, dy)

Re: a more precise distance algorithm

2015-05-25 Thread Ian Kelly
On Mon, May 25, 2015 at 1:21 PM, ravas wrote: > I read an interesting comment: > """ > The coolest thing I've ever discovered about Pythagorean's Theorem is an > alternate way to calculate it. If you write a program that uses the distance > form c = sqrt(a^2 + b^2) you will suffer from the lose

Re: Documentaion of dunder methods

2015-05-25 Thread Ian Kelly
On Mon, May 25, 2015 at 8:17 PM, Steven D'Aprano wrote: > PEP 8 states that developers should never invent their own dunder methods: > > __double_leading_and_trailing_underscore__ : > "magic" objects or attributes that live in user-controlled > namespaces. E.g. __init__ , __imp

Re: a more precise distance algorithm

2015-05-25 Thread ravas
On Monday, May 25, 2015 at 8:11:25 PM UTC-7, Steven D'Aprano wrote: > Let's compare three methods. > ... > which shows that: > > (1) It's not hard to find mismatches; > (2) It's not obvious which of the three methods is more accurate. Thank you; that is very helpful! I'm curious: what about the

Re: Documentaion of dunder methods

2015-05-25 Thread Rustom Mody
On Tuesday, May 26, 2015 at 8:48:11 AM UTC+5:30, Steven D'Aprano wrote: > On Tue, 26 May 2015 12:17 pm, Steven D'Aprano wrote: > > > In other words, dunder methods are reserved for use by the core developers > > for the use of the Python interpreter. > > Er, that's easy to misinterpret. Let me tr

Re: Documentaion of dunder methods

2015-05-25 Thread Steven D'Aprano
On Tue, 26 May 2015 12:17 pm, Steven D'Aprano wrote: > In other words, dunder methods are reserved for use by the core developers > for the use of the Python interpreter. Er, that's easy to misinterpret. Let me try rewording: You should not invent new dunder methods. And if possible, you should

Re: a more precise distance algorithm

2015-05-25 Thread Steven D'Aprano
On Tue, 26 May 2015 05:21 am, ravas wrote: > I read an interesting comment: > """ > The coolest thing I've ever discovered about Pythagorean's Theorem is an > alternate way to calculate it. If you write a program that uses the > distance form c = sqrt(a^2 + b^2) you will suffer from the lose of ha

Re: Creating a reliable sandboxed Python environment

2015-05-25 Thread Chris Angelico
On Tue, May 26, 2015 at 12:24 PM, wrote: > I believe it is not possible to limit such operations at the Python level. > The best you could do is try replacing all the standard library modules, but > that is again just a blacklist - it won't prevent a determined attacker from > doing things lik

Re: Documentaion of dunder methods

2015-05-25 Thread Rustom Mody
On Tuesday, May 26, 2015 at 7:47:41 AM UTC+5:30, Steven D'Aprano wrote: > PEP 8 states that developers should never invent their own dunder methods: > > __double_leading_and_trailing_underscore__ : > "magic" objects or attributes that live in user-controlled > namespaces. E.g.

Creating a reliable sandboxed Python environment

2015-05-25 Thread davidfstr
I am writing a web service that accepts Python programs as input, runs the provided program with some profiling hooks, and returns various information about the program's runtime behavior. To do this in a safe manner, I need to be able to create a sandbox that restricts what the submitted Python

Documentaion of dunder methods

2015-05-25 Thread Steven D'Aprano
PEP 8 states that developers should never invent their own dunder methods: __double_leading_and_trailing_underscore__ : "magic" objects or attributes that live in user-controlled namespaces. E.g. __init__ , __import__ or __file__ . Never invent such names; only use th

Re: cl.exe missing

2015-05-25 Thread garyr
>> Where do I find VS2008? > > Try this: > > https://www.microsoft.com/en-gb/download/details.aspx?id=44266 > > TJG Yes, that's it. Many thanks. -- https://mail.python.org/mailman/listinfo/python-list

Re: msgfmt.py and pygettext.py are LGPL or LGPL-compatible?

2015-05-25 Thread Alan Evangelista
On 05/25/2015 08:13 PM, Chris Angelico wrote: On Tue, May 26, 2015 at 4:42 AM, Alan Evangelista wrote: https://docs.python.org/2/library/gettext.html suggests that I use msgfmt.py and pygettext.py, available at Python Subversion ( http://svn.python.org/view/python/trunk/Tools/i18n/). What licen

Re: msgfmt.py and pygettext.py are LGPL or LGPL-compatible?

2015-05-25 Thread Chris Angelico
On Tue, May 26, 2015 at 4:42 AM, Alan Evangelista wrote: > https://docs.python.org/2/library/gettext.html suggests that I use msgfmt.py > and pygettext.py, available > at Python Subversion ( http://svn.python.org/view/python/trunk/Tools/i18n/). > What license those executable > scripts use? Are th

Re: Why dropbox.client.DropboxClient.put_file needs file_obj as a parameter?

2015-05-25 Thread Zoran Ljubisic (mob)
Looks like you are right. Thanks for clarification. Regards. On May 25, 2015 10:02 PM, "Skip Montanaro" wrote: > Looks like the file_obj is what you are reading locally, and > magnum_opus.txt is the destination name on Dropbox. > > Skip > -- https://mail.python.org/mailman/listinfo/python-list

Re: a more precise distance algorithm

2015-05-25 Thread ravas
On Monday, May 25, 2015 at 1:27:43 PM UTC-7, Gary Herron wrote: > This is a statement about floating point numeric calculations on a > computer,. As such, it does apply to Python which uses the underlying > hardware for floating point calculations. > > Validity is another matter. Where did yo

Re: a more precise distance algorithm

2015-05-25 Thread ravas
On Monday, May 25, 2015 at 1:27:24 PM UTC-7, Christian Gollwitzer wrote: > Wrong. Just use the built-in function Math.hypot() - it should handle > these cases and also overflow, infinity etc. in the best possible way. > > Apfelkiste:~ chris$ python > Python 2.7.2 (default, Oct 11 2012, 20:14:37)

Re: a more precise distance algorithm

2015-05-25 Thread Christian Gollwitzer
Am 25.05.15 um 21:21 schrieb ravas: I read an interesting comment: """ The coolest thing I've ever discovered about Pythagorean's Theorem is an alternate way to calculate it. If you write a program that uses the distance form c = sqrt(a^2 + b^2) you will suffer from the lose of half of your av

Re: a more precise distance algorithm

2015-05-25 Thread Gary Herron
On 05/25/2015 12:21 PM, ravas wrote: I read an interesting comment: """ The coolest thing I've ever discovered about Pythagorean's Theorem is an alternate way to calculate it. If you write a program that uses the distance form c = sqrt(a^2 + b^2) you will suffer from the lose of half of your a

Re: a more precise distance algorithm

2015-05-25 Thread felix
El 25/05/15 15:21, ravas escribió: I read an interesting comment: """ The coolest thing I've ever discovered about Pythagorean's Theorem is an alternate way to calculate it. If you write a program that uses the distance form c = sqrt(a^2 + b^2) you will suffer from the lose of half of your ava

Re: Why dropbox.client.DropboxClient.put_file needs file_obj as a parameter?

2015-05-25 Thread Skip Montanaro
Looks like the file_obj is what you are reading locally, and magnum_opus.txt is the destination name on Dropbox. Skip -- https://mail.python.org/mailman/listinfo/python-list

a more precise distance algorithm

2015-05-25 Thread ravas
I read an interesting comment: """ The coolest thing I've ever discovered about Pythagorean's Theorem is an alternate way to calculate it. If you write a program that uses the distance form c = sqrt(a^2 + b^2) you will suffer from the lose of half of your available precision because the square r

Why dropbox.client.DropboxClient.put_file needs file_obj as a parameter?

2015-05-25 Thread zljubisicmob
Hi as I can see dropbox.client.DropboxClient.put_file has four parameters: " full_path The full path to upload the file to, including the file name. If the destination folder does not yet exist, it will be created. file_obj A file-like object to upload. If you would like,

msgfmt.py and pygettext.py are LGPL or LGPL-compatible?

2015-05-25 Thread Alan Evangelista
https://docs.python.org/2/library/gettext.html suggests that I use msgfmt.py and pygettext.py, available at Python Subversion ( http://svn.python.org/view/python/trunk/Tools/i18n/). What license those executable scripts use? Are they LGPL? I want to convert these executables to Python modules a

Re: Extract email address from Java script in html source using python

2015-05-25 Thread Denis McMahon
On Sat, 23 May 2015 12:16:06 +0530, savitha devi wrote: > I am developing a web scraper code using HTMLParser. I need to extract > text/email address from java script with in the HTMLCode.I am beginner > level in python coding and totally lost here. Need some help on this. (a) Try a less ambitiou

Re: cl.exe missing

2015-05-25 Thread Tim Golden
On 25/05/2015 16:19, garyr wrote: I posted this on the Anaconda NG but haven't gotten an answer. I recently installed Python 2.7 using Miniconda. I'm now trying to build a Python extension module. My setup.py file is: from distutils.core import setup, Extension module1 = Extension('pyssoun

cl.exe missing

2015-05-25 Thread garyr
I posted this on the Anaconda NG but haven't gotten an answer. I recently installed Python 2.7 using Miniconda. I'm now trying to build a Python extension module. My setup.py file is: from distutils.core import setup, Extension module1 = Extension('pyssound', sources=['ssound.cpp', 'pysso

Re: Query on Python 3.2 and supported OpenSSL Versions

2015-05-25 Thread Simon Ward
On Mon, May 25, 2015 at 09:33:06AM +, Donal Duane wrote: > > Hi Python Users, > > I was hoping you might be able to assist me with a query: > > 2 Questions: > > > 1. Could Python 3.2, when compiled against OpenSSL 1.0.0j, be > affected by the poodle bug? > https://www.openssl.org/~bo

Re: Query on Python 3.2 and supported OpenSSL Versions

2015-05-25 Thread Chris Angelico
On Mon, May 25, 2015 at 7:33 PM, Donal Duane wrote: > > Hi Python Users, > > I was hoping you might be able to assist me with a query: > > 2 Questions: > > 1. Could Python 3.2, when compiled against OpenSSL 1.0.0j, be affected > by the poodle bug? https://www.openssl.org/~bodo/ssl-poodle.pd

Re: Ah Python, you have spoiled me for all other languages

2015-05-25 Thread Chris Angelico
On Mon, May 25, 2015 at 7:39 PM, Laura Creighton wrote: > What people need to understand is that unless you want to stamp out > freedom altogether, there will be crime. Or stamp out legislation altogether and have complete anarchy. There's no such thing as crime among animals, because there's no

Query on Python 3.2 and supported OpenSSL Versions (fwd)

2015-05-25 Thread Laura Creighton
This showed up on Python list. --- Forwarded Message Return-Path: Received: from mail.python.org (mail.python.org [82.94.164.166]) From: Donal Duane To: "python-list@python.org" Subject: Query on Python 3.2 and supported OpenSSL Versions Cc: Alex Ying , Anthony McMahon Hi Pytho

Query on Python 3.2 and supported OpenSSL Versions

2015-05-25 Thread Donal Duane
Hi Python Users, I was hoping you might be able to assist me with a query: 2 Questions: 1. Could Python 3.2, when compiled against OpenSSL 1.0.0j, be affected by the poodle bug? https://www.openssl.org/~bodo/ssl-poodle.pdf 2. If yes - are the following OpenSSL versions approve

Re: Ah Python, you have spoiled me for all other languages

2015-05-25 Thread Laura Creighton
In a message of Mon, 25 May 2015 09:57:28 +0300, Marko Rauhamaa writes: >Certificates can be revoked, kinda, yes. Or more to the point, >roadblocks could be put in the way of certifying some applicants. >However, if that started happening, the OS and browser makers would >simply drop the obnoxious

Re: Ah Python, you have spoiled me for all other languages

2015-05-25 Thread Marko Rauhamaa
Chris Angelico : > You've added extra levels of indirection, but it comes to the same > thing. You're requiring that everyone who wants to conduct business on > the internet (taking credit card numbers etc) has to go through four > separate authentication processes, and a failure in any one of the