Re: Help for a newbie regarding code physical switches

2015-05-20 Thread Terry Reedy
On 5/20/2015 3:54 AM, Howard Spink wrote: Thanks for your help. I want the python to run automatically after boot and show a blank white screen, This part if for a RasPy group. when a combination of GP10 inputs are HIGH python displays one of 150 JPEGS. Is this possible? Number the n

Re: List semantics [was Re: Slices time complexity]

2015-05-20 Thread Terry Reedy
On 5/20/2015 4:54 AM, Gregory Ewing wrote: At this point the student thinks, Um... what? How can an object contain another object *twice*? If he's still thinking in physical terms, this sentence is nonsensical. It gets even worse with: x = [1, 2] x[1] = x Now you have to say that the list

Re: Slices time complexity

2015-05-18 Thread Terry Reedy
On 5/18/2015 5:04 PM, Mario Figueiredo wrote: Other languages implement slices. I'm currently being faced with a Go snippet that mirrors the exact code above and it does run in linear time. Is there any reason why Python 3.4 implementation of slices cannot be a near constant operation? The

Re: Building CPython

2015-05-15 Thread Terry Reedy
On 5/15/2015 5:54 PM, BartC wrote: What /is/ a method lookup? Is it when you have this: A.B() This is parsed as (A.B)() and need to find whether the expression A (or its class or type) has a name B associated with it? Yes. Dotted names imply an attribute lookup. (And it then needs

Re: pip grabs tar.gz file instead of whl?

2015-05-15 Thread Terry Reedy
On 5/16/2015 12:12 AM, Mark Lawrence wrote: The whole point is that setup.py never works because it can't find VS despite the fact that I know I've got the correct version installed. If I download a whl file, pip installs that version perfectly. If I try to get pip to download and install the

Re: Building CPython

2015-05-15 Thread Terry Reedy
On 5/15/2015 4:59 AM, Marko Rauhamaa wrote: Must a method lookup necessarily involve object creation? Where is matters, inside loops, method lookup can be avoided after doing it once. for i in range(100): ob.meth(i) versus meth = ob.meth for i in range(100): meth(i) For working

Re: Building CPython

2015-05-15 Thread Terry Reedy
On 5/15/2015 6:51 AM, Christian Gollwitzer wrote: Am 14.05.15 um 20:50 schrieb Terry Reedy: On 5/14/2015 1:11 PM, Chris Angelico wrote: 2) make test - run the entire test suite. Takes just as long every time, but most of it won't have changed. The test runner has an option, -jn, to run

Re: Building CPython

2015-05-14 Thread Terry Reedy
On 5/14/2015 1:11 PM, Chris Angelico wrote: 2) make test - run the entire test suite. Takes just as long every time, but most of it won't have changed. The test runner has an option, -jn, to run tests in n processes instead of just 1. On my 6 core pentium, -j5 cuts time to almost exactly

Re: Survey -- Move To Trash function in Python?

2015-05-14 Thread Terry Reedy
On 5/14/2015 10:03 PM, Steven D'Aprano wrote: The idea is that the library will hide that complexity from you, so your python code will just say: import shutil shutil.move_to_trash(filename) Since 'trash' is (or is used as) a verb, shutil.trash(filename) seems sufficient. and it will work

Re: Basic misunderstanding on object creation

2015-05-13 Thread Terry Reedy
On 5/13/2015 2:42 PM, andrew cooke wrote: On Wednesday, 13 May 2015 13:37:23 UTC-3, Terry Reedy wrote: On 5/13/2015 9:25 AM, andrew cooke wrote: The following code worked on Python 3.2, but no longer works in 3.4. Bugfixes break code that depends on buggy behavior. See https

Re: Building CPython

2015-05-13 Thread Terry Reedy
On 5/13/2015 3:36 PM, BartC wrote: I'm interested in playing with the CPython sources. I need to be able to build under Windows, but don't want to use make files (which rarely work properly), nor do a 6GB installation of Visual Studio Express which is what seems to be needed (I'm hopeless with

Re: Basic misunderstanding on object creation

2015-05-13 Thread Terry Reedy
On 5/13/2015 12:36 PM, Terry Reedy wrote: On 5/13/2015 9:25 AM, andrew cooke wrote: The following code worked on Python 3.2, but no longer works in 3.4. Bugfixes break code that depends on buggy behavior. See https://bugs.python.org/issue1683368 Your code also fails in 2.7.9 if you inherit

Re: Basic misunderstanding on object creation

2015-05-13 Thread Terry Reedy
On 5/13/2015 12:38 PM, Mark Lawrence wrote: I'm completely convinced that I've seen a change go through on the bug tracker that impacts on this area, but many months if not years ago. Unfortunately searching the bug tracker for super, __new__, __init__ and so on gets a lot of hits, leaving my

Re: Basic misunderstanding on object creation

2015-05-13 Thread Terry Reedy
On 5/13/2015 9:25 AM, andrew cooke wrote: The following code worked on Python 3.2, but no longer works in 3.4. Bugfixes break code that depends on buggy behavior. See https://bugs.python.org/issue1683368 Your code also fails in 2.7.9 if you inherit Foo from object. The exact error messages

Re: Python file structure

2015-05-12 Thread Terry Reedy
On 5/12/2015 3:49 PM, Ned Batchelder wrote: On Tuesday, May 12, 2015 at 3:13:32 PM UTC-4, zljubi...@gmail.com wrote: Hi, I have python file with the following structure: import... A = configparser.get(...) B = configparser.get(...) Command line parameters parsing [they can change variable A

Re: anomaly

2015-05-12 Thread Terry Reedy
On 5/12/2015 9:56 AM, Steven D'Aprano wrote: The consensus among the core developers is: * in general, the harm and inconvenience from accidentally shadowing built-ins is not great, and it usually easy to spot, debug and prevent; * when it comes to built-in functions (e.g. sum, map,

Re: How to properly apply OOP in the bouncing ball code

2015-05-12 Thread Terry Reedy
On 5/11/2015 8:42 PM, zipher wrote: On Monday, May 11, 2015 at 7:25:09 PM UTC-5, Dennis Lee Bieber wrote: On Mon, 11 May 2015 08:33:56 -0700 (PDT), zipher dreamingforw...@gmail.com declaimed the following: You are making a error that few in the programming community have caught up to. OOP

Re: anomaly

2015-05-11 Thread Terry Reedy
Further posts on this thread should delete pydev-list or gmane.comp.python.devel. It was a mistake by the troll to ever post this there. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: Calling a function is faster than not calling it?

2015-05-10 Thread Terry Reedy
On 5/10/2015 5:58 AM, Steven D'Aprano wrote: Why is calling a function faster than bypassing the function object and evaluating the code object itself? And not by a little, but by a lot? Here I have a file, eval_test.py: # === cut === from timeit import Timer def func(): a = 2 b = 3

Re: Why does unicode-escape decode escape symbols that are already escaped?

2015-05-10 Thread Terry Reedy
On 5/10/2015 11:53 AM, Somelauw . wrote: In Python 3, decoding € with unicode-escape returns 'â\x82¬' which in my opinion doesn't make sense. Agreed. I think this is a bug in that it should raise an exception instead. Decoding a string only makes sense for rot-13 The € already is decoded;

Re: anomaly

2015-05-10 Thread Terry Reedy
On 5/10/2015 12:34 PM, Mark Rosenblitt-Janssen wrote: Here's something that might be wrong in Python (tried on v2.7): You are being hypnotized by the fact the 'int' is a builtin name. Builtin names are not keywords and can intentionally be rebound. If you rebind randomly, the result may

Re: Moving to Python 3.x

2015-05-09 Thread Terry Reedy
On 5/9/2015 2:30 PM, Antranig Vartanian wrote: Hay, I learned the basics of python using the book Think Python (http://www.greenteapress.com/thinkpython/) which was good (IMHO), and it teaches in Python 2.7. Now I'm trying to write my first python+gtk program. anyways, my question will be, is

Re: IDLE Restoration

2015-05-08 Thread Terry Reedy
On 5/8/2015 11:26 AM, subhabrata.bane...@gmail.com wrote: Dear Group, In many applications there is a facility to restore its previous sessions, especially if they close accidentally. Does IDLE have any such facility? No. You are prompted to close unsaved files. Filenames are saved in

Re: Throw the cat among the pigeons

2015-05-05 Thread Terry Reedy
On 5/5/2015 5:12 PM, Cecil Westerhof wrote: Op Tuesday 5 May 2015 22:46 CEST schreef Terry Reedy: Well, I did not write many tail recursive functions. But what surprised me was that for large values the ‘tail recursive’ version was more efficient as the iterative version. In your first

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Terry Reedy
On 5/5/2015 1:46 PM, Ian Kelly wrote: On Tue, May 5, 2015 at 9:22 AM, Paul Moore p.f.mo...@gmail.com wrote: I'm working my way through the asyncio documentation. I have got to the Tasks and coroutines section, but I'm frankly confused as to the difference between the various things described

Re: asyncio: What is the difference between tasks, futures, and coroutines?

2015-05-05 Thread Terry Reedy
On 5/5/2015 11:22 AM, Paul Moore wrote: I'm working my way through the asyncio documentation. I have got to the Tasks and coroutines section, but I'm frankly confused as to the difference between the various things described in that section: coroutines, tasks, and futures. I think can

Re: Throw the cat among the pigeons

2015-05-05 Thread Terry Reedy
On 5/5/2015 12:18 PM, Cecil Westerhof wrote: Op Tuesday 5 May 2015 17:47 CEST schreef Paul Moore: On Sunday, 3 May 2015 16:23:59 UTC+1, Cecil Westerhof wrote: By the way: I think that even if the recursion does not go further as 500, it is still a good idea to use tail recursion. Why use

Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Terry Reedy
On 5/4/2015 9:35 AM, Davide Mancusi wrote: I believe this is a bug. I'm not sure it is, actually; imagine the text is coming in one character at a time (eg from a pipe), and it's seen alpha\r. It knows that this is a line, so it emits it; but until the next character is read, it can't know

Re: Bitten by my C/Java experience

2015-05-04 Thread Terry Reedy
On 5/4/2015 1:43 PM, Ian Kelly wrote: *() is a zero-element tuple, and (a, b) is a two-element tuple, but (a) is not a one-element tuple. Tuples are created by commas, not parentheses, so use (a,) instead. Which means that a, and a,b (or a,b,) are 1 and 2 element tuples respectively.

Re: ImportPython Newsletter

2015-05-03 Thread Terry Reedy
On 5/3/2015 12:01 PM, Ankur Gupta wrote: Hey Guys, Just like to draw attention to ImportPython a weekly Python newsletter. This is the 30th issue of the newsletter http://importpython.com/newsletter/no/30/. Nice, but when I tried to subscribe, Unable to reach server -- Terry Jan Reedy --

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

2015-05-02 Thread Terry Reedy
On 5/2/2015 5:40 PM, Jon Ribbens wrote: For information, it looks like xrange() was added on 26 Oct 1993, which pre-dates Python 1.0. 1.0 was released Feb 1991. 3.2 exactly 20 years later. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

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

2015-05-02 Thread Terry Reedy
On 5/2/2015 11:26 AM, BartC wrote: When I first looked at Python 20 or so years ago this seemed to be the standard way of writing a for-loop: for i in range(N): As Mark said, the actual syntax was originally for item in sequence: ... where sequence technically meant an object with

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

2015-05-02 Thread Terry Reedy
On 5/2/2015 5:31 PM, Ian Kelly wrote: Would it have been better if range() had been implemented as xrange() from the beginning? Sure, that would have been great. Except for one small detail: the iterator protocol didn't exist back then. For loops originally used the getitem iterator protocol.

Re: Inner workings of this Python feature: Can a Python data structure reference itself?

2015-05-02 Thread Terry Reedy
On 5/2/2015 4:02 PM, vasudevram wrote: Hi group, Please refer to this blog post about code showing that a Python data structure can be self-referential: http://jugad2.blogspot.in/2015/05/can-python-data-structure-reference.html Gotten a couple of comments on it already, but interested in

Re: Is this a good way to implement testing

2015-05-02 Thread Terry Reedy
On 5/2/2015 6:29 PM, Cecil Westerhof wrote: At the moment I define the test functionality in the following way: Any automated testing is better than none. For idlelib, I use unittest. For an individual project with specialized needs, I use a custom test framework tuned to those needs.

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

2015-05-02 Thread Terry Reedy
On 5/2/2015 8:01 PM, Jon Ribbens wrote: On 2015-05-02, Terry Reedy tjre...@udel.edu wrote: On 5/2/2015 5:40 PM, Jon Ribbens wrote: For information, it looks like xrange() was added on 26 Oct 1993, which pre-dates Python 1.0. 1.0 was released Feb 1991. 3.2 exactly 20 years later. No, you

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.

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

2015-04-30 Thread Terry Reedy
On 4/30/2015 12:06 PM, Cecil Westerhof wrote: If I execute: l = range(int(1E9) you get a SyntaxError The python process gobbles up all the memory and is killed. The problem is that after this my swap is completely used, because other processes have swapped to it. This make those

Re: Boolean Operator Confusion

2015-04-24 Thread Terry Reedy
On 4/24/2015 10:50 AM, subhabrata.bane...@gmail.com wrote: Dear Group, I am trying to understand the use of Boolean operator in Python. I am trying to write small piece of script, as follows, def input_test(): str1=raw_input(PRINT QUERY:) if AND or OR or NOT in str1:

Enterprise Python

2015-04-24 Thread Terry Reedy
Someone, (Mark, I believe), posted this link to a podcast from a few weeks ago: http://www.talkpythontome.com/episodes/show/4/enterprise-python-and-large-scale-projects A large part of that is based on this Dec 2014 post:

Re: [RELEASED] Python 3.5.0a4 is now available

2015-04-22 Thread Terry Reedy
On 4/22/2015 1:59 PM, Ian Kelly wrote: On Wed, Apr 22, 2015 at 7:07 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: Please don't feed the RUE, you're wasting everybody's time. If there's a problem with the installer, that's worth knowing about, isn't it? If there is a problem with the

Re: Type checking tools for Python 2?

2015-04-21 Thread Terry Reedy
On 4/21/2015 2:08 PM, Skip Montanaro wrote: I've been following along with the discussions related to type hints[1] on python-ideas and python-dev. I'm interested enough to start looking into this for my own nefarious purposes. At work, we have lots of C++ code wrapped by Boost.Python. It seems

Re: Type checking tools for Python 2?

2015-04-21 Thread Terry Reedy
On 4/21/2015 3:11 PM, Skip Montanaro wrote: On Tue, Apr 21, 2015 at 1:29 PM, Terry Reedy tjre...@udel.edu wrote: I believe mypy can typecheck 2.x code in conjunction with stub files. I based this on comments in the PEP 484 discussion on py-dev, which I might have misread as being about now

Re: EuroPython 2015: Django Girls Workshop

2015-04-17 Thread Terry Reedy
On 4/17/2015 4:31 PM, Marko Rauhamaa wrote: beliav...@aol.com: If your target audience is women, I think you should have termed it the Django Womens Workshop rather than the Django Girls Workshop. Referring to adults as children can be seen as condescending. Are all of you claiming this so

Re: Generarl programming question.

2015-04-11 Thread Terry Reedy
On 4/11/2015 3:19 PM, Thomas 'PointedEars' Lahn wrote: Terry Reedy wrote: On 4/11/2015 12:23 PM, Thomas 'PointedEars' Lahn wrote: Chris Angelico wrote: The 'x' inside each function is completely separate, no matter how many times they get called. They're usually stored on something called

Re: Generarl programming question.

2015-04-11 Thread Terry Reedy
On 4/11/2015 12:23 PM, Thomas 'PointedEars' Lahn wrote: Chris Angelico wrote: The 'x' inside each function is completely separate, no matter how many times they get called. They're usually stored on something called a call stack - you put another sheet of paper on top of the stack every time

Re: try..except with empty exceptions

2015-04-11 Thread Terry Reedy
On 4/10/2015 9:42 PM, Steven D'Aprano wrote: try: spam() except: # Implicitly an empty tuple. pass No, specified as equivalent to 'except BaseException:' (or 'except (BaseException,):', either of which are different from 'except ():'. An expression-less except clause, if

Re: find all multiplicands and multipliers for a number

2015-04-11 Thread Terry Reedy
On 4/11/2015 5:10 PM, Chris Angelico wrote: On Sun, Apr 12, 2015 at 3:52 AM, Paul Rubin no.email@nospam.invalid wrote: PS Note that you're being wasteful by multiplying c*c over and over Yeah this is a reasonable point, though most of the c's should fit in a machine word, at least in my

Re: Best search algorithm to find condition within a range

2015-04-07 Thread Terry Reedy
On 4/7/2015 1:44 PM, Ian Kelly wrote: def to_base(number, base): ... digits = [] ... while number 0: ... digits.append(number % base) ... number //= base ... return digits or [0] ...

Re: implementing pyshark

2015-04-06 Thread Terry Reedy
On 4/6/2015 8:05 AM, Steven D'Aprano wrote: On Mon, 6 Apr 2015 06:40 pm, Michael S. wrote: Hi everyone. while trying to implement pyshark, i am getting this error: [...] ImportError: No module named _threading Well that's awesome. I don't think I've seen that in Python 2.7 before.

Re: Permission denied when opening a file that was created concurrently by os.rename (Windows)

2015-04-05 Thread Terry Reedy
On 4/5/2015 1:45 PM, Alexey Izbyshev wrote: Hello! I've hit a strange problem that I reduced to the following test case: * Run several python processes in parallel that spin in the following loop: while True: if os.path.isfile(fname): with open(fname, 'rb') as f: f.read()

Re: Defamation

2015-04-03 Thread Terry Reedy
On 4/3/2015 12:37 PM, silvagni wrote: Please remove the page: https://mail.python.org/pipermail/python-list/2014-September/691616.html Thank You Gabriele Silvagni You can try sending mail to python-list-ow...@python.org, but it will not do much good. Even if a post could be removed from

Re: Python 3 success story

2015-03-31 Thread Terry Reedy
On 3/30/2015 8:24 PM, Mario Figueiredo wrote: On Mon, 30 Mar 2015 19:28:16 -0400, Terry Reedy tjre...@udel.edu wrote: So I suggested going ahead and testing PyBrain by using it. This appears to have worked out well. I believe the only 2-3 issue she ran into was a '/' that needed to become

Re: Hypothesis 1.0: A production quality property-based testing library for Python

2015-03-30 Thread Terry Reedy
On 3/30/2015 2:44 PM, David MacIver wrote: Hypothesis is a Python library for turningunit tests into generative tests, covering a far wider range of cases thanyou can manually. Rather than just testing for thethings you already know about, Hypothesis goes out and actively hunts forbugs in your

Re: Python 3 lack of support for fcgi/wsgi.

2015-03-30 Thread Terry Reedy
On 3/30/2015 4:07 PM, John Nagle wrote: After all this, the production system is now running entirely on Python 3. I am really glad to read this. Aside from a bit of hyperbole, I appreciate the report of successes and difficulties. I also understand better that 'Python 3' means something

Python 3 success story

2015-03-30 Thread Terry Reedy
Last summer, a college student, who prefers Python to Java and Racket (her other CS course languages), wanted to do a year-long AI research project using PyBrain (for the ai part), numpy (required for PyBrain), and pygame (for animated displays). We both preferred 3.x. That was not an issue

Re: Hypothesis 1.0: A production quality property-based testing library for Python

2015-03-30 Thread Terry Reedy
On 3/30/2015 4:46 PM, David MacIver wrote: On 30 March 2015 at 22:37, Terry Reedy tjre...@udel.edu mailto:tjre...@udel.edu wrote: https://www.python.org/dev/__peps/pep-0484/ https://www.python.org/dev/peps/pep-0484/ proposes the addition of a 'typing' module for defining types

Re: Function Defaults - avoiding unneccerary combinations of arguments at input

2015-03-25 Thread Terry Reedy
On 3/25/2015 1:43 PM, Ivan Evstegneev wrote: Hello all , Just a little question about function's default arguments. Let's say I have this function: def my_fun(history=False, built=False, current=False, topo=None, full=False, file=None): if currnet and full: do

Re: Supply condition in function call

2015-03-25 Thread Terry Reedy
On 3/25/2015 1:29 PM, Manuel Graune wrote: Hi, I'm looking for a way to supply a condition to an if-statement inside a function body when calling the function. I can sort of get what I want with using eval (see code below) but I would like to achieve this in a safer way. If there is a solution

Re: Function Defaults - avoiding unneccerary combinations of arguments at input

2015-03-25 Thread Terry Reedy
On 3/25/2015 3:50 PM, Ivan Evstegneev wrote: Googled a bit, and found only one, a ValueError exception, but still don't understand how it should be implemented in my case. Should my code look like this one: def my_fun(history=False, built=False, current=False, topo=None, full=False,

Re: Regex Python Help

2015-03-25 Thread Terry Reedy
On 3/25/2015 7:10 PM, Steven D'Aprano wrote: Does Windows shell have grep? How about Powershell? No. I just use Idle's grep (Find in Files). And I generally would even if Command Prompt did have grep. Idle's has the nice feature that output goes in an Output Window, with each line found

Re: module attributes and docstrings

2015-03-24 Thread Terry Reedy
On 3/24/2015 4:55 AM, Mario Figueiredo wrote: Reading PEP 257 and 258 I got the impression that I could document module attributes and these would be available in the __doc__ attribute of the object. So things like the one below are something I got used to do, but that don't work after all, as

Re: Regex Python Help

2015-03-24 Thread Terry Reedy
On 3/24/2015 2:13 PM, gdot...@gmail.com wrote: I am creating a tool to search a filesystem for one simple string. I cannot get the syntax correct. Thank you in advance for your help. import sys import re import os path='/' viewfiles=os.listdir(path) listdir is not recursive, so this code will

Re: Pillow bug?

2015-03-24 Thread Terry Reedy
On 3/24/2015 3:52 PM, kai.pet...@gmail.com wrote: Judging from the message archive, the image-sig list is (just about) dead? PIL and/or pillow should have their own lists. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list

Re: fibonacci series what Iam is missing ?

2015-03-23 Thread Terry Reedy
On 3/23/2015 2:44 PM, Dave Angel wrote: ## Example 2: Using recursion with caching cache = [0, 1] def fib4(n): if len(cache) = n: value = fib4(n-2) + fib4(n-1) cache.append(value) return cache[n] This one takes less than a millisecond up to n=200 or so. Iteration

Re: fibonacci series what Iam is missing ?

2015-03-23 Thread Terry Reedy
On 3/23/2015 7:12 PM, Dave Angel wrote: On 03/23/2015 06:53 PM, Terry Reedy wrote: Iteration with caching, using a mutable default arg to keep the cache private and the function self-contained. This should be faster. def fib(n, _cache=[0,1]): '''Return fibonacci(n). _cache

Re: UnboundLocalError in TKinter, SQLAlchemy script.

2015-03-19 Thread Terry Reedy
On 3/19/2015 4:23 AM, Chris Kavanagh wrote: On Wednesday, March 18, 2015 at 5:37:53 PM UTC-4, Terry Reedy wrote: You comment out apparently irrelevant lines and see if you still have the same problem, and if you do, delete. Repeat until you have a Minimal Complete Verifiable Example

Re: UnboundLocalError in TKinter, SQLAlchemy script.

2015-03-18 Thread Terry Reedy
On 3/18/2015 3:42 PM, Chris Kavanagh wrote: 2nd, you say you don't want to play guessing games, yet complain about 300 lines of irrelevant code, lol. Which way is it? Do you want the code, or not? How do I know what's relevant or irrelevant when I'm clearly confused? You comment out

Re: A simple single line, triple-quoted comment is giving syntax error. Why?

2015-03-18 Thread Terry Reedy
On 3/18/2015 3:53 PM, Thomas 'PointedEars' Lahn wrote: I must strongly object and recommend against getting accustomed to the suggested use of multi-line string literals. I agree. If you want to comment your code, then by all means do so using docstrings and *real* comments. IDEs like

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Terry Reedy
On 3/16/2015 6:36 PM, Paul Rubin wrote: Do you know if any of the big Python shops (Google maybe?) are using Python 3 these days? LibreOffice uses Python3.3 (or later, don't know) both for internal scripting and the Python bridge. The FSR unicode that works everywhere for all codepoints

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Terry Reedy
On 3/16/2015 5:13 AM, INADA Naoki wrote: Another experience is porting Flask application in my company from Python 2 to Python 3. It has 26k lines of code and 7.6k lines of tests. Since we don't need to support both of PY2 and PY3, we used 2to3. 2to3 changes 740 lines. That is less than 3%

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Terry Reedy
On 3/16/2015 4:31 AM, Paul Rubin wrote: sure why numpy couldn't go in the stdlib: does it change all that fast? First there was Numerical Python, the first killer app (though a library) for Python. Then there was was NumArray by a competing group, with some not-quite forward compatible

Re: Dict comprehensions - improvement to docs?

2015-03-16 Thread Terry Reedy
On 3/16/2015 2:45 AM, Frank Millman wrote: Ian Kelly ian.g.ke...@gmail.com wrote in message news:CALwzidnTUifj_L=DSH_8s+z0L44pxVvdpG1+pfz1Tzm=ect...@mail.gmail.com... On Sun, Mar 15, 2015 at 11:25 PM, Frank Millman fr...@chagford.com wrote: Hi all I like dict comprehensions, but I don't use

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Terry Reedy
On 3/16/2015 1:07 AM, Paul Rubin wrote: I saved a quote from Hacker News a while back (I don't know who the author is): You know why I'm not running python 3? Because it doesn't solve a single problem I have. Quite possibly true. It doesn't solve anyone's problems. It

Re: The idle gui

2015-03-14 Thread Terry Reedy
On 3/13/2015 4:58 PM, lmzent...@gmail.com wrote: My python program was running for over six weeks. This is not clear. Do you mean that you wrote a program in python and that it ran continously, day and night, for 6 weeks? Or that you successfully used python on and off for 6 weeks? In

Re: Module/lib for controlling a terminal program using redrawing?

2015-03-14 Thread Terry Reedy
On 3/14/2015 6:50 AM, Jason Heeris wrote: I am trying to automate the use of some old, in-house terminal-based programs that use screen redrawing for their interface. This includes single line redrawing (eg. using '\r' and overwriting), complete screen clearing, and fine-grained cursor movement

Re: when may sys.executable be empty

2015-03-12 Thread Terry Reedy
On 3/11/2015 10:41 AM, Wolfgang Maier wrote: From the documentation of sys.executable: A string giving the absolute path of the executable binary for the Python interpreter, on systems where this makes sense. If Python is unable to retrieve the real path to its executable, sys.executable

Re: generator/coroutine terminology

2015-03-12 Thread Terry Reedy
On 3/12/2015 9:35 AM, Rustom Mody wrote: This is more a question about standard terminology/conventions than about semantics - of course assuming I understand :-) Say I have a simple yielding function: def foo(x): yield x+1 yield x+2 This is a generator function And I have g =

Re: I want to get involved with Python!

2015-03-11 Thread Terry Reedy
On 3/11/2015 5:19 AM, bink...@mweb.co.za wrote: I am currently a Progress Programmer and looking for new challenges! Are you referring to https://en.wikipedia.org/wiki/OpenEdge_Advanced_Business_Language It seems that Python is a good language to get familiar with and I would like some

Re: [RELEASED] Python 3.5.0a2 is now available

2015-03-09 Thread Terry Reedy
On 3/9/2015 5:34 AM, Larry Hastings wrote: On behalf of the Python development community and the Python 3.5 release team, I'm thrilled to announce the availability of Python 3.5.0a2. Python 3.5.0a2 is the second alpha release of Python 3.5, which will be the next major release of Python.

Re: Question about 'x' in pymc.invlogit(a+b*x)

2015-03-07 Thread Terry Reedy
On 3/7/2015 11:44 AM, fl wrote: Hi, I once learnt Python for a few weeks. Now, I try to using a Python package pymc. It has the following example code: import pymc import numpy as np n = 5*np.ones(4,dtype=int) x = np.array([-.86,-.3,-.05,.73]) x is defined here as a module ('global') name

Re: Newbie question about text encoding

2015-03-06 Thread Terry Reedy
On 3/6/2015 11:20 AM, Rustom Mody wrote: = pp =  print (pp) = Try open it in idle3 and you get (at least I get): $ idle3 ff.py Traceback (most recent call last): File /usr/bin/idle3, line 5, in module main() File /usr/lib/python3.4/idlelib/PyShell.py, line 1562, in

Re: Is nan in (nan,) correct?

2015-03-05 Thread Terry Reedy
Nothing about nans is 'correct'. They are a CS invention On 3/5/2015 5:26 PM, random...@fastmail.us wrote: It's been brought up on Stack Overflow that the in operator (on tuples, and by my testing on dict and list, as well as dict lookup) uses object identity as a shortcut, and returns true

Re: what is wrong with d.clear()?

2015-03-05 Thread Terry Reedy
On 12/22/2014 3:54 PM, Rick Johnson wrote: On Monday, December 22, 2014 12:16:03 PM UTC-6, sohca...@gmail.com wrote: On Monday, December 22, 2014 12:16:15 AM UTC-8, shawool wrote: [snip: OP's adolescent accessorizing] @_@ Is there a reason you're composing your messages with a large, colored

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-04 Thread Terry Reedy
On 3/4/2015 8:34 PM, Xrrific wrote: Guys, please Help!!! Gals might know better how to impress a girl. I am trying to impress a girl who is learning python and want ask her out at the same time. Start by not being sexist about the fitness of females for Python programming. Make sure she

Re: Newbie question about text encoding

2015-03-03 Thread Terry Reedy
On 3/3/2015 1:03 PM, Rustom Mody wrote: On Thursday, February 26, 2015 at 10:33:44 PM UTC+5:30, Terry Reedy wrote: You should add emoticons, but not call them or the above 'gibberish'. I think that this part of your post is more 'unprofessional' than the character blocks. It is very jarring

Re: tarfile vs zipfile

2015-03-02 Thread Terry Reedy
On 3/2/2015 8:12 PM, Ben Finney wrote: Seth P set...@outlook.com writes: Is there a reason tarfile and zipfile don't use the same method/member names, where it makes sense? The situation is known to some core developers, but is hard to change now. One likely explanation is that the

Re: GDAL Installation in Enthought Python Distribution

2015-02-26 Thread Terry Reedy
On 2/26/2015 2:47 AM, Leo Kris Palao wrote: Would like to request how to install GDAL in my Enthought Python Distribution (64-bit). The best place to ask about the Enthought Python Distribution is a list devoted to the E. P. D. -- Terry Jan Reedy --

Re: Newbie question about text encoding

2015-02-26 Thread Terry Reedy
On 2/26/2015 8:24 AM, Chris Angelico wrote: On Thu, Feb 26, 2015 at 11:40 PM, Rustom Mody rustompm...@gmail.com wrote: Wrote something up on why we should stop using ASCII: http://blog.languager.org/2015/02/universal-unicode.html I think that the main point of the post, that many Unicode

Re: Installing PIL without internet access

2015-02-26 Thread Terry Reedy
On 2/26/2015 10:23 AM, Larry Martell wrote: I have a host that has no access to the internet and I need to install PIL on it. I have an identical host that is on the internet and I have installed it there (with pip). Is there a way I can copy files from the connected host to a flash drive and

Re: Parallelization of Python on GPU?

2015-02-26 Thread Terry Reedy
On 2/26/2015 10:06 AM, Jason Swails wrote: On Thu, 2015-02-26 at 14:02 +1100, Steven D'Aprano wrote: John Ladasky wrote: What I would REALLY like to do is to take advantage of my GPU. I can't help you with that, but I would like to point out that GPUs typically don't support IEE-754 maths,

Re: Bug in timsort!?

2015-02-25 Thread Terry Reedy
On 2/25/2015 10:23 AM, Zachary Ware wrote: Just to be clear, this has already been fixed, and the fix will be released in Python 2.7.10, 3.4.4, and 3.5.0. I think the important effect of the fix is to encourage automatic code verification both by the group that found this bug and by and

Running Idle on Windows 8 (.1)

2015-02-24 Thread Terry Reedy
On 2/24/2015 3:13 PM, blakemal...@gmail.com wrote: I too can not get idle to run on win 8.1 using python3.4.2 installed from the python-3.4.2.amd64.msi. What experience have others had with Idle and Windows 8? The OP for

Re: Bug in timsort!?

2015-02-24 Thread Terry Reedy
On 2/24/2015 4:34 PM, Roy Smith wrote: http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/ Tim Peters is aware of this and opened http://bugs.python.org/issue23515 -- Terry Jan Reedy --

Re: id() and is operator

2015-02-22 Thread Terry Reedy
On 2/22/2015 12:53 PM, LJ wrote: Hi everyone. Quick question here. Lets suppose if have the following numpy array: b=np.array([[0]*2]*3) and then: id(b[0]) 4582 id(b[1]) 45857512 id(b[2]) 4582 Please correct me if I am wrong, You are, as other explained but according to

Re: Future of Pypy?

2015-02-22 Thread Terry Reedy
On 2/22/2015 7:45 AM, Dave Farrance wrote: As an engineer, I can quickly knock together behavioural models of electronic circuits, complete units, and control systems in Python, then annoyingly in a few recent cases, have to re-write in C for speed. I've tried PyPy, the just-in-time compiler

Re: id() and is operator

2015-02-22 Thread Terry Reedy
On 2/22/2015 4:25 PM, Marko Rauhamaa wrote: LJ luisjoseno...@gmail.com: id(b[0]) 4582 [...] id(b[2]) 4582 Please correct me if I am wrong, but according to this b[2] and b[0] are the same object. Now, b[0] is b[2] False This is a true statement: If X is Y, then id(X)

Re: python implementation of a new integer encoding algorithm.

2015-02-19 Thread Terry Reedy
On 2/19/2015 3:36 AM, Marko Rauhamaa wrote: PS On the topic of pointlessness, why is top-posting the norm on python-dev ... ? It isn't, except that Guido gets a special pass and some of the posters travel a lot and read and reply on phones, which makes snipping and inline response

Re: Issues pip-installing pywin32

2015-02-18 Thread Terry Reedy
On 2/18/2015 7:13 AM, Chris Angelico wrote: (Before I begin, I want to make it clear that I can still go poke around on SourceForge and grab the appropriate installer [1], and that does work. But if I'm going to tell someone else how to set up this program, I'd much rather be able to recommend

Re: PythonMagick on Windows DLL load failed

2015-02-18 Thread Terry Reedy
On 2/16/2015 7:17 AM, julien levasseur wrote: I am using Python 2.7 on Windows 8.1. Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32 I *strongly* suggest that you update to 2.7.9. I installed ImageMagick from imagemagick.org

<    10   11   12   13   14   15   16   17   18   19   >