Re: Feature Request: Reposition Execution

2015-05-14 Thread Christian Gollwitzer
Am 15.05.15 um 05:58 schrieb Skybuck Flying: Thanks for the ideas, I haven't tried them yet. I wonder if they will work in a multi-threaded fashion. I doubt it. The run_script runs in it's own thread. It would be of enormous help if you would create a minimal script just like the above for

Re: Building CPython

2015-05-14 Thread Gregory Ewing
BartC wrote: It appears to be those "<=" and "+" operations in the code above where much of the time is spent. When I trace out the execution paths a bit more, I'll have a better picture of how many lines of C code are involved in each iteration. The path from decoding a bytecode to the C cod

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

2015-05-14 Thread Chris Angelico
On Fri, May 15, 2015 at 2:09 PM, Steven D'Aprano wrote: >> Yes, but sometimes it's at the file system's discretion - particularly >> when you're working with network mounts. The application may not even >> know that the file got hard deleted. > > Citation needed. > > "Move to trash" is a move oper

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

2015-05-14 Thread Steven D'Aprano
On Fri, 15 May 2015 12:56 pm, Chris Angelico wrote: > On Fri, May 15, 2015 at 12:49 PM, Ian Kelly wrote: >> On May 14, 2015 7:55 PM, "Chris Angelico" wrote: >>> (Though when >>> it comes to the bikeshedding phase, I'm sure there'll be some who say >>> "if it can't be trashed, just hard delete it

Python: How to find out values of all feasible x under constraints.

2015-05-14 Thread Xiang Zhang
Dear all, I am writing a code using Python now. I want to know how to find out values of all feasible x under constraints. x = [x_1, x_2, x_3,..., x_10] constraints: x_i = 0,1,2,3 or 4, where i=1,2,10 x_1 + x_2 + x_3 +...+x_10 <= 15 How to find out all the feasible solutions x (d

Re: Feature Request: Reposition Execution

2015-05-14 Thread Skybuck Flying
"Steven D'Aprano" wrote in message news:5553145b$0$9$c3e8...@news.astraweb.com... On Wednesday 13 May 2015 17:27, Christian Gollwitzer wrote: A clean way to exit your script could be to raise an exception. It should propagate to the toplevel and halt your script. However it is not poss

Re: Instead of deciding between Python or Lisp for a programming intro course...What about an intro course that uses *BOTH*? Good idea?

2015-05-14 Thread Rustom Mody
On Wednesday, May 13, 2015 at 8:14:39 PM UTC+5:30, zipher wrote: > On Tuesday, May 12, 2015 at 10:35:29 PM UTC-5, Rustom Mody wrote: > > On Wednesday, May 13, 2015 at 8:00:50 AM UTC+5:30, Steven D'Aprano wrote: > > > Why can't a language be designed with a *practical and concrete* need in > > > min

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

2015-05-14 Thread Chris Angelico
On Fri, May 15, 2015 at 12:49 PM, Ian Kelly wrote: > On May 14, 2015 7:55 PM, "Chris Angelico" wrote: >> (Though when >> it comes to the bikeshedding phase, I'm sure there'll be some who say >> "if it can't be trashed, just hard delete it", and others who say "if >> it can't be trashed, raise an

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

2015-05-14 Thread Ian Kelly
On May 14, 2015 7:55 PM, "Chris Angelico" wrote: > (Though when > it comes to the bikeshedding phase, I'm sure there'll be some who say > "if it can't be trashed, just hard delete it", and others who say "if > it can't be trashed, raise an exception". And neither is truly wrong.) The answer is "r

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 o

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

2015-05-14 Thread Steven D'Aprano
On Fri, 15 May 2015 01:59 am, Chris Angelico wrote: > On Fri, May 15, 2015 at 1:49 AM, Grant Edwards > wrote: >> On 2015-05-14, Steven D'Aprano >> wrote: >> >>> I'd like to do a little survey, and get a quick show of hands. >>> >>> How many people have written GUI or text-based applications or >

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

2015-05-14 Thread Steven D'Aprano
On Fri, 15 May 2015 03:32 am, Dave Farrance wrote: > Steven D'Aprano wrote: > >>I'd like to do a little survey, and get a quick show of hands. >> >>How many people have written GUI or text-based applications or scripts >>where a "Move file to trash" function would be useful? >> >>Would you like

Re: a python pitfall

2015-05-14 Thread Steven D'Aprano
On Fri, 15 May 2015 04:06 am, Billy Earney wrote: > Hello friends: > > I saw the following example at > http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments > and > did not believe the output produced and had to try it for myself > > def foo(a,b,c=[]): > c.

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

2015-05-14 Thread Chris Angelico
On Fri, May 15, 2015 at 11:37 AM, Steven D'Aprano wrote: > On Fri, 15 May 2015 01:49 am, Grant Edwards wrote: > >> On 2015-05-14, Steven D'Aprano >> wrote: >> >>> I'd like to do a little survey, and get a quick show of hands. >>> >>> How many people have written GUI or text-based applications or

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

2015-05-14 Thread Steven D'Aprano
On Fri, 15 May 2015 01:49 am, Grant Edwards wrote: > On 2015-05-14, Steven D'Aprano > wrote: > >> I'd like to do a little survey, and get a quick show of hands. >> >> How many people have written GUI or text-based applications or >> scripts where a "Move file to trash" function would be useful?

Re: Building CPython

2015-05-14 Thread BartC
On 14/05/2015 22:55, BartC wrote: > def whiletest(): > i=0 > while i<=1: > i=i+1 > > whiletest() > Python 2.5 9.2 seconds Python 3.1 13.1 Python 3.4.317.0 Python 3.4.314.3 (under Ubuntu on same machine, using the version I buil

Re: Building CPython

2015-05-14 Thread MRAB
On 2015-05-14 22:55, BartC wrote: On 14/05/2015 17:29, Marko Rauhamaa wrote: BartC : That's a shame because I wanted to tinker with the main dispatcher loop to try and find out what exactly is making it slow. Nothing that seems obvious at first sight. My guess is the main culprit is attribut

Re: Building CPython

2015-05-14 Thread BartC
On 14/05/2015 17:29, Marko Rauhamaa wrote: BartC : That's a shame because I wanted to tinker with the main dispatcher loop to try and find out what exactly is making it slow. Nothing that seems obvious at first sight. My guess is the main culprit is attribute lookup in two ways: * Each obj

Re: a python pitfall

2015-05-14 Thread Mark Lawrence
On 14/05/2015 19:06, Billy Earney wrote: Hello friends: I saw the following example at http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments Thanks for this link, the title "Engineering Fantasy" could have been made for the troll who's just arrived back here afte

Re: a python pitfall

2015-05-14 Thread Ian Kelly
On Thu, May 14, 2015 at 12:06 PM, Billy Earney wrote: > Hello friends: > > I saw the following example at > http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments > and did not believe the output produced and had to try it for myself See also https://docs.python.

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

2015-05-14 Thread Ethan Furman
On 05/14/2015 11:43 AM, Chris Warrick wrote: And if you are looking for a mostly-compliant Python library/app (and a shameless plug): https://pypi.python.org/pypi/trashman/1.5.0 The docs listed link to Package Builder. How is that related to TrashMan? -- ~Ethan~ -- https://mail.python.org/m

Re: a python pitfall

2015-05-14 Thread Skip Montanaro
> I saw the following example at > http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments > and did not believe the output produced and had to try it for myself Pylint (and perhaps other Python "linters") would, I think, warn you that you were using a mutable objec

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 1/5

Re: Instead of deciding between Python or Lisp for a programming intro course...What about an intro course that uses *BOTH*? Good idea?

2015-05-14 Thread zipher
> > No, Common LISP does, but as the website says Common LISP is a > > "multi-paradigm" langauge. It's trying to be everything to everybody, > > just like Python tried to do in the other direction, making "everything an > > object". Python was trying to be too pure, while LISP was trying to be >

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

2015-05-14 Thread Chris Warrick
On Thu, May 14, 2015 at 8:11 PM, Grant Edwards wrote: > On 2015-05-14, Dave Farrance wrote: >> Steven D'Aprano wrote: >> >>>I'd like to do a little survey, and get a quick show of hands. >>> >>>How many people have written GUI or text-based applications or scripts where >>>a "Move file to trash"

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

2015-05-14 Thread Ethan Furman
On 05/14/2015 08:45 AM, Steven D'Aprano wrote: I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a "Move file to trash" function would be useful? Never. Would you like to see that in the standard librar

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

2015-05-14 Thread Grant Edwards
On 2015-05-14, Dave Farrance wrote: > Steven D'Aprano wrote: > >>I'd like to do a little survey, and get a quick show of hands. >> >>How many people have written GUI or text-based applications or scripts where >>a "Move file to trash" function would be useful? >> >>Would you like to see that in t

a python pitfall

2015-05-14 Thread Billy Earney
Hello friends: I saw the following example at http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments and did not believe the output produced and had to try it for myself def foo(a,b,c=[]): c.append(a) c.append(b) print(c) foo(1,1) foo(1,1) foo(1,1) p

Re: Building CPython

2015-05-14 Thread Chris Angelico
On Fri, May 15, 2015 at 3:32 AM, BartC wrote: > OK, thanks. I didn't even know where the executable was put! Now I don't > need 'make install', while 'make test' I won't bother with any more. > > Making a small change and typing 'make' took 5 seconds, which is reasonable > enough (although I had t

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

2015-05-14 Thread Dave Farrance
Steven D'Aprano wrote: >I'd like to do a little survey, and get a quick show of hands. > >How many people have written GUI or text-based applications or scripts where >a "Move file to trash" function would be useful? > >Would you like to see that in the standard library, even if it meant that >th

Re: Building CPython

2015-05-14 Thread BartC
On 14/05/2015 18:11, Chris Angelico wrote: On Fri, May 15, 2015 at 3:02 AM, BartC wrote: I hope there's a quicker way of re-building an executable after a minor source file change, otherwise doing any sort of development is going to be impractical.) The whole point of 'make' is to rebuild o

Re: Looking for direction

2015-05-14 Thread Tim Chase
On 2015-05-14 09:57, 20/20 Lab wrote: > On 05/13/2015 06:23 PM, Steven D'Aprano wrote: >>> I have a LARGE csv file that I need to process. 110+ columns, >>> 72k rows. I managed to write enough to reduce it to a few >>> hundred rows, and the five columns I'm interested in. > I actually stumbled ac

Re: Building CPython

2015-05-14 Thread Chris Angelico
On Fri, May 15, 2015 at 3:02 AM, BartC wrote: > Actually I had VirtualBox with Ubuntu, but I don't know my way around Linux > and preferred doing things under Windows (and with all my own tools). > > But it's now building under Ubuntu. > > (Well, I'm not sure what it's doing exactly; the instructi

Re: Looking for direction

2015-05-14 Thread Albert-Jan Roskam via Python-list
- On Thu, May 14, 2015 3:35 PM CEST Dennis Lee Bieber wrote: >On Wed, 13 May 2015 16:24:30 -0700, 20/20 Lab declaimed >the following: > >>Now is were I have my problem: >> >>myList = [ [123, "XXX", "Item", "Qty", "Noise"], >>[72976, "YYY", "Item", "Qty", "

Re: Building CPython

2015-05-14 Thread Dave Angel
On 05/14/2015 01:02 PM, BartC wrote: On 14/05/2015 17:09, Chris Angelico wrote: On Fri, May 15, 2015 at 1:51 AM, BartC wrote: OK, the answer seems to be No then - you can't just trivially compile the C modules that comprise the sources with the nearest compiler to hand. So much for C's famous

Re: Building CPython

2015-05-14 Thread BartC
On 14/05/2015 17:09, Chris Angelico wrote: On Fri, May 15, 2015 at 1:51 AM, BartC wrote: OK, the answer seems to be No then - you can't just trivially compile the C modules that comprise the sources with the nearest compiler to hand. So much for C's famous portability! (Actually, I think you a

Re: Looking for direction

2015-05-14 Thread 20/20 Lab
On 05/13/2015 06:23 PM, Steven D'Aprano wrote: On Thu, 14 May 2015 09:24 am, 20/20 Lab wrote: I'm a beginner to python. Reading here and there. Written a couple of short and simple programs to make life easier around the office. That being said, I'm not even sure what I need to ask for. I'

Re: Building CPython

2015-05-14 Thread Marko Rauhamaa
BartC : > That's a shame because I wanted to tinker with the main dispatcher > loop to try and find out what exactly is making it slow. Nothing that > seems obvious at first sight. My guess is the main culprit is attribute lookup in two ways: * Each object attribute reference involves a diction

Re: Building CPython

2015-05-14 Thread Chris Angelico
On Fri, May 15, 2015 at 1:51 AM, BartC wrote: > OK, the answer seems to be No then - you can't just trivially compile the C > modules that comprise the sources with the nearest compiler to hand. So much > for C's famous portability! > > (Actually, I think you already lost me on your first line.) >

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

2015-05-14 Thread Chris Angelico
On Fri, May 15, 2015 at 1:49 AM, Grant Edwards wrote: > On 2015-05-14, Steven D'Aprano wrote: > >> I'd like to do a little survey, and get a quick show of hands. >> >> How many people have written GUI or text-based applications or >> scripts where a "Move file to trash" function would be useful?

Re: Building CPython

2015-05-14 Thread BartC
On 13/05/2015 23:34, Terry Reedy wrote: 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

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

2015-05-14 Thread Grant Edwards
On 2015-05-14, Steven D'Aprano wrote: > I'd like to do a little survey, and get a quick show of hands. > > How many people have written GUI or text-based applications or > scripts where a "Move file to trash" function would be useful? How would you even define what "move to trash" means in a sta

Survey -- Move To Trash function in Python?

2015-05-14 Thread Steven D'Aprano
I'd like to do a little survey, and get a quick show of hands. How many people have written GUI or text-based applications or scripts where a "Move file to trash" function would be useful? Would you like to see that in the standard library, even if it meant that the library had feature-freeze and