Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-27 Thread BartC
On 27/10/2016 19:09, BartC wrote: On 27/10/2016 17:13, Steve D'Aprano wrote: On Fri, 28 Oct 2016 12:13 am, BartC wrote: print "Enter 3 numbers: " readln a,b,c How is the interpreter supposed to know that a, b, c are numbers? What sort of numbers? 16-bit integers

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-27 Thread BartC
On 27/10/2016 23:31, Chris Angelico wrote: On Fri, Oct 28, 2016 at 9:02 AM, BartC wrote: I notice that when it comes to reading command-line arguments, then Python's sys.argv presents them as a list, not one long string. And the list is just a series of strings, so needing to know wh

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-27 Thread BartC
On 28/10/2016 01:08, Chris Angelico wrote: On Fri, Oct 28, 2016 at 10:45 AM, BartC wrote: On 27/10/2016 23:31, Chris Angelico wrote: When you exec to a process, you provide multiple arguments, not a single combined string. Really, there could be dozens of arguments? Windows' CreatePr

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-28 Thread BartC
t of a larger application, you don't want it falling over the first time someone tries to use it. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-28 Thread BartC
On 28/10/2016 11:35, Marko Rauhamaa wrote: BartC : On 28/10/2016 10:22, Christian Gollwitzer wrote: So "less" in C uses ncurses. You can do the same in Python, "import curses" - instead of fiddling with terminal escape characters you leave that to a library, just like

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-28 Thread BartC
On 28/10/2016 15:28, Grant Edwards wrote: On 2016-10-27, BartC wrote: On 27/10/2016 23:31, Chris Angelico wrote: When you exec to a process, you provide multiple arguments, not a single combined string. Really, there could be dozens of arguments? Windows' CreateProcess() (if that&

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-29 Thread BartC
On 29/10/2016 02:04, Steve D'Aprano wrote: On Fri, 28 Oct 2016 05:09 am, BartC wrote: For years I've had discussions in comp.lang.c about things that C should or should not have. Bart, don't be naive. The C language isn't going to "acquire a slick new enhancement&

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-29 Thread BartC
On 29/10/2016 14:51, Dennis Lee Bieber wrote: On Sat, 29 Oct 2016 12:53:35 +0100, BartC declaimed the following: BTW what does reading three integers from the user look like in Python? On one line, or on three lines? (Python 2.7) ln = raw_input("Enter three integers separat

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-29 Thread BartC
On 29/10/2016 15:19, Steve D'Aprano wrote: On Sat, 29 Oct 2016 10:53 pm, BartC wrote: But I'd like to see Python running on a 64KB system (Micropython doesn't count!). Hmmm. So tell me... how do you expect Python to run on tiny systems by *adding* new features? Regardles

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-29 Thread BartC
On 29/10/2016 16:24, Steve D'Aprano wrote: On Sun, 30 Oct 2016 01:32 am, BartC wrote: (BTW the functionality of my 'readln a,b,c' differs from the above. Separators can be anything reasonable. When eol is encountered, it will read zeros. And errors are not handled: any non-num

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-29 Thread BartC
On 29/10/2016 15:53, Chris Angelico wrote: On Sun, Oct 30, 2016 at 1:32 AM, BartC wrote: BTW the functionality of my 'readln a,b,c' differs from the above. Separators can be anything reasonable. When eol is encountered, it will read zeros. And errors are not handled: any non-numeric

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-29 Thread BartC
On 29/10/2016 17:27, Dennis Lee Bieber wrote: On Sat, 29 Oct 2016 15:32:16 +0100, BartC declaimed the following: I still think a beginner would much prefer something along the lines of 'readln a,b,c' (and I still think that's more intuitive). Then I would suggest

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-29 Thread BartC
On 29/10/2016 23:21, Dennis Lee Bieber wrote: On Sat, 29 Oct 2016 22:11:31 +0100, BartC declaimed the following: (Non-line-oriented would mean it just keeps sitting there until it's read three values, damn it, no matter how many times you press Enter, and it's not going to shift un

Re: [Theory] How to speed up python code execution / pypy vs GPU

2016-11-09 Thread BartC
pixel=20 im=createimage(1024,1536) create_fractal(-2.0, 1.0, -1.0, 1.0, im, maxpixel) writepgm("test.ppm",im,maxpixel) - -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Help me cythonize a python routine!

2016-11-09 Thread BartC
ons' is a built-in module which means it's already in something like C. So it might already be as fast as it gets (0.7 to 0.8 seconds on my machine), unless perhaps a different algorithm is used. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: [Theory] How to speed up python code execution / pypy vs GPU

2016-11-09 Thread BartC
On 09/11/2016 19:44, jlada...@itu.edu wrote: On Wednesday, November 9, 2016 at 5:03:30 AM UTC-8, BartC wrote: On 05/11/2016 17:10, Mr. Wrobel wrote: 1. What I have found is modified python interpreter - pypy - http://pypy.org that does not require any different approach to develop your code

Re: Help me cythonize a python routine!

2016-11-09 Thread BartC
On 09/11/2016 21:25, breamore...@gmail.com wrote: On Wednesday, November 9, 2016 at 7:34:41 PM UTC, BartC wrote: All the real work is done inside the Collections module. If that was written in Python, then you'd have to Cythonise that, and there might be quite a lot of it! But I

Re: [Theory] How to speed up python code execution / pypy vs GPU

2016-11-09 Thread BartC
On 10/11/2016 00:38, Michael Torrie wrote: On 11/09/2016 02:10 PM, BartC wrote: Good point, I use Ubuntu under Windows. It should be child's play, except... 'sudo apt-get install numpy' or 'python-numpy' doesn't work. Something is wrong with your setup then.

Re: [Theory] How to speed up python code execution / pypy vs GPU

2016-11-09 Thread BartC
On 10/11/2016 01:16, BartC wrote: I suppose I can get rid of the prints for the test I wanted to do, or find out how to do the same thing under Py2 print. Or install Py3 on Ubuntu, which is a big job and I've no idea how to switch between them. Some good news, it turned out Ubuntu had

Re: Help me cythonize a python routine!

2016-11-10 Thread BartC
On 09/11/2016 21:25, breamore...@gmail.com wrote: On Wednesday, November 9, 2016 at 7:34:41 PM UTC, BartC wrote: However according to your mindset nothing matters provided it's fast, > accuracy does not matter to users. Hence your recent comment on another thread about converting

Re: What exactly is a python variable?

2016-11-17 Thread BartC
guessing "x" is looked up at this point, created if it doesn't exist, and associated with the value 'integer 10'.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: What exactly is a python variable?

2016-11-17 Thread BartC
On 17/11/2016 12:20, Steve D'Aprano wrote: On Thu, 17 Nov 2016 10:37 pm, BartC wrote: (I don't know how to disassemble code outside a function, not from inside the same program. Outside it might be: 'python -m dis file.py') In the most recent versions of Python, dis.di

Re: Overlapping co-ordiantes of rectangles fail to print in python

2016-11-17 Thread BartC
? You need some specifications. I assume all rectangles are horizontally aligned (they have to be with just 4 coordinates), and the input data normalised so that the top-left corner appears first.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: What exactly is a python variable?

2016-11-17 Thread BartC
On 18/11/2016 00:47, Steve D'Aprano wrote: On Fri, 18 Nov 2016 12:19 am, BartC wrote: On 17/11/2016 12:20, Steve D'Aprano wrote: In the most recent versions of Python, dis.dis() will also accept a string: py> dis.dis('y = x + 1') 1 0 LOAD_N

Re: Numpy slow at vector cross product?

2016-11-20 Thread BartC
e workings are put into a function, then the difference is even more marked, with the normal calculation being 50% faster Maybe numpy has extra overheads, and the arrays being operated on are very small, but even so, 30 times slower than CPython? (2.5 to 0.083 seconds.) -- Bartc -- https:

Re: Numpy slow at vector cross product?

2016-11-21 Thread BartC
out again, and remembering all those options and putting -s, -- and \ in all the right places, is a much better way of doing it! Not error prone at all. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Numpy slow at vector cross product?

2016-11-21 Thread BartC
ps: %.2g seconds" %(loops,time.clock()-start) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Numpy slow at vector cross product?

2016-11-21 Thread BartC
On 21/11/2016 17:04, Nobody wrote: On Mon, 21 Nov 2016 14:53:35 +, BartC wrote: Also that the critical bits were not implemented in Python? That is correct. You'll notice that there aren't any loops in numpy.cross. It's just a wrapper around a bunch of vector

Re: Numpy slow at vector cross product?

2016-11-21 Thread BartC
On 21/11/2016 14:50, Steve D'Aprano wrote: On Mon, 21 Nov 2016 11:09 pm, BartC wrote: Modern machines run multi-tasking operating systems, where there can be other processes running. Depending on what you use as your timer, you may be measuring the time that those other processes run. T

Re: Numpy slow at vector cross product?

2016-11-22 Thread BartC
On 22/11/2016 02:44, Steve D'Aprano wrote: On Tue, 22 Nov 2016 05:43 am, BartC wrote: The fastest I can get compiled, native code to do this is at 250 million cross-products per second. (Actually 300 million using 64-bit code.) Yes, yes, you're awfully clever, and your secr

Re: Numpy slow at vector cross product?

2016-11-22 Thread BartC
urces. I will have a look. Don't forget however that all someone is trying to do is to multiply two vectors. They're not interested in axes transformation or making them broadcastable, whatever that means. So making numpy.cross do all that may simply be too big a cost. -- bar

Re: Numpy slow at vector cross product?

2016-11-22 Thread BartC
On 22/11/2016 03:00, Steve D'Aprano wrote: On Tue, 22 Nov 2016 12:45 pm, BartC wrote: You get to know after while what kinds of processes affect timings. For example, streaming a movie at the same time. Really, no. py> with Stopwatch(): ... x = math.sin(1.234) ... elapsed

Re: Numpy slow at vector cross product?

2016-11-22 Thread BartC
On 22/11/2016 12:45, BartC wrote: On 22/11/2016 12:34, Skip Montanaro wrote: I'm simply suggesting there is plenty of room for improvement. I even showed a version that did *exactly* what numpy does (AFAIK) that was three times the speed of numpy even executed by CPython. So there is

Re: Numpy slow at vector cross product?

2016-11-22 Thread BartC
On 22/11/2016 16:48, Steve D'Aprano wrote: On Tue, 22 Nov 2016 11:45 pm, BartC wrote: I will have a look. Don't forget however that all someone is trying to do is to multiply two vectors. They're not interested in axes transformation or making them broadcastable, whatever th

Re: Immutability of Floats, Ints and Strings in Python

2016-11-25 Thread BartC
)) print (x-z) print (x==z) print (x is z) print ("") print ("Integers:") x=13 y=13 print (id(x)) print (id(y)) print (x is y) z=x+13-y print (id(z)) print (x-z) print (x==z) print (x is z) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: best way to read a huge ascii file.

2016-11-25 Thread BartC
the processing won't allow the file to be split into smaller pieces.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: best way to read a huge ascii file.

2016-11-29 Thread BartC
ormat.) Then we can see if there's anything obviously inefficient about it. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Python while loop

2016-11-29 Thread BartC
his looks at numbers from 0 to 100 inclusive, not 1 to 101. Although it doesn't affect the result. (It will add in 0 which is divisible by 5, but that doesn't change it either. If this is an exercise however, checking the correct range might be important!) -- Bartc -- https://ma

Re: best way to read a huge ascii file.

2016-11-30 Thread BartC
file now? (The one that had been 40GB of text and contained 100M lines or datasets, although file caching is just about a possibility.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-04 Thread BartC
the current directory, if will print the name of the first, and there will be /272 further command parameters/, each the name of a file. (I couldn't believe this when I found out; one of my directories recently had 3.4 million files in it, I don't really want *.* expanded to 3.4m arg

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread BartC
On 04/12/2016 23:25, Steve D'Aprano wrote: On Mon, 5 Dec 2016 09:19 am, BartC wrote: Command parameters /do/ behave differently between Windows and Linux, for example try writing *.* as that third parameter. In Windows, it will print *.*. In Linux, if you have 273 files in the cu

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread BartC
On 05/12/2016 12:23, Chris Angelico wrote: On Mon, Dec 5, 2016 at 10:42 PM, BartC wrote: At least Windows does it properly. It doesn't even chop the command line into different parameters, making it considerably more flexible. (Unless you have a program based on a C-style main(nargs

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread BartC
On 05/12/2016 15:05, Chris Angelico wrote: On Tue, Dec 6, 2016 at 1:11 AM, BartC wrote: BTW what does Popen() do when one argument is '*.*'? Will that get expanded to multiple extra arguments, and at what point will it be expanded? Nope. Popen is not a shell. It sounds as if

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread BartC
On 05/12/2016 15:53, Chris Angelico wrote: On Tue, Dec 6, 2016 at 2:41 AM, BartC wrote: Are you saying that if someone executes: subprocess.Popen(["python","a.py", "*"]) the output will be: ['a.py','*']? In that case forget Windows vs. L

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread BartC
On 05/12/2016 16:49, Steve D'Aprano wrote: On Mon, 5 Dec 2016 10:42 pm, BartC wrote: So if someone types: > X A B C You would expect X to be launched, and be given arguments A, B and C. Would I? I don't think so. Even the DOS prompt supports some level of globbing. Its

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread BartC
On 05/12/2016 17:46, Dennis Lee Bieber wrote: On Mon, 5 Dec 2016 11:42:08 +, BartC declaimed the following: And it doesn't work anyway; suppose I write: >X A *.* C D How does the program know when the expanded filenames of *.* end, and the two extra parameters start? Rem

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread BartC
On 05/12/2016 18:34, eryk sun wrote: On Mon, Dec 5, 2016 at 3:41 PM, BartC wrote: Are you saying that if someone executes: subprocess.Popen(["python","a.py", "*"]) the output will be: ['a.py','*']? In that case forget Windows vs. L

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread BartC
On 05/12/2016 19:48, Michael Torrie wrote: Bored to day since it's -20 and I don't want to work outside. On 12/05/2016 12:24 PM, BartC wrote: (For example, in Windows: >ren *.c *.d Rename all .c files to .d files. None of the .d files exist (or, because of the poin

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread BartC
On 05/12/2016 19:29, Michael Torrie wrote: On 12/05/2016 11:50 AM, BartC wrote: So how do I do: gcc *.c -lm The -lm needs to go at the end. Presumably it now needs to check each parameter seeing if it resembles a file more than it does an option? And are options automatically taken

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread BartC
opinions and they ain't gonna change nothin', no how, no way, not ever. No they're not. But the auto-expansion of parameters by default is still wrong. [Sorry, I'm in a bad mood today and just had to let off a little steam...] People spout off about Windows ALL the time. 'So what?' -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread BartC
On 06/12/2016 02:21, Dennis Lee Bieber wrote: On Mon, 5 Dec 2016 18:50:30 +, BartC declaimed the following: It doesn't matter, and is not the concern of the shell. It should restrict itself to the basic parsing that may be necessary when Another name for "shell" i

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread BartC
On 06/12/2016 07:08, Gregory Ewing wrote: BartC wrote: And if there's an error in an option, you may have to abort, which means throwing away that list of files which, in some cases, can run into millions. This "millions of files" thing seems to be an imaginary monster you

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread BartC
On 06/12/2016 12:40, Gregory Ewing wrote: BartC wrote: I've given a dozen examples where the shell's auto-expansion can screw things up. Only because you're taking Windows conventions and trying to apply them to Unix. What, the convention of NOT assuming that any command

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread BartC
On 06/12/2016 12:26, Chris Angelico wrote: On Tue, Dec 6, 2016 at 10:56 PM, BartC wrote: In that directory (which was on Windows but accessible via a virtual Linux), typing any Linux command followed by * would have required all 3.4 million directory entries to be accessed in order to build a

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread BartC
On 06/12/2016 13:34, Chris Angelico wrote: On Wed, Dec 7, 2016 at 12:25 AM, BartC wrote: What, the convention of NOT assuming that any command parameter that uses * or ? MUST refer to whatever set of filenames happen to match in the current directory? And to then insert N arbitrary filenames

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread BartC
On 06/12/2016 15:44, Michael Torrie wrote: On 12/06/2016 04:43 AM, BartC wrote: Yes shell expansion has it's gotchas. But those can all be learned, Yes, learn to avoid wildcards in command parameters at all costs. But we both know that is not satisfactory. And it's not much

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread BartC
On 06/12/2016 17:00, MRAB wrote: On 2016-12-06 13:52, BartC wrote: Some special syntax is known about: | < and > for example. % less so (I've never, ever used it in live input AFAIK). [snip] You've never used ImageMagick? If you want to shrink an image to half its si

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread BartC
On 06/12/2016 21:44, Gregory Ewing wrote: BartC wrote: And the justification? Well, %ENVIRONMENTVARIABLE% gets converted in Windows, so why not?! No, the justification is that the Unix convention allows the shell to provide certain useful functions that Unix users value. If you don't

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread BartC
of the reasons cl & link on windows accept argument files as input instead of just command line arguments). So does gcc on Linux (if you mean the @file syntax). It's a tidier way of doing things. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread BartC
On 07/12/2016 08:30, Steven D'Aprano wrote: On Wednesday 07 December 2016 03:41, BartC wrote: On 06/12/2016 15:44, Michael Torrie wrote: On 12/06/2016 04:43 AM, BartC wrote: Yes shell expansion has it's gotchas. But those can all be learned, Yes, learn to avoid wildcards

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread BartC
On 07/12/2016 05:15, Steven D'Aprano wrote: On Wednesday 07 December 2016 12:55, BartC wrote: But even Linux's 128KB will fill if someone wanted a command line that listed 20,000 files individually. But it would be spectacularly bad use of a command line interface which was designed

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread BartC
On 07/12/2016 12:39, Chris Angelico wrote: On Wed, Dec 7, 2016 at 10:54 PM, BartC wrote: But if a program existed that took N filename parameters with the purpose of deleting each of them, then it can't tell if they were typed in individually (so indicating a stronger intent), or whet

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread BartC
On 07/12/2016 14:34, Steve D'Aprano wrote: On Wed, 7 Dec 2016 11:23 pm, BartC wrote: On 07/12/2016 05:15, Steven D'Aprano wrote: On Wednesday 07 December 2016 12:55, BartC wrote: But even Linux's 128KB will fill if someone wanted a command line that listed 20,000 files indiv

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread BartC
On 07/12/2016 13:58, Dennis Lee Bieber wrote: On Wed, 7 Dec 2016 11:54:35 +, BartC declaimed the following: With automatic expansion, then EVERY program can become dangerous. Can no one else see this? With your scheme, EVERY PROGRAM HAS TO IMPLEMENT ITS OWN GLOBBING. Only the

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread BartC
On 07/12/2016 16:53, Michael Torrie wrote: On 12/07/2016 08:48 AM, BartC wrote: I would prefer that the program "t" can be invoked exactly the same way under both systems. I don't want different instructions for Linux, or for the user (of my language) to have to write two lots o

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread BartC
On 07/12/2016 15:25, Ben Bacarisse wrote: BartC writes: [...] But remember: cp *.c There might be some irate users out there if it can't detect a simple user error like that. There might be. They are ill-served by current Unix shells. But, oddly, the flow has gone the othe

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread BartC
On 07/12/2016 18:02, BartC wrote: If I want to run a Windows program on Linux, and that program needs to see *.* unexpanded, then it can't undo that expansion. The cat is already out of the bag. I mean, the genie is out of the bottle, whatever. You know what I mean, the operation i

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread BartC
On 07/12/2016 23:35, Steve D'Aprano wrote: On Thu, 8 Dec 2016 02:19 am, BartC wrote: On 07/12/2016 14:34, Steve D'Aprano wrote: [...] I don't know why you are so hung up over the number of characters here, or this bogeyman of "one million files" in a directory. Be

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread BartC
On 08/12/2016 00:09, Steve D'Aprano wrote: On Thu, 8 Dec 2016 02:48 am, BartC wrote: You make it sound like a big deal. Here's a program (in my language not Python) which prints the list of files matching a file-spec: println dirlist(cmdparams[2]) Does dirlist provide an escaping

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread BartC
On 08/12/2016 07:24, Gregory Ewing wrote: BartC wrote: (I'm in the middle of porting my console editor to Linux. But one problem is that on one Linux, half the key combinations (eg. Shift+Ctrl+B) are not recognised. If you're reading characters from a tty device in raw mode (whic

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread BartC
On 08/12/2016 03:41, Steven D'Aprano wrote: On Thursday 08 December 2016 12:15, BartC wrote: That's all. I know the value of keeping things straightforward instead of throwing in everything you can think of. The file-matching is done by WinAPI functions. So you're happy wit

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread BartC
On 08/12/2016 19:36, Chris Angelico wrote: On Fri, Dec 9, 2016 at 6:15 AM, BartC wrote: On 08/12/2016 03:41, Steven D'Aprano wrote: On Thursday 08 December 2016 12:15, BartC wrote: That's all. I know the value of keeping things straightforward instead of throwing in everythi

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread BartC
On 08/12/2016 22:31, Chris Angelico wrote: On Fri, Dec 9, 2016 at 8:42 AM, BartC wrote: Python3 tells me that original, lower-case and upper-case versions are: ßẞıİiIÅσςσ ßßıi̇iiåσςσ SSẞIİIIÅΣΣΣ Now lower-case the upper-case version and see what you get. And upper-case the lower-case

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread BartC
On 09/12/2016 00:55, Chris Angelico wrote: On Fri, Dec 9, 2016 at 10:19 AM, BartC wrote: So it it perfectly possible to have case conversion defined for English, while other alphabets can do what they like. And there we have it. Not only do you assume that English is the only thing

Re: python list index - an easy question

2016-12-17 Thread BartC
ing! Strings might be better: x = "ABCDEFGHIJKLM" print (x[1:5]) displays: BCDE print (x[1:5][0:2]) # slice of a slice displays: BC -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: python list index - an easy question

2016-12-18 Thread BartC
uddenly switches to 1-based indexing! Or least, when -index is considered: x = [-4,-3,-2,-1] print x[-1] # -1 Notice the correspondence here... print x[-2] # -2 x = [1, 2, 3, 4] print x[1]# 2 ...and the lack of it here print x[2]# 3 -- Bartc -- http

Re: python list index - an easy question

2016-12-18 Thread BartC
On 18/12/2016 21:04, Michael Torrie wrote: On 12/18/2016 09:21 AM, BartC wrote: So if you wanted a simple list giving the titles of the chapters in a book or on a DVD, on the colour of the front doors for each house in a street, usually you wouldn't be able to use element 0. It also de

Re: python list index - an easy question

2016-12-18 Thread BartC
On 18/12/2016 22:21, BartC wrote: On 18/12/2016 21:04, Michael Torrie wrote: On 12/18/2016 09:21 AM, BartC wrote: So if you wanted a simple list giving the titles of the chapters in a book or on a DVD, on the colour of the front doors for each house in a street, usually you wouldn't be

Re: python list index - an easy question

2016-12-19 Thread BartC
On 19/12/2016 01:10, Ben Bacarisse wrote: BartC writes: On 18/12/2016 10:59, Paul Götze wrote: there is a nice short article by E. W. Dijkstra about why it makes sense to start numbering at zero (and exclude the upper given bound) while slicing a list. Might give a bit of additional

Re: python list index - an easy question

2016-12-19 Thread BartC
On 19/12/2016 13:48, Ben Bacarisse wrote: BartC writes: You need to take your C hat off, I think. It's a computing hat. Indexes are best seen as offsets (i.e. as a measured distances from some origin or base). A 1-based or N-based index can still be seen as an offset from element

Re: python list index - an easy question

2016-12-20 Thread BartC
On 20/12/2016 00:49, Steve D'Aprano wrote: On Mon, 19 Dec 2016 03:21 am, BartC wrote: On 18/12/2016 10:59, Paul Götze wrote: Hi John, there is a nice short article by E. W. Dijkstra about why it makes sense to start numbering at zero (and exclude the upper given bound) while slicing a

Re: learning and experimenting python.

2016-12-30 Thread BartC
material 3 levels deep (which on my newsreader is shown as coloured vertical bars on the left). -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: learning and experimenting python.

2016-12-30 Thread BartC
On 30/12/2016 19:09, einstein1...@gmail.com wrote: So what bartc? What until you have to try and figure out which is which! It's a disadvantage of using >>> -- https://mail.python.org/mailman/listinfo/python-list

Re: Cleaning up conditionals

2016-12-30 Thread BartC
nt to l1[st], so can never be true). Try writing it out on paper using A and B instead l1[st] and l2[st] as they look confusing. You might also be evaluating len(l2[st]) twice. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Cleaning up conditionals

2017-01-01 Thread BartC
hough the first thing encountered is X! More than a little unintuitive. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Using namedtuples field names for column indices in a list of lists

2017-01-11 Thread BartC
ometimes annoyingly so, but on the other hand precision is important, especially in technical fields. There's a *huge* difference between a MTA and a MUA, even though they differ only by one letter and both are related to email. There's a bigger difference between USB and USA! -- Bartc

Re: Byte-run: a Python interpreter written in Python

2017-01-13 Thread BartC
and all the rest would be more challenging. and doesn't include libraries. There doesn't seem to be much purpose to this other than it being a toy project written for a book. Being educational would be enough of a point. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Byte-run: a Python interpreter written in Python

2017-01-13 Thread BartC
On 13/01/2017 18:47, Ian Kelly wrote: On Fri, Jan 13, 2017 at 11:07 AM, BartC wrote: Even when it turns out that the actual code on github is 1000 lines rather than 500! Maybe it grew a bit since the 500 lines was quoted. I assume they're excluding blank lines, comments and docstrings.

Re: How coding in Python is bad for you

2017-01-23 Thread BartC
. Point 5 (memory leaks) I haven't experienced. Point 6 (libraries depending on libraries...) is probably true in other languages too. Point 7 (Python claiming to be general purpose) I don't have an opinion about. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How coding in Python is bad for you

2017-01-23 Thread BartC
On 23/01/2017 22:09, Chris Angelico wrote: On Tue, Jan 24, 2017 at 8:55 AM, BartC wrote: On 23/01/2017 17:34, Chris Angelico wrote: On Tue, Jan 24, 2017 at 4:24 AM, wrote: The article is here http://lenkaspace.net/index.php/blog/show/111 I would respond point-by-point if I thought the

Re: How coding in Python is bad for you

2017-01-23 Thread BartC
On 24/01/2017 00:56, Chris Angelico wrote: On Tue, Jan 24, 2017 at 11:44 AM, BartC wrote: With C++ or Java, it's possible to tell the indentation is wrong (because of the extra redundancy of having the indentation /and/ block delimiters). That's a bit harder in Python making s

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
nd they disagree, you have no clue what the time is. I've actually got three wall clocks. Usually only one will disagree with the other two, meaning it needs a new battery. But don't they use such systems in avionics? -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
On 24/01/2017 04:22, Steven D'Aprano wrote: On Tuesday 24 January 2017 13:38, Chris Angelico wrote: On Tue, Jan 24, 2017 at 12:47 PM, BartC wrote: if 0 then print ("one") print ("two") endif My point is that you *assume* that showing just "three" is

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
On 24/01/2017 11:58, Chris Angelico wrote: On Tue, Jan 24, 2017 at 10:52 PM, BartC wrote: Remember: If you have only one clock, it might be right and it might be wrong, but it's consistent. If you have two clocks and they disagree, you have no clue what the time is. I've actually

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
ditor. How would your editor detect the error in the example I gave earlier? (Where a tab has been inadvertently removed - or added - but the result is still valid Python code.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
On 24/01/2017 17:07, Steve D'Aprano wrote: On Tue, 24 Jan 2017 10:52 pm, BartC wrote: if condition: statement endif statement endif What's this code meant to do? Can't know. But whatever it does, a language that enforces 'endif' would report an er

Re: How coding in Python is bad for you

2017-01-24 Thread BartC
On 25/01/2017 01:04, Dennis Lee Bieber wrote: On Tue, 24 Jan 2017 17:50:56 +, BartC declaimed the following: If I've accidentally lost a space or tab while messing about with it, and it's significant, I would rather the compiler reported it! As I'm not going to spot it

Re: Need reviews for my book on introductory python

2017-01-26 Thread BartC
o us and allow us to edit it or suggest changes as needed? The amazon link lets you look at the first few pages free of charge. That might be enough to form an opinion. (The first pages do include a Hello World program; unfortunately it's in C not Python!) -- Bartc -- https://mail.py

Re: How coding in Python is bad for you

2017-01-29 Thread BartC
in a good light; nothing is ever a problem! But the author of piece didn't post it here. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Console

2018-03-07 Thread bartc
ialog that appears then, type cmd and the console window should appear. With Windows 10 all the useful apps that are now hard to find are listed by right-clicking the Start button. The console one is called Command Prompt. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   10   >