Re: How to make Python run as fast (or faster) than Julia

2018-02-22 Thread bartc
On 22/02/2018 16:00, Steven D'Aprano wrote: On Thu, 22 Feb 2018 12:03:09 +0000, bartc wrote: The idea of the Fibonacci benchmark is to test how effectively an implementation manages large numbers of recursive function calls. Then, fib(36) would normally involve 48,315,633 calls. This ve

Re: How to make Python run as fast (or faster) than Julia

2018-02-22 Thread bartc
calc+v3*v3 if rec=='1': v1, v2, v3 = v1+v2, v1, v2 return v2 fib(100) took 200ms seconds in Python 3. Printing the result about another 1.6 seconds. I think now it's down to the efficiency of the big integer library, as little bytecode is being exec

Re: How to make Python run as fast (or faster) than Julia

2018-02-22 Thread bartc
On 22/02/2018 14:02, Mark Lawrence wrote: On 22/02/18 12:03, bartc wrote: It might be a technique to bear in mind, but it is nonsensical to say this gives a 17,000 times speed-up over the original code. What makes you say that?  I have just run all of the code as given in the reference

Re: How to make Python run as fast (or faster) than Julia

2018-02-23 Thread bartc
On 23/02/2018 01:27, Steven D'Aprano wrote: On Thu, 22 Feb 2018 17:53:30 +0000, bartc wrote: The actual result is irrelevant, so long as its correct. The important thing is those 50 million calls. Why do you care about the 50 million calls? Because we are interested in comparing

Re: How to make Python run as fast (or faster) than Julia

2018-02-23 Thread bartc
sign of cpython.  It is a distributed project. Is numpy a general purpose C library that can also be called from any language that can use a C API? Or is it specific to Python? -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make Python run as fast (or faster) than Julia

2018-02-23 Thread bartc
On 23/02/2018 12:41, Chris Angelico wrote: On Fri, Feb 23, 2018 at 11:17 PM, bartc wrote: Integer pixel values Maybe in 64 bits for the time being, but 32 certainly won't be enough. Why, people's eyes will evolve to see quintillions of colours? As soon as you do any sort o

Re: How to make Python run as fast (or faster) than Julia

2018-02-23 Thread bartc
rs to sort a million integers using BubbleSort! Its too damn slow!!!" "Why not use the built-in sort? That's fast." "NOO I MUST USE BUBBLESORT, BECAUSE REASONS!!!1!" *wink* Have you ever written a benchmark in your life? If so, did it do anything useful? Othe

Re: How to make Python run as fast (or faster) than Julia

2018-02-23 Thread bartc
nchmark. So, what benchmark would you use instead if you wanted an idea of how well each language dealt with it? -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make Python run as fast (or faster) than Julia

2018-02-23 Thread bartc
On 23/02/2018 19:47, Chris Angelico wrote: On Sat, Feb 24, 2018 at 6:25 AM, bartc wrote: The difference between Python and another dynamic language might be a magnitude, yet you say it doesn't matter. Thanks, that makes me feel much better about my own work! If a magnitude differen

Re: How to make Python run as fast (or faster) than Julia

2018-02-23 Thread bartc
On 23/02/2018 20:12, Chris Angelico wrote: On Sat, Feb 24, 2018 at 7:02 AM, bartc wrote: I don't know what point you're making here. Unless it's that no software is worth writing unless it's done on a big scale with a huge team of people, and is very well known. My own p

Re: How to make Python run as fast (or faster) than Julia

2018-02-23 Thread bartc
On 24/02/2018 00:45, Dan Stromberg wrote: On Fri, Feb 23, 2018 at 1:32 PM, bartc wrote: But the difference in runtime speed between Python and other dynamic languages, if you look at benchmarks doing actual work in the language, can be much greater than two times, yet that doesn't appe

Re: How to make Python run as fast (or faster) than Julia

2018-02-24 Thread bartc
guage. If it doesn't, it won't. Benchmarks need to be honest. But Fibonacci I think can't use that optimisation (although gcc seems to have found another way of not that much work). -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make Python run as fast (or faster) than Julia

2018-02-24 Thread bartc
On 24/02/2018 02:05, Steven D'Aprano wrote: On Fri, 23 Feb 2018 19:25:35 +0000, bartc wrote: Python is 10 times slower than a competitor = doesn't matter My language is 1.5 times slower than the big boys' = matters a great deal As for Python's order-of-magnitude speed d

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
;>17) xs ^= (xs<<43) x = s+xcng+xs print ("Does x= 4013566000157423768") print (" x=",x) start() -- (The code performs N iterations of a random number generator. You get the result expected, ie. x=401...768, when N is a billion.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
On 26/02/2018 11:40, Chris Angelico wrote: On Mon, Feb 26, 2018 at 10:13 PM, bartc wrote: Below is the first draft of a Python port of a program to do with random numbers. (Ported from my language, which in turned ported it from a C program by George Marsaglia, the random number guy.) However

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
army of people working on acceleration projects and tracing JIT compilers. To those people however, such a benchmark can be a useful yardstick of progress.) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
On 26/02/2018 13:42, Ned Batchelder wrote: On 2/26/18 7:13 AM, bartc wrote: A C version is given below. (One I may have messed around with, which I'm not sure works properly. For an original, google for Marsaglia and KISS64 or SUPRKISS64.) Most integers are unsigned, which have

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
x27;hot paths' within a Python program, but optimises hot paths in the special Python interpreter. One written in [R]Python. Or something... -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
On 26/02/2018 14:04, bartc wrote: On 26/02/2018 13:42, Ned Batchelder wrote:  Well, once you notice that the Python code had N=1e5, and the C code had N=1e9 :)   If you want to experiment, with N=1e5, the final number should be 5255210926702073855. OK, I'll try that. I have that P

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
On 26/02/2018 15:09, Chris Angelico wrote: On Tue, Feb 27, 2018 at 2:02 AM, bartc wrote: On 26/02/2018 14:04, bartc wrote: On 26/02/2018 13:42, Ned Batchelder wrote: Well, once you notice that the Python code had N=1e5, and the C code had N=1e9 :) If you want to experiment, with N

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
On 26/02/2018 17:05, Ben Bacarisse wrote: bartc writes: A C version is given below. (One I may have messed around with, which I'm not sure works properly. For an original, google for Marsaglia and KISS64 or SUPRKISS64.) The version I know uses unsigned integers. Did you change th

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
ffect PyPy, which ran at the same speed with i64(), without it, or with both i64() and i64a().) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
On 26/02/2018 20:27, bartc wrote: On 26/02/2018 19:50, Chris Angelico wrote: On Tue, Feb 27, 2018 at 6:37 AM, Rick Johnson So what? Latency is latency. And whether it occurs over the course of one heavily recursive algorithm that constitutes the depth and breadth of an entire program (a la

Re: How to make Python run as fast (or faster) than Julia

2018-02-26 Thread bartc
second, so it's not bad going. Of course, the C version will generate them at over 100 million per second. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make Python run as fast (or faster) than Julia

2018-02-27 Thread bartc
On 27/02/2018 02:27, Chris Angelico wrote: On Tue, Feb 27, 2018 at 12:57 PM, bartc wrote: On 27/02/2018 00:35, Chris Angelico wrote: Anyway, even this pure Python version can deliver pseudo random numbers at some 200,000 per second, while the built-in generator does 450,000 per second, so

Re: Functions unnecessarily called in Python/pylifecycle.c:_Py_InitializeCore() ?

2018-03-01 Thread bartc
FromString("__builtins__"); if (builtin_object == NULL) return 0; return 1; } ) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-02 Thread bartc
m code resides there. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-04 Thread bartc
ns that when you did want to discard an expensive resource, then X going out of scope, calling del X or whatever, will not work if a copy of X still exists somewhere. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: RFC: Proposal: Deterministic Object Destruction

2018-03-05 Thread bartc
ssages when running on CPython 2.7 and 3.6, with the code run from a .py file. (I never use interactive mode.) But not when running on a PyPy version of 2.7 (however that is not CPython). -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to minimize the need of run time checks?

2016-08-10 Thread BartC
tomatically reboot and continue the calculation that was interrupted. By memory, it rebooted something like 30 or 40 times during the first moon landing. Wouldn't the same error just recur each time? Or was this a random hardware error rather than logic? -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: cmd prompt does not recognizes python command on Windows 7

2016-08-10 Thread BartC
e Python is installed): C:\Python\; (Or navigate to the end and type ;C:\Python\, assuming there are some settings already.) * Keep clicking OKs until it's done * Open the command prompt again and type 'python' to test. NOTE: I've assume Python is in C:\Python, but it mi

Re: cmd prompt does not recognizes python command on Windows 7

2016-08-10 Thread BartC
gram. But a bit of a cheat I think, and probably not good practice (suppose all your hundreds of apps put dedicated launchers into C:\windows which is supposed to be for OS stuff). (And if you're going to do that, you can also just put a one-line script in there to launch any program.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread BartC
some that also have dynamic types. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread BartC
On 12/08/2016 10:45, Chris Angelico wrote: On Fri, Aug 12, 2016 at 7:38 PM, BartC wrote: You can be too dynamic. Take an example like this: d.yaer=1999 print (d.day,d.month,d.year) This would never get past a static language nor some that also have dynamic types. Nor will it get

Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread BartC
On 12/08/2016 12:07, Steven D'Aprano wrote: On Fri, 12 Aug 2016 07:38 pm, BartC wrote: 'year' has been spelled wrongly How do you know? I know because my intention was to create a RECORD, with a specific set of members or fields. With records, you usually don't ju

Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread BartC
On 12/08/2016 12:55, BartC wrote: On 12/08/2016 12:07, Steven D'Aprano wrote: The first time I ever compiled a full-sized application (not a particular large one either, it was a text editor a little more featureful than Notepad) it took something like nine hours to compile on a Mac SE

Re: What's the best way to minimize the need of run time checks?

2016-08-12 Thread BartC
On 12/08/2016 23:12, Lawrence D’Oliveiro wrote: On Friday, August 12, 2016 at 9:39:11 PM UTC+12, BartC wrote: 'year' has been spelled wrongly That’s why Python has __slots__. OK. So when I said: > > My example was specifically about attribute names where pre-declaring >

Re: What's the best way to minimize the need of run time checks?

2016-08-13 Thread BartC
On 13/08/2016 08:37, Steven D'Aprano wrote: On Fri, 12 Aug 2016 09:55 pm, BartC wrote: I know because my intention was to create a RECORD, with a specific set of members or fields. With records, you usually don't just create arbitrary named members as you go along. Unfortun

Re: What's the best way to minimize the need of run time checks?

2016-08-13 Thread BartC
On 13/08/2016 12:10, Chris Angelico wrote: On Sat, Aug 13, 2016 at 8:09 PM, BartC wrote: And if subclassing isn't enough, there's no end of stuff you can do with decorators. Try this: class Foo: @prop class demo: """Declarative propert

Re: What's the best way to minimize the need of run time checks?

2016-08-13 Thread BartC
On 13/08/2016 13:08, BartC wrote: On 13/08/2016 12:10, Chris Angelico wrote: On Sat, Aug 13, 2016 at 8:09 PM, BartC wrote: And if subclassing isn't enough, there's no end of stuff you can do with decorators. Try this: class Foo: @prop class demo: ""&

Re: What's the best way to minimize the need of run time checks?

2016-08-13 Thread BartC
On 13/08/2016 17:06, Steven D'Aprano wrote: On Sat, 13 Aug 2016 08:09 pm, BartC wrote: record date=# define the record var day, month, year end d := date(25,12,2015) # create an instance Sure. But you've put most of the work into the compiler. Into th

Re: What's the best way to minimize the need of run time checks?

2016-08-14 Thread BartC
On 14/08/2016 05:13, Steven D'Aprano wrote: On Sun, 14 Aug 2016 06:59 am, BartC wrote: * The fields in my record are known at compile time There's nothing like that in Python. But the difference between compile-time and run-time is not that significant in practice (as opposed

Re: What's the best way to minimize the need of run time checks?

2016-08-14 Thread BartC
ts into the currently running program that invoked exec(). (Myself, I generally stay away from language building and extension features. I believe it leads to more complex languages - look at C++ - that can be difficult to follow.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to minimize the need of run time checks?

2016-08-14 Thread BartC
On 14/08/2016 14:18, Chris Angelico wrote: On Sun, Aug 14, 2016 at 8:49 PM, BartC wrote: Well, it's using exec(). So it is generating new program code at runtime. That is possible in quite a few languages, even C. It doesn't have to; that's only so it doesn't have to

Re: I am new to python. I have a few questions coming from an armature!

2016-08-17 Thread BartC
iscard. Anyway a?b:c was existing practice. At least the order of a,b,c could have been retained if not the exact syntax. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: integer's methods

2016-08-18 Thread BartC
Or use (123).bit_length() which looks slightly less odd. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread BartC
her issue, but it doesn't explain why the results with the /same version/ of Python are different. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to minimize the need of run time checks?

2016-08-29 Thread BartC
lly the above example is one of the easiest to perform type-inference on, where the variable has been assigned a known type on the previous line! -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to minimize the need of run time checks?

2016-08-29 Thread BartC
On 29/08/2016 15:00, Grant Edwards wrote: On 2016-08-29, Chris Angelico wrote: On Mon, Aug 29, 2016 at 10:13 PM, BartC wrote: In C, you can write this: int x; x = 5; x = "hello"; With certain compilers (eg. gcc) you only get a warning. (And since I don't show wa

Re: collect2: ld returned 1 exit status when building from source

2016-09-12 Thread BartC
something goes wrong. And this is a perfect example. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to extend a tuple of tuples?

2016-09-12 Thread BartC
general, new objects are constructed when implementing +=.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Why don't we call the for loop what it really is, a foreach loop?

2016-09-13 Thread BartC
31,2,3 -- (10,20,30)1,2,310,20,30 -- "ABC" 1,2,3 "A","B","C" 65,66,67 (works with both) 100 0,1,2...63 --0,0,1,0,0,1,1,0,...0 Getting back to Python, it only has one kind of for-loop and it has decided to call it "for". It's just one minor thing (among many) that has to be learned. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Cython taking more time than regular Python

2016-09-20 Thread BartC
my/ time doing pointless analysis.) This actually quite a good micro-benchmark precisely because that would be an unusual optimisation. (With benchmarking you usually want to know how long it takes a program to perform a task, not how long it takes to *not* do it!) -- Bartc -- https://mail.pyt

Re: I am newbie who can explain this code to me?

2016-09-20 Thread BartC
is: [d,d,d,d,d] [d] is a list, containing one item, a dict if that is what it is. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Data Types

2016-09-21 Thread BartC
nt (10<20)=> True print (type(10<20)) => -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Data Types

2016-09-22 Thread BartC
On 22/09/2016 02:40, Steve D'Aprano wrote: On Wed, 21 Sep 2016 10:25 pm, BartC wrote: On 21/09/2016 05:03, Cai Gengyang wrote: Are there any other data types that will give you type(A) or type(B) = besides True and False? No types but any variable or expression containing True or

Re: unintuitive for-loop behavior

2016-09-30 Thread BartC
ndex variable without worrying if it will clash with an existing local. But it's not useful enough I think to bother changing now. Or even when the language was designed. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: unintuitive for-loop behavior

2016-09-30 Thread BartC
ction-scope is plenty. Only one possible top-level 'A' in a function instead of an unlimited number. (Python allows extra 'A's inside nested functions and classes within that function, but that's a bit different.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: announcing fython

2016-10-02 Thread BartC
ortran compiler need to be invoked? (And do you need to install one, or is it all included?) If so, at what point in the above example is it invoked? Is it every time you run that Python code, or will the load() used a cached copy of the compiled mean.fy? -- Bartc -- https://mail.python.org/m

Re: Is that forwards first or backwards first? (Re: unintuitive for-loop behavior)

2016-10-03 Thread BartC
27;6th' at 70mph/110kph. Fortunately it doesn't actually go into reverse. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Is that forwards first or backwards first? (Re: unintuitive for-loop behavior)

2016-10-03 Thread BartC
| | R R R ? -- Bartc (It's OK, I'm Italian...) -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment versus binding

2016-10-05 Thread BartC
nce or twice, apparently my installation doesn't have any form of random() (despite being a monstrous 1700MB with 20,000 files). Not an easy language..) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment versus binding

2016-10-05 Thread BartC
On 05/10/2016 14:13, Rustom Mody wrote: On Wednesday, October 5, 2016 at 4:24:01 PM UTC+5:30, BartC wrote: On 05/10/2016 11:03, Ben Bacarisse wrote: spam io = do x <- io; print x; x <- io; print (x+1) (I downloaded Haskell (ghc) yesterday to tr

Re: Assignment versus binding

2016-10-05 Thread BartC
On 05/10/2016 14:43, Rustom Mody wrote: On Wednesday, October 5, 2016 at 7:05:02 PM UTC+5:30, BartC wrote: That's the one it can't find. Actually it can't seem to import any standard libraries, so the implementation must be screwed up. Or is it because I downloaded the Minima

Re: Assignment versus binding

2016-10-05 Thread BartC
On 05/10/2016 22:34, Chris Angelico wrote: On Thu, Oct 6, 2016 at 6:35 AM, BartC wrote: This is exactly why I persist with my own language implementations. My current one is only 1/5000th the size but standard libraries are included!) Yes, it has all the standard library that *you* expect

Re: User Interface Suggestions? (newbie)

2016-10-06 Thread BartC
had such a requirement before! I'd quite like to know too. However I've just tried a test sequence ("[P1d" to move the cursor to row 1) and it didn't work. If there's reason why something so basic won't work (hence the need for curses etc) then that would be useful to know too. (And how does curses manage it?!) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Assignment versus binding

2016-10-06 Thread BartC
On 06/10/2016 00:27, Chris Angelico wrote: On Thu, Oct 6, 2016 at 9:45 AM, BartC wrote: Small languages are perfectly viable: the JIT version of Lua, for example, is only about 225KB, and is very fast. If I wanted to send you program.lua, and you didn't have Lua, I only need t

Re: User Interface Suggestions? (newbie)

2016-10-06 Thread BartC
On 06/10/2016 13:38, Peter Otten wrote: BartC wrote: All this advice seems to be getting out of hand, with suggestions of 'curses' and 'blessings' and using GUI. I've tried 'ncurses' elsewhere and it was over the top for what I wanted to do. The OP wan

Re: A newbie doubt on methods/functions calling

2016-10-06 Thread BartC
will have trouble. What's the problem with typing "." and "(" anyway; keyboard problems? (If so then keep away from languages such as C and C++ because they have a /lot/ more punctuation!) Or used to a language that doesn't require (,) around function arguments? -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Doubled backslashes in Windows paths

2016-10-07 Thread BartC
error handler is expanding \ characters to \\. But the main error appears to be due to the presence of quotes, whether at each end, or inside the path, enclosing an element with spaces for example. Try using len(path)>1 instead; it might be near enough (the 1 sounds arbitrary anyway). -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Doubled backslashes in Windows paths

2016-10-07 Thread BartC
On 07/10/2016 13:39, BartC wrote: On 07/10/2016 06:30, Oz-in-DFW wrote: I'm getting an error message on an os.path.getsize call; But the main error appears to be due to the presence of quotes, whether at each end, or inside the path, enclosing an element with spaces for example. Try

Re: Doubled backslashes in Windows paths [Resolved]

2016-10-07 Thread BartC
/ ended with \ or / for that reason: so that you could just stick a file at the end without needing to check whether the path had the right ending or not. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread BartC
one character 8 billion times is likely to take quite a few hours too. The OP's code however is a good demonstration of how crazy Python's original for-range loop was: you need to construct a list of N elements just to be able to count to N. How many years was it until xrange wa

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread BartC
On 08/10/2016 11:54, Chris Angelico wrote: On Sat, Oct 8, 2016 at 9:12 PM, BartC wrote: On 08/10/2016 11:03, Chris Angelico wrote: On Sat, Oct 8, 2016 at 8:58 PM, meInvent bbird wrote: how to refactor nested for loop into smaller for loop assume each of them independent? because memory

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-09 Thread BartC
stand their code? How is anyone going to have confidence that any such code will work? And Python (suddenly remembering which group this is) is supposed to be more accessible than other languages. It's not Haskell. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Function to take the minimum of 3 numbers

2016-10-09 Thread BartC
t numbers tying for smallest is not meaningful; the caller can't tell if a minimum value of 42 came from a, b or c. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-09 Thread BartC
ds on the workload in the run() function being executed. Or only print every 1000th line or something if progress has to be monitored. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: How to process syntax errors

2016-10-10 Thread BartC
different with functions such as eval and exec. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Python code is compiled before execution

2016-10-11 Thread BartC
tive-code compilation. Here I might just say CPython if I'm assuming a normal byte-code compiler and byte-code interpreter model. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Is it possible Python can distinguish capital letter and small letter in the path of Windows?

2016-10-11 Thread BartC
On 11/10/2016 13:49, Dennis Lee Bieber wrote: Unfortunately, Windows is one of the poorest documented OS I've encountered The problem is more that there is too much documentation! -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Not getting output

2016-10-11 Thread BartC
x27;s coming Try adding: bg() at the end in order to call bg. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Python code is compiled before execution

2016-10-11 Thread BartC
On 11/10/2016 18:14, Steve D'Aprano wrote: On Wed, 12 Oct 2016 12:19 am, BartC wrote: Python is not really suited for AOT native-code compilation. You might be right, but the author of Nuitka disagrees. http://nuitka.net/ I tried the same thing with a dynamic language: translating

Re: while loop (Reposting On Python-List Prohibited)

2016-10-11 Thread BartC
t what is going on. 'else' can be used here: n=6 x=1 while x<=n: print "*"*x x+=1 while n>=x: n=n-1 print "*"* n else: print ("2nd loop exit n=",n,"x=",x) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: while loop (Reposting On Python-List Prohibited)

2016-10-12 Thread BartC
On 12/10/2016 05:30, Lawrence D’Oliveiro wrote: On Wednesday, October 12, 2016 at 11:23:48 AM UTC+13, BartC wrote: while n>=x: n=n-1 print "*"* n else: print ("2nd loop exit n=",n,"x=",x) What is the difference between that and while n&

Re: while loop (Reposting On Python-List Prohibited)

2016-10-12 Thread BartC
On 12/10/2016 11:15, Peter Otten wrote: BartC wrote: On 12/10/2016 05:30, Lawrence D’Oliveiro wrote: On Wednesday, October 12, 2016 at 11:23:48 AM UTC+13, BartC wrote: while n>=x: n=n-1 print "*"* n else: print ("2nd loop exit n=",n,"x=",x)

Re: Without compilation, how to find bugs?

2016-10-14 Thread BartC
the impression from some threads here that many apparently do little else in their code but bind and rebind function names.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: trying to make a simple program help please :)

2016-10-14 Thread BartC
ven though you've called the variable 'randomNUMBER'. With "b" in place of b, the program works on Python 3, although it doesn't verify bad inputs. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

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

2016-10-25 Thread BartC
ter (I don't know what it did about cursor keys, but maybe it didn't have any.) This gives you the ability to do (2) above. From that, you could do (1) (echoing) and go on to build full line-orientated input. But you had complete control. So, why has it all become so difficult? -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

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

2016-10-25 Thread BartC
On 25/10/2016 11:39, Dennis Lee Bieber wrote: On Tue, 25 Oct 2016 11:02:31 +0100, BartC declaimed the following: This gives you the ability to do (2) above. From that, you could do (1) (echoing) and go on to build full line-orientated input. But you had complete control. So, why has it all

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

2016-10-25 Thread BartC
On 25/10/2016 12:25, Chris Angelico wrote: On Tue, Oct 25, 2016 at 9:02 PM, BartC wrote: raw_input('Press the Enter key to continue... ') Which doesn't work on Python 3. So even here, making it easy by using line-input, it's not so straightforward. So you use input

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

2016-10-25 Thread BartC
should*. With my rare forays into GUI, that's exactly what I end up doing: in a loop waiting for events. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

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

2016-10-25 Thread BartC
On 25/10/2016 23:58, Chris Angelico wrote: On Wed, Oct 26, 2016 at 9:30 AM, BartC wrote: That still doesn't answer the fundamental question: Are you looking for KEYBOARD input or TEXT input? Does it matter that much? Because even if you opt for TEXT, the input (when interactive whi

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

2016-10-26 Thread BartC
On 26/10/2016 02:02, Steve D'Aprano wrote: On Tue, 25 Oct 2016 09:02 pm, BartC wrote: raw_input('Press the Enter key to continue... ') Which doesn't work on Python 3. So even here, making it easy by using line-input, it's not so straightforward. Really, Bart? You

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

2016-10-26 Thread BartC
On 26/10/2016 05:44, Marko Rauhamaa wrote: BartC : Some people want to work at low level, without needing to drag in a GUI, and want to do something as simple as finding out if a button has been pressed on a standard peripheral that nearly every computer has. It can't be that hard! I

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

2016-10-26 Thread BartC
On 26/10/2016 13:33, Marko Rauhamaa wrote: BartC : On 26/10/2016 05:44, Marko Rauhamaa wrote: (I've implemented 'keyboards' both on-screen, and on the surface of digitising tablets (also with a hacked Casio calculator pcb when I couldn't afford a real one). With all o

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

2016-10-26 Thread BartC
On 27/10/2016 00:30, Terry Reedy wrote: On 10/26/2016 7:18 AM, BartC wrote: Can tkinter do it without creating a distracting pop-up window at the same time? Yes. I already showed how on this thread. Of course, for some text appications, one would be better off with a Text widget than with

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

2016-10-27 Thread BartC
On 27/10/2016 07:51, Steven D'Aprano wrote: On Thursday 27 October 2016 12:12, BartC wrote: I don't understand the argument that a language shouldn't have a basic keyboard API because some computers it could run on might not have a keyboards. That's not the argument.

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

2016-10-27 Thread BartC
On 27/10/2016 11:07, Terry Reedy wrote: On 10/26/2016 9:12 PM, BartC wrote: On 27/10/2016 00:30, Terry Reedy wrote: So how does your tkinter example work in such a server? Without X-windows available, there would be no point, and it will not work. I presume including the X window

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

2016-10-27 Thread BartC
[repost as original disappeared] On 27/10/2016 12:41, Steve D'Aprano wrote: On Thu, 27 Oct 2016 09:42 pm, BartC wrote: I don't need one character at a time. I want to pause everything else, ask the user a question, and wait for them to enter an entire line. And no, I don't w

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

2016-10-27 Thread BartC
On 27/10/2016 17:13, Steve D'Aprano wrote: On Fri, 28 Oct 2016 12:13 am, BartC wrote: Doubtless your solution would be some large sledgehammer to crack this particular nut. *shrug* Python's a pretty high-level language. Not every low-level feature needs to be part of the Pytho

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