Unacceptable behavior

2016-04-06 Thread Ethan Furman
On 04/05/2016 01:05 PM, Thomas 'PointedEars' Lahn wrote: > | >>> from email import ID10T Thomas, as has been pointed out to you in previous threads it is not necessary to be rude to be heard. You are hereby placed in moderation for the Python List mailing list. Every one else: If you see of

Re: recursive methods require implementing a stack?

2016-04-06 Thread Charles T. Smith
On Wed, 06 Apr 2016 20:28:47 +, Rob Gaddi wrote: > Charles T. Smith wrote: > >> I just tried to write a recursive method in python - am I right that local >> variables are only lexically local scoped, so sub-instances have the same >> ones? Is there a way out of that? Do I have to push and

Re: Unicode normalisation [was Re: [beginner] What's wrong?]

2016-04-06 Thread Marko Rauhamaa
Steven D'Aprano : > So even in English, capitalisation can make a semantic difference. It can even make a pronunciation difference: polish vs Polish. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Rolf Camps : > Op 07-04-16 om 00:03 schreef Marko Rauhamaa: >> IOW, if I have this class: >> >> class A: >> def f(self): >> print("f") >> >> and this object: >> >> a = A() >> >> then, >> >> a.f >> >> is a function that doesn't have a self argument. That functio

Re: Joining Strings

2016-04-06 Thread Jussi Piitulainen
Emeka writes: > Hello All, > > import urllib.request > import re > > url = 'https://www.everyday.com/ > > > > req = urllib.request.Request(url) > resp = urllib.request.urlopen(req) > respData = resp.read() > > > paragraphs = re.findall(r'\[(.*?)\]',str(respData)) > for eachP in paragraphs: > p

Re: Untrusted code execution

2016-04-06 Thread Steven D'Aprano
On Thursday 07 April 2016 13:40, Random832 wrote: > On Wed, Apr 6, 2016, at 21:45, Steven D'Aprano wrote: >> And you would have to do something about the unfortunate matter that >> modules >> have a reference to the unrestricted __builtins__: >> >> py> os.__builtins__['eval'] >> > > Well, I tho

Re: Untrusted code execution

2016-04-06 Thread Random832
On Wed, Apr 6, 2016, at 21:45, Steven D'Aprano wrote: > And you would have to do something about the unfortunate matter that > modules > have a reference to the unrestricted __builtins__: > > py> os.__builtins__['eval'] > Well, I thought that the solution being discussed uses AST to generally fo

Re: Evaluating error strings for 'unittest' assert methods.

2016-04-06 Thread Steven D'Aprano
On Thu, 7 Apr 2016 08:58 am, John Pote wrote: [...] > I like each assert...() to output helpful information when things go > wrong. So I have put in quite complicated code to generate the error > string the assert() method uses only when things go wrong. The normal > case, when everything is worki

Re: Untrusted code execution

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 11:45 AM, Steven D'Aprano wrote: > And you would have to do something about the unfortunate matter that modules > have a reference to the unrestricted __builtins__: > > py> os.__builtins__['eval'] > This *in itself* is blocked by the rule against leading-underscore attribu

Re: Untrusted code execution

2016-04-06 Thread Steven D'Aprano
On Wed, 6 Apr 2016 11:14 pm, Random832 wrote: > On Tue, Apr 5, 2016, at 21:43, Steven D'Aprano wrote: >> As Zooko says, Guido's "best argument is that reducing usability (in >> terms >> of forbidding language features, especially module import) and reducing >> the >> usefulness of extant library c

Re: Promoting Python

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 5:30 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> This is the exact sort of shenanigans that it takes to convert >> recursion into tail recursion - and in MOST cases, it's very little >> effort to go from there to explicit while loops. That's why TCE is so >> infrequent

Re: Best Practices for Internal Package Structure

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 5:37 AM, Sven R. Kunze wrote: > On 06.04.2016 01:47, Chris Angelico wrote: >> >> Generally, I refactor code not because the files are getting "too >> large" (for whatever definition of that term you like), but because >> they're stretching the file's concept. Every file shou

Unicode normalisation [was Re: [beginner] What's wrong?]

2016-04-06 Thread Steven D'Aprano
On Thu, 7 Apr 2016 05:56 am, Thomas 'PointedEars' Lahn wrote: > Rustom Mody wrote: >> So here are some examples to illustrate what I am saying: >> >> Example 1 -- Ligatures: >> >> Python3 gets it right > flag = 1 > flag >> 1 Python identifiers are intentionally normalised to reduce secu

Re: Promoting Python

2016-04-06 Thread Rolf Camps
Op 07-04-16 om 00:03 schreef Marko Rauhamaa: Once you look up an object method, it doesn't have a self argument. The self argument is cooked up for the benefit of the function definition in the class. IOW, if I have this class: class A: def f(self): print("f") and

Re: ola

2016-04-06 Thread Joel Goldstick
2016-04-05 20:35 GMT-04:00 majoxd hola : > me podrían enviar el programa Python spyder para Windows? > > > > > > > > > Enviado desde Correo de Windows > -- > https://mail.python.org/mailman/listinfo/python-list This is an english language list. And besides, your question I could send the Python p

Re: Joining Strings

2016-04-06 Thread Ben Finney
Emeka writes: > Hello All, > > import urllib.request > import re > > url = 'https://www.everyday.com/ This URL doesn't resolve for me, so I can't reproduce the behaviour. > I got the below: > "Coke - Yala Market Branch""NO. 113 IKU BAKR WAY YALA""" > But what I need is > > 'Coke - Yala Market

Re: [beginner] What's wrong?

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 5:56 AM, Thomas 'PointedEars' Lahn wrote: >> Example 1 -- Ligatures: >> >> Python3 gets it right > flag = 1 > flag >> 1 > > Fascinating; confirmed with > > | $ python3 > | Python 3.4.4 (default, Jan 5 2016, 15:35:18) > | [GCC 5.3.1 20160101] on linux > | […] > > I do

Joining Strings

2016-04-06 Thread Emeka
Hello All, import urllib.request import re url = 'https://www.everyday.com/ req = urllib.request.Request(url) resp = urllib.request.urlopen(req) respData = resp.read() paragraphs = re.findall(r'\[(.*?)\]',str(respData)) for eachP in paragraphs: print("".join(eachP.split(',')[1:-2]))

import opencv error (DLL load failed)

2016-04-06 Thread Xristos Xristoou
hi i have windows 10 and python 3.5.1 and i want to install open cv. first i go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv and download the opencv_python-3.1.0-cp35-none-win_amd64.whl from command prompt i install with pip. pip install \opencv_python-3.1.0-cp35-none-win_amd64.whl and sho

Re: Evaluating error strings for 'unittest' assert methods.

2016-04-06 Thread Ethan Furman
On 04/06/2016 03:58 PM, John Pote wrote: I have been writing a very useful test script using the standard Python 'unittest' module. This works fine and has been a huge help in keeping the system I've been writing fully working even when I make changes that could break many features of the system.

Re: functools puzzle

2016-04-06 Thread Michael Selik
On Wed, Apr 6, 2016 at 8:16 PM George Trojan - NOAA Federal < george.tro...@noaa.gov> wrote: > My basic question is how to document functions created by > functools.partial, such that the documentation can be viewed not only by > reading the code. Of course, as the last resort, I could create my o

ola

2016-04-06 Thread majoxd hola
me podrían enviar el programa Python spyder para Windows? Enviado desde Correo de Windows -- https://mail.python.org/mailman/listinfo/python-list

Evaluating error strings for 'unittest' assert methods.

2016-04-06 Thread John Pote
I have been writing a very useful test script using the standard Python 'unittest' module. This works fine and has been a huge help in keeping the system I've been writing fully working even when I make changes that could break many features of the system. eg major rewrite of the interrupt rout

Re: Promoting Python

2016-04-06 Thread BartC
On 06/04/2016 21:38, Mark Lawrence wrote: No it didn't, it was quite clear from the beginning that he knew squat, and since then he's admitted that he knows squat. About Python. I see. According to you: (1) To have an opinion about a language, you have to know everything in it 100%, inside

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Ian Kelly : > On Wed, Apr 6, 2016 at 2:39 PM, Marko Rauhamaa wrote: >> Not convinced. Probably just an oversight. > > It's documented here: > https://docs.python.org/3/reference/datamodel.html#special-method-lookup Ok, not an oversight but some inherent trouble with the way object methods are re

Re: recursive methods require implementing a stack?

2016-04-06 Thread Carl Meyer
On 04/06/2016 03:08 PM, Random832 wrote: > On Wed, Apr 6, 2016, at 16:21, Charles T. Smith wrote: >> I just tried to write a recursive method in python - am I right that >> local >> variables are only lexically local scoped, so sub-instances have the same >> ones? Is there a way out of that? Do I

Re: Promoting Python

2016-04-06 Thread Ian Kelly
On Wed, Apr 6, 2016 at 2:39 PM, Marko Rauhamaa wrote: > Ian Kelly : > >> On Wed, Apr 6, 2016 at 1:59 PM, Marko Rauhamaa wrote: >>> It seems to me CPython is being a bit too picky here. Why should it >>> care if the method is a class method or an object method? >> >> Because the purpose of a class

Re: recursive methods require implementing a stack?

2016-04-06 Thread Random832
On Wed, Apr 6, 2016, at 16:21, Charles T. Smith wrote: > I just tried to write a recursive method in python - am I right that > local > variables are only lexically local scoped, so sub-instances have the same > ones? Is there a way out of that? Do I have to push and pop my own > simulated > stac

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Ian Kelly : > On Wed, Apr 6, 2016 at 1:59 PM, Marko Rauhamaa wrote: >> It seems to me CPython is being a bit too picky here. Why should it >> care if the method is a class method or an object method? > > Because the purpose of a class is to define the behavior of its > instances. A function store

Re: Promoting Python

2016-04-06 Thread Mark Lawrence via Python-list
On 06/04/2016 18:55, Ned Batchelder wrote: It took us a while to understand where Bart was coming from, but now we understand, and we don't have to go around in circles. No it didn't, it was quite clear from the beginning that he knew squat, and since then he's admitted that he knows squat.

Re: recursive methods require implementing a stack?

2016-04-06 Thread Rob Gaddi
Charles T. Smith wrote: > I just tried to write a recursive method in python - am I right that local > variables are only lexically local scoped, so sub-instances have the same > ones? Is there a way out of that? Do I have to push and pop my own simulated > stack frame entry? You have been bad

Re: Promoting Python

2016-04-06 Thread Ian Kelly
On Wed, Apr 6, 2016 at 1:59 PM, Marko Rauhamaa wrote: > Ian Kelly : > >> On Wed, Apr 6, 2016 at 1:22 PM, Marko Rauhamaa wrote: >>> Why is a SimpleNamespace object not an iterator even though it >>> provides __iter__ and __next__? >> >> Because Python expects those methods to be defined in the cla

recursive methods require implementing a stack?

2016-04-06 Thread Charles T. Smith
I just tried to write a recursive method in python - am I right that local variables are only lexically local scoped, so sub-instances have the same ones? Is there a way out of that? Do I have to push and pop my own simulated stack frame entry? -- https://mail.python.org/mailman/listinfo/python

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Terry Reedy : > On 4/6/2016 10:14 AM, Marko Rauhamaa wrote: > >> Seriously, Python wouldn't be, couldn't be Turing-complete without >> "while" (mainly because it doesn't support tail-recursion >> elimination). >> >> Now, if Python had an unlimited range() iterator/iterable, you could >> use a "for

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Ian Kelly : > On Wed, Apr 6, 2016 at 1:22 PM, Marko Rauhamaa wrote: >> Why is a SimpleNamespace object not an iterator even though it >> provides __iter__ and __next__? > > Because Python expects those methods to be defined in the class dict, > not the instance dict. The documentation does state

Re: [beginner] What's wrong?

2016-04-06 Thread Thomas 'PointedEars' Lahn
Rustom Mody wrote: > On Sunday, April 3, 2016 at 5:17:36 PM UTC+5:30, Thomas 'PointedEars' Lahn > wrote: >> Rustom Mody wrote: >> > When python went to full unicode identifers it should have also added >> > pragmas for which blocks the programmer intended to use -- something >> > like a charset de

Re: Promoting Python

2016-04-06 Thread Terry Reedy
On 4/6/2016 10:14 AM, Marko Rauhamaa wrote: Seriously, Python wouldn't be, couldn't be Turing-complete without "while" (mainly because it doesn't support tail-recursion elimination). Now, if Python had an unlimited range() iterator/iterable, you could use a "for" statement to emulate "while".

Re: good way to avoid recomputations?

2016-04-06 Thread mauricioliveiraguarda
Hi Erik. It's an Excel file. Thanks for the suggestions. Will check them. - Maurice -- https://mail.python.org/mailman/listinfo/python-list

Re: Promoting Python

2016-04-06 Thread Ian Kelly
On Wed, Apr 6, 2016 at 1:22 PM, Marko Rauhamaa wrote: > However, BartC's No-Buzzword Python doesn't have classes... If he > allowed for types.SimpleNamespace, we could have: > > > import types > > def While(predicate): >

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Chris Angelico : > This is the exact sort of shenanigans that it takes to convert > recursion into tail recursion - and in MOST cases, it's very little > effort to go from there to explicit while loops. That's why TCE is so > infrequently important that it's just not worth the cost - which in > th

Re: Best Practices for Internal Package Structure

2016-04-06 Thread Sven R. Kunze
On 06.04.2016 01:47, Chris Angelico wrote: Generally, I refactor code not because the files are getting "too large" (for whatever definition of that term you like), but because they're stretching the file's concept. Every file should have a purpose; every piece of code in that file should ideally

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Ian Kelly : > On Wed, Apr 6, 2016 at 8:14 AM, Marko Rauhamaa wrote: >> Now, if Python had an unlimited range() iterator/iterable, you could use >> a "for" statement to emulate "while". > > You can already do this. > class While: > ... def __init__(self, predicate): > ... self._pr

Re: functools puzzle

2016-04-06 Thread George Trojan - NOAA Federal
True, but the pure Python and C implementation differ. Is that intentional? I find the current behaviour confusing. The doc states only that partial object does not set the __doc__ attribute, not that the attribute might be ignored. I had a peek at the pydoc module. It uses inspect to determine th

Re: Best Practices for Internal Package Structure

2016-04-06 Thread Sven R. Kunze
On 06.04.2016 09:28, Michael Selik wrote: On Wed, Apr 6, 2016, 2:51 AM Steven D'Aprano wrote: On Wed, 6 Apr 2016 05:56 am, Michael Selik wrote: [Michael] When you made that suggestion earlier, I immediately guessed that you were using PyCharm. I agree that the decision to split into multip

Re: Promoting Python

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 4:44 AM, Random832 wrote: > On Wed, Apr 6, 2016, at 14:23, Marko Rauhamaa wrote: >> Chris Angelico : >> >> > Plus, anyone could implement a Python interpreter with TCE. >> >> Tricky in practice because None is the default return value. >> >> If the programmer were careful to

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Random832 : > On Wed, Apr 6, 2016, at 14:23, Marko Rauhamaa wrote: >> Chris Angelico : >> > Plus, anyone could implement a Python interpreter with TCE. >> >> Tricky in practice because None is the default return value. >> >> If the programmer were careful to return the value of the tail call, >>

Re: WP-A: A New URL Shortener

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 4:42 AM, Thomas 'PointedEars' Lahn wrote: > Chris Angelico wrote: > >> In other words, you are assuming that the string escaping *in the >> module* is buggy. Well, duh. This is exactly what I said about not >> having stupid bugs. The developer of a MySQL binding library shou

Re: Promoting Python

2016-04-06 Thread Ian Kelly
On Wed, Apr 6, 2016 at 8:14 AM, Marko Rauhamaa wrote: > Now, if Python had an unlimited range() iterator/iterable, you could use > a "for" statement to emulate "while". You can already do this. >>> class While: ... def __init__(self, predicate): ... self._predicate = predicate ...

Re: WP-A: A New URL Shortener

2016-04-06 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote: > In other words, you are assuming that the string escaping *in the > module* is buggy. Well, duh. This is exactly what I said about not > having stupid bugs. The developer of a MySQL binding library should > know the *entire* rules for escaping, and, duh, that's going to > i

Re: functools puzzle

2016-04-06 Thread Michael Selik
> On Apr 6, 2016, at 6:57 PM, George Trojan - NOAA Federal > wrote: > > The module functools has partial() defined as above, then overrides the > definition by importing partial from _functools. That would explain the > above behaviour. My question is why? A couple speculations why an author m

Re: Promoting Python

2016-04-06 Thread Random832
On Wed, Apr 6, 2016, at 14:23, Marko Rauhamaa wrote: > Chris Angelico : > > > Plus, anyone could implement a Python interpreter with TCE. > > Tricky in practice because None is the default return value. > > If the programmer were careful to return the value of the tail call, it > can be eliminat

Re: Untrusted code execution

2016-04-06 Thread Random832
On Wed, Apr 6, 2016, at 12:04, Chris Angelico wrote: > On Thu, Apr 7, 2016 at 1:41 AM, Ian Kelly wrote: > > type might also be a concern since it can be used to assemble > > arbitrary classes. > > Sadly, this means denying the ability to interrogate an object for its > type. And no, this won't do

Re: Checking function's parameters (type, value) or not ?

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 3:36 AM, Michael Selik wrote: > However, you might want to protect them from a subtle infinite loop or other > traps that are tough to recover from. If it's an obvious infinity, well, > that's their own fault. For example, ``range`` stops you from a zero > step-size, but

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Chris Angelico : > Plus, anyone could implement a Python interpreter with TCE. Tricky in practice because None is the default return value. If the programmer were careful to return the value of the tail call, it can be eliminated. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: functools puzzle

2016-04-06 Thread Peter Otten
George Trojan - NOAA Federal wrote: > Here is my test program: > > ''' generic test ''' > > import functools > import inspect > > def f(): > '''I am f''' > pass > > g = functools.partial(f) > g.__doc__ = '''I am g''' > g.__name__ = 'g' > > def partial(func, *args, **keywords): > d

Re: Promoting Python

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 3:40 AM, Steven D'Aprano wrote: >> I fully agree. But you don't have to use classes, exceptions, >> decorators, generators, iterators, closures, comprehensions, meta >> classes, ... the list of meaningless buzzwords just goes on. > > Honestly, hearing you say that makes you

Re: Promoting Python

2016-04-06 Thread Ned Batchelder
On Wednesday, April 6, 2016 at 10:40:36 AM UTC-4, Mark Lawrence wrote: > On 06/04/2016 15:34, Ned Batchelder wrote: > > No, please, let's not ask BartC to list these features. We've already > > well established Bart's point of view, let's not revisit this debate. > > He prefers very different lang

functools puzzle

2016-04-06 Thread George Trojan - NOAA Federal
Here is my test program: ''' generic test ''' import functools import inspect def f(): '''I am f''' pass g = functools.partial(f) g.__doc__ = '''I am g''' g.__name__ = 'g' def partial(func, *args, **keywords): def newfunc(*fargs, **fkeywords): newkeywords = keywords.copy()

Re: Promoting Python

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 3:04 AM, BartC wrote: > >> I get a very strong impression >> that you've never had to maintain appalingly written code. The overuse >> of GOTO will certainly help in that area. > > > (I've not defending its use, but there are good reasons for retaining it. > > Suppose you h

Re: Checking function's parameters (type, value) or not ?

2016-04-06 Thread ast
"Chris Angelico" a écrit dans le message de news:mailman.13.1459955565.1197.python-l...@python.org... On Thu, Apr 7, 2016 at 12:18 AM, ast wrote: "Mark Lawrence" a écrit dans le message de news:mailman.131.1459949361.32530.python-l...@python.org... On 06/04/2016 14:07, ast wrote: Ru

Re: Promoting Python

2016-04-06 Thread Steven D'Aprano
On Wed, 6 Apr 2016 09:06 pm, BartC wrote: > On 05/04/2016 06:48, Gordon( Hotmail ) wrote: >> The problem I am finding is most of the sites claiming to help understand >> Python devote far too much space bragging about the wonders of Python >> instead of... I'd like to see these sites. I suspect

Re: Checking function's parameters (type, value) or not ?

2016-04-06 Thread Michael Selik
> On Apr 6, 2016, at 2:07 PM, ast wrote: > > I would like to know if it is advised or not to test > a function's parameters before running it, e.g > for functions stored on a public library ? > > def to_base(nber, base=16, use_af=True, sep=''): > assert isinstance(nber, int) and nber >= 0 >

Re: Promoting Python

2016-04-06 Thread BartC
On 06/04/2016 15:20, Mark Lawrence wrote: On 06/04/2016 14:54, BartC wrote: Please state why you're still here if Python is such a poorly designed language that it doesn't fit your needs. I was replying to the OP who was being put off the language. The vast majority have to choose an off-th

Re: Untrusted code execution

2016-04-06 Thread Ian Kelly
On Wed, Apr 6, 2016 at 10:04 AM, Chris Angelico wrote: > On Thu, Apr 7, 2016 at 1:41 AM, Ian Kelly wrote: >> type might also be a concern since it can be used to assemble >> arbitrary classes. > > Sadly, this means denying the ability to interrogate an object for its > type. And no, this won't do

Re: Checking function's parameters (type, value) or not ?

2016-04-06 Thread Steven D'Aprano
On Wed, 6 Apr 2016 11:07 pm, ast wrote: > Hello > > I would like to know if it is advised or not to test > a function's parameters before running it, e.g > for functions stored on a public library ? It depends. Sometimes it is best to do an explicit type check, sometimes it is better to call a b

Re: numpy arrays

2016-04-06 Thread Heli
Thanks for your replies. I have a question in regard with my previous question. I have a file that contains x,y,z and a value for that coordinate on each line. Here I am giving an example of the file using a numpy array called f. f=np.array([[1,1,1,1], [1,1,2,2], [1,1,3

Re: mod_wsgi not compatible with Wamp 2.4 and python 3.4.3

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 1:47 AM, justin walters wrote: > I did some quick googling for you because I wasn't sure if Apache could run > mod_php and mod_wsgi together. Apparently it can. See this google search: > https://www.google.com/search?client=ubuntu&channel=fs&q=can+apache+run+mod_php+and+mod_

Re: Untrusted code execution

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 1:41 AM, Ian Kelly wrote: > type might also be a concern since it can be used to assemble > arbitrary classes. Sadly, this means denying the ability to interrogate an object for its type. And no, this won't do: def safe_type(obj): return type(obj) because all you need is

Re: mod_wsgi not compatible with Wamp 2.4 and python 3.4.3

2016-04-06 Thread justin walters
On Wed, Apr 6, 2016 at 3:57 AM, asimkon . wrote: > I managed to connect Apache 2.2 with django framework successfully using > Python 2.7 and mod_wsgi.so (Apache module) thanks to the instructions from > https://pusonchen.wordpress.com/2013/06/03/build-django-website-with-apache-mod_wsgi-on-window

Re: Untrusted code execution

2016-04-06 Thread Ian Kelly
On Tue, Apr 5, 2016 at 7:43 PM, Steven D'Aprano wrote: > I think Jon is on the right approach here for restricting evaluation of > evaluation, which is a nicely constrained and small subset of Python. He's > not allowing unrestricted arbitrary code execution: he has a very > restricted (too restri

Re: Checking function's parameters (type, value) or not ?

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 12:18 AM, ast wrote: > "Mark Lawrence" a écrit dans le message de > news:mailman.131.1459949361.32530.python-l...@python.org... >> >> On 06/04/2016 14:07, ast wrote: > > >> >> Please see >> http://ftp.dev411.com/t/python/python-list/13bhcknhan/when-to-use-assert >> > > > Th

Re: Promoting Python

2016-04-06 Thread Mark Lawrence via Python-list
On 06/04/2016 15:34, Ned Batchelder wrote: On Wednesday, April 6, 2016 at 10:25:13 AM UTC-4, Mark Lawrence wrote: On 06/04/2016 14:54, BartC wrote: On 06/04/2016 12:46, Marko Rauhamaa wrote: BartC : It'll cope with ordinary coding as well, although such programs seem to be frowned upon here

Re: Promoting Python

2016-04-06 Thread Larry Martell
On Wed, Apr 6, 2016 at 10:08 AM, Marko Rauhamaa wrote: > BartC : > >> But you're right in that little is actually essential. Basic has shown >> that. >> >> You need expressions, IF, GOTO, variables and assignments, and some >> means of doing I/O. >> >> Pretty much every language has (had) those, a

Re: Promoting Python

2016-04-06 Thread Ned Batchelder
On Wednesday, April 6, 2016 at 10:25:13 AM UTC-4, Mark Lawrence wrote: > On 06/04/2016 14:54, BartC wrote: > > On 06/04/2016 12:46, Marko Rauhamaa wrote: > >> BartC : > > > >>> It'll cope with ordinary coding as well, although such programs seem > >>> to be frowned upon here; they are not 'Pythonic

Re: Promoting Python

2016-04-06 Thread Mark Lawrence via Python-list
On 06/04/2016 14:54, BartC wrote: On 06/04/2016 12:46, Marko Rauhamaa wrote: BartC : It'll cope with ordinary coding as well, although such programs seem to be frowned upon here; they are not 'Pythonic'. I wonder what is left of Python after your list of exclusions. There are plenty of fe

Re: Checking function's parameters (type, value) or not ?

2016-04-06 Thread ast
"Mark Lawrence" a écrit dans le message de news:mailman.131.1459949361.32530.python-l...@python.org... On 06/04/2016 14:07, ast wrote: Please see http://ftp.dev411.com/t/python/python-list/13bhcknhan/when-to-use-assert Thanks for this paper Running Python with the -O or -OO optimizat

Re: Promoting Python

2016-04-06 Thread Chris Angelico
On Thu, Apr 7, 2016 at 12:14 AM, Marko Rauhamaa wrote: > Seriously, Python wouldn't be, couldn't be Turing-complete without > "while" (mainly because it doesn't support tail-recursion elimination). Side point: Turing completeness actually assumes a mythical Turing machine with infinite memory. So

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Michael Selik : > On Wed, Apr 6, 2016, 12:51 PM Marko Rauhamaa wrote: > >> Really, there's only one high-level construct you can't live without: >> the "while" statement. Virtually every Python program has at least >> one "while" statement, and in general, it is unavoidable. >> >> Basic programs,

Re: Promoting Python

2016-04-06 Thread Chris Angelico
On Wed, Apr 6, 2016 at 11:54 PM, BartC wrote: > There are plenty of features that /I/ consider must-have, which Python > doesn't have. It has to emulate them, unsatisfactorily, with variables or > classes or functions, or do without. Blub's Paradox epitomized. > But you're right in that little i

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
BartC : > But you're right in that little is actually essential. Basic has shown > that. > > You need expressions, IF, GOTO, variables and assignments, and some > means of doing I/O. > > Pretty much every language has (had) those, although it's fashionable > now to do away with GOTO, and some are

Re: Promoting Python

2016-04-06 Thread BartC
On 06/04/2016 12:46, Marko Rauhamaa wrote: BartC : It'll cope with ordinary coding as well, although such programs seem to be frowned upon here; they are not 'Pythonic'. I wonder what is left of Python after your list of exclusions. There are plenty of features that /I/ consider must-have,

Re: Promoting Python

2016-04-06 Thread Michael Selik
On Wed, Apr 6, 2016, 12:51 PM Marko Rauhamaa wrote: > BartC : > Really, there's only one high-level construct you can't live without: > the "while" statement. Virtually every Python program has at least one > "while" statement, and in general, it is unavoidable. > > Basic programs, on the other h

Re: Set type for datetime intervals

2016-04-06 Thread Martin A. Brown
>> Sorry to be late to the party--I applaud that you have already >> crafted something to attack your problem. When you first posted, >> there was a library that was tickling my memory, but I could not >> remember its (simple) name. It occurred to me this morning, after >> you posted your ne

Re: Checking function's parameters (type, value) or not ?

2016-04-06 Thread Mark Lawrence via Python-list
On 06/04/2016 14:07, ast wrote: Hello I would like to know if it is advised or not to test a function's parameters before running it, e.g for functions stored on a public library ? Example: def to_base(nber, base=16, use_af=True, sep=''): assert isinstance(nber, int) and nber >= 0 ass

Re: Checking function's parameters (type, value) or not ?

2016-04-06 Thread Chris Angelico
On Wed, Apr 6, 2016 at 11:07 PM, ast wrote: > def to_base(nber, base=16, use_af=True, sep=''): > >assert isinstance(nber, int) and nber >= 0 >assert isinstance(base, int) and base >= 2 >assert isinstance(use_af, bool) >assert isinstance(sep, str) and len(sep) == 1 > > tbc > > Wit

Re: Promoting Python

2016-04-06 Thread BartC
On 06/04/2016 12:38, Ned Batchelder wrote: On Wednesday, April 6, 2016 at 7:06:28 AM UTC-4, BartC wrote: On 05/04/2016 06:48, Gordon( Hotmail ) wrote: The problem I am finding is most of the sites claiming to help understand Python devote far too much space bragging about the wonders of Python

Re: Untrusted code execution

2016-04-06 Thread Random832
On Tue, Apr 5, 2016, at 21:43, Steven D'Aprano wrote: > As Zooko says, Guido's "best argument is that reducing usability (in > terms > of forbidding language features, especially module import) and reducing > the > usefulness of extant library code" would make the resulting interpreter > too > feeb

Checking function's parameters (type, value) or not ?

2016-04-06 Thread ast
Hello I would like to know if it is advised or not to test a function's parameters before running it, e.g for functions stored on a public library ? Example: def to_base(nber, base=16, use_af=True, sep=''): assert isinstance(nber, int) and nber >= 0 assert isinstance(base, int) and base

Re: Promoting Python

2016-04-06 Thread Mark Lawrence via Python-list
On 06/04/2016 12:06, BartC wrote: On 05/04/2016 06:48, Gordon( Hotmail ) wrote: I am struggling to understand the basic principles of Python having spent many years as a pure Amateur tinkering with a variety of BASIC Last time I looked, there seemed to be around 250 dialects of Basic, and with

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-06 Thread Random832
On Tue, Apr 5, 2016, at 17:37, Nagy László Zsolt wrote: > > >> It is blurred by design. There is an interpretation where an interval > >> between [0..4] equals to a set of intervals ([0..2],[2..4]). > > No, because 2.5 is in one and not the other. > My notation was: 0..4 for any number between 0

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
BartC : > But you don't have to use classes, exceptions, decorators, generators, > iterators, closures, comprehensions, meta classes, ... the list of > meaningless buzzwords just goes on. Also, you don't have to use the letter "e" in your identifiers or the number 2 anywhere in your programs. Re

Re: Promoting Python

2016-04-06 Thread Ned Batchelder
On Wednesday, April 6, 2016 at 7:06:28 AM UTC-4, BartC wrote: > On 05/04/2016 06:48, Gordon( Hotmail ) wrote: > > The problem I am finding is most of the sites claiming to help understand > > Python devote > > far too much space bragging about the wonders of Python instead of... > > I fully agree

Re: Promoting Python

2016-04-06 Thread BartC
On 05/04/2016 06:48, Gordon( Hotmail ) wrote: I am struggling to understand the basic principles of Python having spent many years as a pure Amateur tinkering with a variety of BASIC Last time I looked, there seemed to be around 250 dialects of Basic, and with wildly differing implementations

Re: mod_wsgi not compatible with Wamp 2.4 and python 3.4.3

2016-04-06 Thread asimkon .
I managed to connect Apache 2.2 with django framework successfully using Python 2.7 and mod_wsgi.so (Apache module) thanks to the instructions from https://pusonchen.wordpress.com/2013/06/03/build-django-website-with-apache-mod_wsgi-on-windows/. The problem is that i see the Django project Web page

Re: Promoting Python

2016-04-06 Thread Marko Rauhamaa
Gregory Ewing : > Another option for graphical stuff is pygame: Thanks! > http://pygame.org/news.html Especially for this: No need to mess with installing it outside of your operating systems package manager. However: Does Pygame work with Python 3? Yes. Pygame 1.9.2 supports Py

Basic plugin architecture

2016-04-06 Thread Nick Sarbicki
Hi, Question on how people here would design a basic plugin architecture: I'm playing with the idea of having a pluggable system where the users can create some simple classes which can then be accessed in a Django app. I want to make it as __simple__ as possible for the user. Hopefully to the p

Re: Promoting Python

2016-04-06 Thread Gregory Ewing
Another option for graphical stuff is pygame: http://pygame.org/news.html A rough translation of some of your code: import pygame, sys from pygame import display, draw, event, font, Color, QUIT # Set up the display window screen = display.set_mode((800, 600)) colors = ["red", "orange", "yello

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-06 Thread Michael Selik
On Tue, Apr 5, 2016, 10:46 PM Nagy László Zsolt wrote: > > >> How about creating two classes for this? One that supports zero sized > >> intervals, and another that doesn't? > > If you don't want zero sized intervals, just don't put any in it. You > > don't have a separate list type to support ev

Re: Best Practices for Internal Package Structure

2016-04-06 Thread Michael Selik
On Wed, Apr 6, 2016, 2:51 AM Steven D'Aprano wrote: > On Wed, 6 Apr 2016 05:56 am, Michael Selik wrote: > > [Sven R. Kunze] > >> If you work like in the 80's, maybe. Instead of scrolling, (un)setting > >> jumppoints, or use splitview of the same file, it's just faster/easier > to > >> jump betwee