Re: Python is not bad ;-)

2015-05-01 Thread Steven D'Aprano
On Thu, 30 Apr 2015 09:30 pm, Cecil Westerhof wrote: > Tail recursion would nice to have also. People coming from functional languages like Lisp and Haskell often say that, but how many recursive algorithms naturally take a tail-call form? Not that many. I suppose that it would be nice if Python

Re: Looks like Python 3 files do not confirm to Python 3

2015-05-01 Thread Steven D'Aprano
On Fri, 1 May 2015 04:27 pm, Cecil Westerhof wrote: > On my system in: > /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py ndg is a third-party package, not part of the Python 3 standard library. > it says: > try: > from ndg.httpsclient.subj_alt_name import Su

Re: Is my implementation of happy number OK

2015-05-01 Thread Jon Ribbens
On 2015-04-30, Dave Angel wrote: > On 04/30/2015 07:31 PM, Jon Ribbens wrote: >> On 2015-04-30, Dave Angel wrote: >>> But the real reason I didn't like it was it produced a much larger >>> set of happy_numbers, which could clog memory a lot sooner. For >>> 10**7 items, I had 3250 happy members,

Rewriting to Python 3

2015-05-01 Thread Cecil Westerhof
On my system I have: PARSER_RE_STR = '/(%s)=' % '|'.join(DN_LUT.keys() + DN_LUT.values()) in: /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py In Python 3 that gives: TypeError: unsupported operand type(s) for +: 'dict_keys' and 'dict_values' How should I rewr

Re: Looks like Python 3 files do not confirm to Python 3

2015-05-01 Thread Cecil Westerhof
Op Friday 1 May 2015 08:27 CEST schreef Cecil Westerhof: > On my system in: > /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py > > it says: > try: > from ndg.httpsclient.subj_alt_name import SubjectAltName > from pyasn1.codec.der import decoder as der_decoder > SUBJ_ALT_NA

Re: Rewriting to Python 3

2015-05-01 Thread Ben Finney
Cecil Westerhof writes: > On my system I have: > PARSER_RE_STR = '/(%s)=' % '|'.join(DN_LUT.keys() + DN_LUT.values()) > in: > /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py Are you in contact with the author of that third-party library? Why is it in your Python

Re: Looks like Python 3 files do not confirm to Python 3

2015-05-01 Thread Cecil Westerhof
Op Friday 1 May 2015 09:00 CEST schreef Steven D'Aprano: > On Fri, 1 May 2015 04:27 pm, Cecil Westerhof wrote: > >> On my system in: >> /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py > > ndg is a third-party package, not part of the Python 3 standard > library. Oops, ba

Jedi is now a static analysis library

2015-05-01 Thread Steven D'Aprano
Jedi, the refactoring and static analysis tool, is now able to be used as a library for your own code. See the announcement here: https://mail.python.org/pipermail/code-quality/2015-April/000534.html Jedi itself: https://github.com/davidhalter/jedi/ -- Steven -- https://mail.python.org/ma

Re: Rewriting to Python 3

2015-05-01 Thread Peter Otten
Cecil Westerhof wrote: > On my system I have: > PARSER_RE_STR = '/(%s)=' % '|'.join(DN_LUT.keys() + DN_LUT.values()) > in: > /usr/lib/python3.4/site- packages/ndg/httpsclient/ssl_peer_verification.py > > In Python 3 that gives: > TypeError: unsupported operand type(s) for +: 'dict_key

Re: Python is not bad ;-)

2015-05-01 Thread Cecil Westerhof
Op Friday 1 May 2015 09:03 CEST schreef Steven D'Aprano: > On Thu, 30 Apr 2015 09:30 pm, Cecil Westerhof wrote: > >> Tail recursion would nice to have also. > > People coming from functional languages like Lisp and Haskell often > say that, but how many recursive algorithms naturally take a > tail

Re: Looks like Python 3 files do not confirm to Python 3

2015-05-01 Thread Mark Lawrence
On 01/05/2015 08:16, Cecil Westerhof wrote: Op Friday 1 May 2015 08:27 CEST schreef Cecil Westerhof: On my system in: /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py it says: try: from ndg.httpsclient.subj_alt_name import SubjectAltName from pyasn1.codec.der import de

Re: Rewriting to Python 3

2015-05-01 Thread Chris Angelico
On Fri, May 1, 2015 at 5:22 PM, Cecil Westerhof wrote: > On my system I have: > PARSER_RE_STR = '/(%s)=' % '|'.join(DN_LUT.keys() + DN_LUT.values()) > in: > /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py > > In Python 3 that gives: > TypeError: unsupported op

Re: Rewriting to Python 3

2015-05-01 Thread Mark Lawrence
On 01/05/2015 08:22, Cecil Westerhof wrote: On my system I have: PARSER_RE_STR = '/(%s)=' % '|'.join(DN_LUT.keys() + DN_LUT.values()) in: /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py In Python 3 that gives: TypeError: unsupported operand type(s) for +:

Re: Is my implementation of happy number OK

2015-05-01 Thread Steven D'Aprano
On Fri, 1 May 2015 05:23 pm, Jon Ribbens wrote: > On 2015-04-30, Dave Angel wrote: >> On 04/30/2015 07:31 PM, Jon Ribbens wrote: >>> On 2015-04-30, Dave Angel wrote: But the real reason I didn't like it was it produced a much larger set of happy_numbers, which could clog memory a lot s

Re: Looks like Python 3 files do not confirm to Python 3

2015-05-01 Thread Cecil Westerhof
Op Friday 1 May 2015 10:05 CEST schreef Mark Lawrence: > On 01/05/2015 08:16, Cecil Westerhof wrote: >> Op Friday 1 May 2015 08:27 CEST schreef Cecil Westerhof: >> >>> On my system in: >>> /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py >>> >>> it says: >>> try: >>> from

Am I missing something here? ipaddress vs socket

2015-05-01 Thread the . loeki
Hi all, Given the following code: import ipaddress import socket ip = ipaddress.ip_address(mystring) sock_family = ip. socket = socket.socket(sock_family, socket.SOCK_STREAM) Am I crazy or is this undoable? sock.AF_INET == 2 sock.AF_INET6 == 10 ip.version == 4 or 6 -- https://mail.pytho

Re: Am I missing something here? ipaddress vs socket

2015-05-01 Thread Chris Angelico
On Fri, May 1, 2015 at 7:42 PM, wrote: > Hi all, > > Given the following code: > > import ipaddress > import socket > > ip = ipaddress.ip_address(mystring) > sock_family = ip. > socket = socket.socket(sock_family, socket.SOCK_STREAM) > > Am I crazy or is this undoable? > > sock.AF_INET == 2 >

GAE environment differences

2015-05-01 Thread Robin Becker
A user reports getting KeyError/ImportError when executing GAE dev/live code looking like import os ... fn = os.path.expanduser(os.path.join('~','.reportlab_settings')) .. This works fine in cpython; so I assume that the GAE environment must be doing module resolution differently. I

Re: Am I missing something here? ipaddress vs socket

2015-05-01 Thread Alain Ketterlin
the.lo...@gmail.com writes: > Given the following code: > > import ipaddress > import socket > > ip = ipaddress.ip_address(mystring) > sock_family = ip. > socket = socket.socket(sock_family, socket.SOCK_STREAM) > > Am I crazy or is this undoable? > > sock.AF_INET == 2 > sock.AF_INET6 == 10 > i

Re: Am I missing something here? ipaddress vs socket

2015-05-01 Thread Ronald van Zantvoort
Hi Chris & Alain, thanks for responding :) On Friday, 1 May 2015 12:11:20 UTC+2, Chris Angelico wrote: > On Fri, May 1, 2015 at 7:42 PM, Ronald van Zantvoort wrote: > > Hi all, > > > > Given the following code: > > > > import ipaddress > > import socket > > > > ip = ipaddress.ip_address(mystrin

Re: ImportError with pickle (Python 2.7.9), possibly platform dependent

2015-05-01 Thread Ben Sizer
On Thursday, 30 April 2015 01:45:05 UTC+1, Chris Angelico wrote: > On Thu, Apr 30, 2015 at 2:01 AM, Ben Sizer wrote: > > 1) There clearly is a module named OMDBMap, and it's importable - it's > > there in the 2nd line of the traceback. > > > > Does anybody have any suggestions on how I can go abo

Re: l = range(int(1E9))

2015-05-01 Thread Thomas 'PointedEars' Lahn
Cecil Westerhof wrote: > By the way: I also see python3.4 and python3.4m. Any idea where the m > stands for? I googled for “python3.4m” and found as second result In a nutshell: python3.4m was buil

Re: Am I missing something here? ipaddress vs socket

2015-05-01 Thread Chris Angelico
On Fri, May 1, 2015 at 8:41 PM, Ronald van Zantvoort wrote: > mystring is already an IP address, sorry for not mentioning that. > The point is that ternary if; I've been scouring around the internet and > there's a million different variations on the same idea. > I'm completely flabberghasted it'

Re: ImportError with pickle (Python 2.7.9), possibly platform dependent

2015-05-01 Thread Chris Angelico
On Fri, May 1, 2015 at 9:01 PM, Ben Sizer wrote: > Another good question, and this gives us the answer. The module lists are > quite different, as I'd expect because the load happens in the context of the > full application whereas the dump happens as a standalone script. But > literally every

Re: GAE environment differences

2015-05-01 Thread Chris Angelico
On Fri, May 1, 2015 at 8:29 PM, Robin Becker wrote: > A user reports getting KeyError/ImportError when executing GAE dev/live code > looking like > > > import os > ... > fn = os.path.expanduser(os.path.join('~','.reportlab_settings')) > .. > > This works fine in cpython; so I assume that t

Fast way of extracting files from various folders

2015-05-01 Thread subhabrata . banerji
Dear Group, I have several millions of documents in several folders and subfolders in my machine. I tried to write a script as follows, to extract all the .doc files and to convert them in text, but it seems it is taking too much of time. import os from fnmatch import fnmatch import win32com.c

Re: ImportError with pickle (Python 2.7.9), possibly platform dependent

2015-05-01 Thread Peter Otten
Ben Sizer wrote: > On Thursday, 30 April 2015 01:45:05 UTC+1, Chris Angelico wrote: >> On Thu, Apr 30, 2015 at 2:01 AM, Ben Sizer wrote: >> > 1) There clearly is a module named OMDBMap, and it's importable - it's >> > there in the 2nd line of the traceback. >> > >> > Does anybody have any suggest

Re: l = range(int(1E9))

2015-05-01 Thread Cecil Westerhof
Op Friday 1 May 2015 13:15 CEST schreef Thomas Lahn: > Cecil Westerhof wrote: > >> By the way: I also see python3.4 and python3.4m. Any idea where the >> m stands for? > > I googled for “python3.4m” and found as second result Eh, I could/should have done that myself. :-( Nice that you do not burn

[no subject]

2015-05-01 Thread newton avetisyan
Sent from Windows Mail-- https://mail.python.org/mailman/listinfo/python-list

Re: GAE environment differences

2015-05-01 Thread Robin Becker
On 01/05/2015 13:15, Chris Angelico wrote: On Fri, May 1, 2015 at 8:29 PM, Robin Becker wrote: Best thing to do is to ask the user to post the complete traceback. You might need to use "import os.path" but normally I would expect that not to be an issue. jamesbynd said: here's a tracebac

Re: GAE environment differences

2015-05-01 Thread Chris Angelico
On Fri, May 1, 2015 at 11:04 PM, Robin Becker wrote: >> File "python2.7/posixpath.py", line 268, in expanduser >> import pwd >> ``` > > the user suggests that even though claims are made that you can use a > filesystem, but stuff like pwd is missing. Apparently the user module has no > meani

Re: l = range(int(1E9))

2015-05-01 Thread Michael Torrie
On 04/30/2015 10:19 PM, Cecil Westerhof wrote: >> I must also confess to being highly impressed, it's a breath of >> fresh air having an apprentice Pythonista who is looking at doing >> things the Pythonic way :) > > When in Rome, do as the Romans do. > > Besides: there probably is a reason for t

Re: GAE environment differences

2015-05-01 Thread Peter Otten
Chris Angelico wrote: > On Fri, May 1, 2015 at 11:04 PM, Robin Becker wrote: >>> File "python2.7/posixpath.py", line 268, in expanduser >>> import pwd >>> ``` >> >> the user suggests that even though claims are made that you can use a >> filesystem, but stuff like pwd is missing. Apparently

Re: Am I missing something here? ipaddress vs socket

2015-05-01 Thread Ronald van Zantvoort
On Friday, 1 May 2015 14:06:34 UTC+2, Chris Angelico wrote: > On Fri, May 1, 2015 at 8:41 PM, Ronald van Zantvoort wrote: > > mystring is already an IP address, sorry for not mentioning that. > > The point is that ternary if; I've been scouring around the internet and > > there's a million differ

Re: Am I missing something here? ipaddress vs socket

2015-05-01 Thread Chris Angelico
On Fri, May 1, 2015 at 11:37 PM, Ronald van Zantvoort wrote: > But seriously, I'll go see over there, thanks :) It's just that I'm amazed > that this isn't in there yet; it's 2 simple properties added in for > convenience and IMHO very Pythonic to be able to do aforementioned code. > There are

Re: Am I missing something here? ipaddress vs socket

2015-05-01 Thread Ronald van Zantvoort
On Friday, 1 May 2015 15:46:32 UTC+2, Chris Angelico wrote: > On Fri, May 1, 2015 at 11:37 PM, Ronald van Zantvoort wrote: > > But seriously, I'll go see over there, thanks :) It's just that I'm amazed > > that this isn't in there yet; it's 2 simple properties added in for > > convenience and IM

Re: l = range(int(1E9))

2015-05-01 Thread Cecil Westerhof
Op Friday 1 May 2015 15:25 CEST schreef Michael Torrie: > On 04/30/2015 10:19 PM, Cecil Westerhof wrote: >>> I must also confess to being highly impressed, it's a breath of >>> fresh air having an apprentice Pythonista who is looking at doing >>> things the Pythonic way :) >> >> When in Rome, do a

Re: Is my implementation of happy number OK

2015-05-01 Thread Ian Kelly
On Fri, May 1, 2015 at 2:27 AM, Steven D'Aprano wrote: > Rather than 10**7, how about trying (10**500 + 2). Is it happy? > > Using the Python code from Wikipedia: > https://en.wikipedia.org/wiki/Happy_number > > SQUARE = dict([(c, int(c)**2) for c in "0123456789"]) > def is_happy(n): > while (n

Re: Rewriting to Python 3

2015-05-01 Thread Cecil Westerhof
Op Friday 1 May 2015 09:22 CEST schreef Cecil Westerhof: > On my system I have: PARSER_RE_STR = '/(%s)=' % > '|'.join(DN_LUT.keys() + DN_LUT.values()) in: > /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py > > In Python 3 that gives: TypeError: unsupported operand type(s)

Re: Rewriting to Python 3

2015-05-01 Thread Cecil Westerhof
Op Friday 1 May 2015 16:41 CEST schreef Cecil Westerhof: > Op Friday 1 May 2015 09:22 CEST schreef Cecil Westerhof: > >> On my system I have: PARSER_RE_STR = '/(%s)=' % >> '|'.join(DN_LUT.keys() + DN_LUT.values()) in: >> /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py >>

Re: Fast way of extracting files from various folders

2015-05-01 Thread Irmen de Jong
On 1-5-2015 14:28, subhabrata.bane...@gmail.com wrote: > Dear Group, > > I have several millions of documents in several folders and subfolders in my > machine. > I tried to write a script as follows, to extract all the .doc files and to > convert them in text, but it seems it is taking too much

Re: Python is not bad ;-)

2015-05-01 Thread Christian Gollwitzer
Am 01.05.15 um 09:03 schrieb Steven D'Aprano: On Thu, 30 Apr 2015 09:30 pm, Cecil Westerhof wrote: Tail recursion would nice to have also. People coming from functional languages like Lisp and Haskell often say that, but how many recursive algorithms naturally take a tail-call form? Not that

Re: Is my implementation of happy number OK

2015-05-01 Thread Peter Otten
Ian Kelly wrote: > On Fri, May 1, 2015 at 2:27 AM, Steven D'Aprano > wrote: >> Rather than 10**7, how about trying (10**500 + 2). Is it happy? >> >> Using the Python code from Wikipedia: >> https://en.wikipedia.org/wiki/Happy_number >> >> SQUARE = dict([(c, int(c)**2) for c in "0123456789"]) >> d

Re: l = range(int(1E9))

2015-05-01 Thread Terry Reedy
On 5/1/2015 1:04 AM, Cecil Westerhof wrote: By the way: I also see python3.4 and python3.4m. Any idea where the m stands for? I never heard of that in 18 years of Python, and thought it must be an error, but putting 'python3.4b' into google search return this. https://stackoverflow.com/ques