Re: why del is not a function or method?

2017-10-16 Thread bartc
ved here, and even a reference to team[2] won't help. Presumably there is no other way to do an in-place deletion of an element of a list. (Inserting an element is different.) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: why del is not a function or method?

2017-10-16 Thread bartc
ill have needed something special, for example: x = anything # any other undefined name which is currently not allowed. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: An endless loop

2017-10-16 Thread bartc
n't show is that the N-times and endless loops are probably used more with short test programs than in final applications, so having a very quick way to express them is convenient.) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: why del is not a function or method?

2017-10-16 Thread bartc
On 16/10/2017 18:46, Michael Torrie wrote: On 10/16/2017 11:21 AM, bartc wrote: del x effectively removes it from the namespace so trying to use it on line 4 generates the same 'undefined' error. However, the byte-code still needs to be aware of x: at the time when line 1 is executed

Re: why del is not a function or method?

2017-10-16 Thread bartc
On 17/10/2017 01:53, Steve D'Aprano wrote: On Tue, 17 Oct 2017 03:16 am, Oren Ben-Kiki wrote: That doesn't explain why `del` isn't a method though. `del` cannot be a method or a function, because the argument to `del` is the name of the variable, not the contents of the variable. If we writ

Re: why del is not a function or method?

2017-10-17 Thread bartc
argument). What does the second argument do? I thought Load and Store were of equal rank. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: why del is not a function or method?

2017-10-17 Thread bartc
On 17/10/2017 21:05, Chris Angelico wrote: On Wed, Oct 18, 2017 at 3:19 AM, bartc wrote: On 17/10/2017 16:44, Terry Reedy wrote: In CPython left-hand expressions are not merely quoted for runtime evaluation and use. They are parsed at compile time and compiled to almost normal bytecode

Re: integer copy

2017-10-20 Thread bartc
ng or with apportioning credits. Still, copying looks pretty complicated... -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Coding style in CPython implementation

2017-10-28 Thread bartc
? Which style would you prefer to read? Or do you prefer the more cryptic style in open source code? (The = vs. == issue is of one of numerous design flaws in C, but uglifying source code to get around it isn't the answer.) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Invoking return through a function?

2017-10-29 Thread bartc
in G. (What the OP wants was also proposed a few weeks back in comp.lang.c. But that was only within nested functions, so if H is inside G, and G is inside F, then a 'returnall' from H would return directly directly from F. Apparently Lisp allows this...) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Invoking return through a function?

2017-10-29 Thread bartc
is in the word 'exception'. It does seem that a lot of code uses exceptions which are routinely triggered. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Invoking return through a function?

2017-10-31 Thread bartc
nction): assem mov sp,[spvalue] mov bp,[bpvalue] jmp [recoverylabel] end -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread bartc
On 02/11/2017 01:19, Steve D'Aprano wrote: On Thu, 2 Nov 2017 08:21 am, Chris Angelico wrote: With the 'for' loop, it's a bit more arguable, but I've never seen anything more than a weak argument in favour of 'then' Thhpptpt! "else" is an completely inappropriate term that doesn't describe t

Re: replacing `else` with `then` in `for` and `try`

2017-11-01 Thread bartc
mediately following the loop. And there are some circumstances where the 'else' part is never executed. But if people prefer a different keyword, then why not? I think 'then' can be used, without impacting its use as an identifier, because it will always be followed by &q

Re: replacing `else` with `then` in `for` and `try`

2017-11-03 Thread bartc
t everyone. It may be necessary to use this to spell out exactly how it works: for i in r: pass ... after_normal_loop_termination_then: pass ... (And now, there is the possibility of having an additional 'else' clause to cover abnormal termination via break. This time what 'else' does is more obvious.) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread bartc
think it has to be if you want more than one iteration!), which means that sometimes, it will never break, then you get the Y/Y (or N/N) result. But the expectation is that there the break COULD be executed, so you will need the 'else'. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Easiest way to access C module in Python

2017-11-06 Thread bartc
from Python I think involves the ctypes module (I've never done it). Googling 'ctypes shared library' gives some promising results. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 02:23, Chris Angelico wrote: On Tue, Nov 7, 2017 at 12:52 PM, bartc wrote: Cython seems very confusing to me. Otherwise what /I/ would look for is ways to call C functions inside shared libraries (.dll and .so). That requires that the modules under test be wrapped as a

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 11:16, Chris Angelico wrote: On Tue, Nov 7, 2017 at 10:06 PM, bartc wrote: My experience is different. Thanks for the FUD. I love it when someone, on the basis of one failed experiment, trash-talks an excellent piece of software that would solve the OP's problem. OK, I

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
ther example here. (cffi doesn't seem to be part of any of my pythons, so that would be an obstacle for me as installing extra stuff rarely seems to work. Having said that, I located pip.exe, trying typing 'pip install cffi' and it seemed to be doing something but then failed with

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 12:14, Lele Gaifax wrote: bartc writes: But just staying with the "function with no arguments" for the minute (the equivalent of Hello World for this exercise), how would it be done in Cython? Would a working example be simple enough to show in a usenet post? fred.c:

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 13:11, bartc wrote: $ python setup.py build_ext --inplace OK, thanks. Although when I get to this bit, my system still says: 17.297 Traceback (most recent call last):   File "setup.py", line 1, in     from distutils.core import setup   Update:

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 13:30, Thomas Jollans wrote: On 2017-11-07 12:53, bartc wrote: Having said that, I located pip.exe, trying typing 'pip install cffi' and it seemed to be doing something but then failed with a bunch of errors.) So you're missing out on all of PyPI? That'

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
On 07/11/2017 14:33, Tim Golden wrote: On 07/11/2017 14:20, bartc wrote: You've lost me. I had to look up pyPI and it's something to do with a Package Index. But I don't know how that relates to installing Cython. Can I just step in now with my Moderator hat on and ask:

Re: Easiest way to access C module in Python

2017-11-07 Thread bartc
>>> import life   >>> dir(life)   ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__test__']   >>> works fine. Not really, as it's missing the attribute 'life' which is needed for the second part of 'life.life': But as I wrote, doing a:   python -vc "import life; print(life.life())" -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: converting numbers into words

2017-11-09 Thread bartc
On 09/11/2017 06:51, [email protected] wrote: How can I covert numbers into word like ex:-123 One hundred twenty three? google for something like "algorithm numbers to words". If this is homework, then it's not cheating as everyone else will be doing the same. > How can I covert numbe

Re: Ideas about how software should behave

2017-11-09 Thread bartc
On 09/11/2017 16:33, Chris Angelico wrote: On Fri, Nov 10, 2017 at 2:14 AM, Rurpy via Python-list wrote: On 11/08/2017 11:29 AM, Chris Angelico wrote: [...] Please, Jon, accept that we were not deliberately trying to put you down. Steve, if you can clearly state your position on this (possibly

Re: Ideas about how software should behave

2017-11-09 Thread bartc
On 09/11/2017 17:04, Chris Angelico wrote: On Fri, Nov 10, 2017 at 4:00 AM, bartc wrote: On 09/11/2017 16:33, Chris Angelico wrote: On Fri, Nov 10, 2017 at 2:14 AM, Rurpy via Python-list wrote: On 11/08/2017 11:29 AM, Chris Angelico wrote: [...] Please, Jon, accept that we were not

Re: Should constants be introduced to Python?

2017-11-17 Thread bartc
be desirable to have these constant too, for example: let def F(): -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Should constants be introduced to Python?

2017-11-17 Thread bartc
ht enums that do the same. They allow the possibility of an efficient 'switch' statement. And that's just for numeric constants. If applied also to constant defs, classes and imports, they introduce extra scope for compile-time optimising. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Benefits of unicode identifiers

2017-11-24 Thread bartc
already take care of those. But which keyboards will have π [copied from the one above!]? Apart perhaps from the ones in Greece, where π might already be heavily used in the same way we use 'p'. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: connect four (game)

2017-11-25 Thread bartc
what 'infinity' is actually for, rather than go to considerable lengths to test a class that may not actually be needed. And there's a quite lot left of the rest of the program to worry about too! If you add 'window()' at the end of the program, then it seems to r

Re: Argh!! Can't wrap my head around this Python stuff!

2017-11-26 Thread bartc
agic needed is on the other side of them. Calling into sys.fn() uses the same CALL_FUNCTION byte-code as calling into a regular Python function.) As I said, it's not pure. More of a jungle as you've found out.) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: connect four (game)

2017-11-26 Thread bartc
On 25/11/2017 16:07, Michael Torrie wrote: On 11/25/2017 06:00 AM, bartc wrote: And there's a quite lot left of the rest of the program to worry about too! If you add 'window()' at the end of the program, then it seems to run on Python 3. I'd play around with it firs

Re: connect four (game)

2017-11-26 Thread bartc
].flash() If you comment out those two lines, then the flashing disappears, and it still works. Of course, if I'd used unit tests, I'd have figured that out a lot sooner. I would just have had the somewhat bigger problem of devising a unit test that would detect this. -- bartc

Re: connect four (game)

2017-11-26 Thread bartc
On 26/11/2017 14:23, Chris Angelico wrote: On Mon, Nov 27, 2017 at 1:11 AM, bartc wrote: The way I write code isn't incrementally top down or bottom up. It's backwards and forwards. Feedback from different parts means the thing develops as a whole. Sometimes parts are split int

Re: connect four (game)

2017-11-27 Thread bartc
On 27/11/2017 03:04, Michael Torrie wrote: On 11/26/2017 08:39 AM, bartc wrote: The problem was traced to two lines that were in the wrong order (in the original program). I can't see how unit tests can have helped in any way at all, and it would probably have taken much longer. What

Re: While, If, Count Statements

2017-11-27 Thread bartc
On 27/11/2017 12:54, Cai Gengyang wrote: Input : count = 0 if count < 5: print "Hello, I am an if statement and count is", count while count < 10: print "Hello, I am a while and count is", count count += 1 Output : Hello, I am an if statement and count is 0 Hello, I am a while and

Re: connect four (game)

2017-11-27 Thread bartc
On 27/11/2017 13:57, Chris Angelico wrote: On Mon, Nov 27, 2017 at 10:38 PM, bartc wrote: Your decoder was straight-up buggy, and tests would have proven this. I created my Python version after the abysmal results from other Python decoders I tried which didn't work at all, gav

Re: connect four (game)

2017-11-27 Thread bartc
On 27/11/2017 17:41, Chris Angelico wrote: On Tue, Nov 28, 2017 at 2:14 AM, bartc wrote: JPEG uses lossy compression. The resulting recovered data is an approximation of the original. Ah but it is a perfect representation of the JPEG stream. Any given compressed stream must always decode to

Re: Goto

2017-12-28 Thread bartc
code. But it's not accessible from the language. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto

2017-12-29 Thread bartc
. (gotos are frowned upon because they make program flow harder to see within a normal structured program. However examples of 'advanced' Python I've seen are such that I would rather contend with a few gotos.) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto

2017-12-29 Thread bartc
m almost benign! (Except that Python would probably let you assign to labels...) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto

2017-12-29 Thread bartc
On 29/12/2017 20:25, Chris Angelico wrote: On Sat, Dec 30, 2017 at 7:03 AM, bartc wrote: On 29/12/2017 18:55, MarkA wrote: On Thu, 28 Dec 2017 00:58:48 -0200, Duram wrote: How to use goto in python? --- This email has been checked for viruses by AVG. http://www.avg.com Rather than ask

Re: Goto

2017-12-29 Thread bartc
On 29/12/2017 21:56, Stefan Ram wrote: Chris Angelico writes: On Sat, Dec 30, 2017 at 8:03 AM, D'Arcy Cain wrote: On 12/29/2017 02:25 PM, Chris Angelico wrote: PHP also added goto to a later version. Ahh, great choice of example. "It's okay - PHP does it." I thought that that was a reason

Re: Goto (Posting On Python-List Prohibited)

2017-12-29 Thread bartc
On 29/12/2017 21:55, Lawrence D’Oliveiro wrote: On Saturday, December 30, 2017 at 9:03:50 AM UTC+13, bartc wrote: Why most newer, higher level languages don't, I don't know. Perhaps because the people who design them want to make programming harder? I don’t use gotos in C code. Why

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread bartc
On 30/12/2017 03:05, Lawrence D’Oliveiro wrote: On Saturday, December 30, 2017 at 12:12:23 PM UTC+13, bartc wrote: Looking at 14 million lines of Linux kernel sources, which are in C, over 100,000 of them use 'goto'. About one every 120 lines. That kind of thing leads to spaghetti c

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread bartc
On 30/12/2017 16:53, mm0fmf wrote: On 30/12/2017 14:41, bartc wrote: it looks a bit naff Understatement of 2017. I'm honest about my own ideas, but my remarks were about the use of special symbols such as "::" and "@". Before completely dismissing it howeve

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread bartc
On 30/12/2017 20:36, Ben Bacarisse wrote: bartc writes: On 30/12/2017 16:53, mm0fmf wrote: On 30/12/2017 14:41, bartc wrote: it looks a bit naff Understatement of 2017. I'm honest about my own ideas, but my remarks were about the use of special symbols such as "::" a

Re: Goto (Posting On Python-List Prohibited)

2017-12-30 Thread bartc
On 30/12/2017 23:26, Gregory Ewing wrote: bartc wrote: B and C occur twice, so a goto is a quick way to reuse B and C without needing to duplicate code, This only works if the repeated part happens to be at the tail of each case. IME that seems to be the most common situation. Any other

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 30/12/2017 23:54, Chris Angelico wrote: On Sun, Dec 31, 2017 at 10:45 AM, bartc wrote: On 30/12/2017 23:26, Gregory Ewing wrote: bartc wrote: B and C occur twice, so a goto is a quick way to reuse B and C without needing to duplicate code, This only works if the repeated part happens

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 12:41, Chris Angelico wrote: On Sun, Dec 31, 2017 at 11:33 PM, bartc wrote: On 30/12/2017 23:54, Chris Angelico wrote: I've written code that uses dirty tricks like that to avoid duplication. It's at least as much of a problem as actual duplication is. Generally,

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 15:02, Ben Bacarisse wrote: bartc writes: I think there's a problem with that. Standard C does not have them, you said your language does not implement them properly (The real problem is I don't remember local functions being used anywhere else. It's an idi

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 17:06, Chris Angelico wrote: On Mon, Jan 1, 2018 at 3:55 AM, bartc wrote: The suggestion was to use them to avoid gotos. If duplicating is a good idea (and it's a hard line to draw) then we are not talking about the same cases. Given the choice of "dragging in named

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 19:29, bartc wrote: [Ignore the original, incomplete version of my post, which appears after the sig. I decided to actually try it out for real instead of just guessing! Good thing too.] -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
n still contain break or return (and in my syntax, several other loop controls). It loses context as soon as it's hoisted into a function. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto (Posting On Python-List Prohibited)

2017-12-31 Thread bartc
On 31/12/2017 17:01, [email protected] wrote: Further I've never once in 17 years of using Python been tearing my hair out over the lack of goto Neither have I over all the advanced features of Python I never use, and for double that number of years. Yet for some they will be as indisp

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread bartc
On 01/01/2018 00:40, MRAB wrote: On 2017-12-31 23:21, bartc wrote: [Block delimiting] proc fn2(int a)= ... end (or possibly "inline f123="). [snip] OT: if "case ... esac" and "if ... fi", why not "proc ... corp"? :-) (I don't think Al

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread bartc
lly intent on making life difficult. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Goto (Posting On Python-List Prohibited)

2018-01-01 Thread bartc
On 01/01/2018 15:06, From wrote: (Posting On Python-List Prohibited) why ? Huh? I'm posting to the usenet group comp.lang.python (an off-topic reply to an off-topic remark, but it happens). I've no idea what the prohibited part is about, if that's what you're pos

Re: Goto

2018-01-02 Thread bartc
On 29/12/2017 18:11, Chris Angelico wrote: On Sat, Dec 30, 2017 at 4:13 AM, bartc wrote: If you want to translate code from one language to another, and the source language uses gotos, or uses control structures not available in the target language, then gotos would be very useful in the

Re: Goto

2018-01-02 Thread bartc
On 02/01/2018 15:20, Chris Angelico wrote: On Wed, Jan 3, 2018 at 1:51 AM, bartc wrote: I like to write code in a simple, clean, universal style that everyone can understand. That doesn't mean it has to look like Fortran. Why are you using a Python interpreter then? Why are you he

Re: Why does __ne__ exist?

2018-01-07 Thread bartc
1 (y) 4 COMPARE_OP 7 (not in) I get '4 COMPARE OP6 (in)' here. So they are distinct ops. 'not in' doesn't just call 'in', then apply 'not'. Not here anyway. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Why does __ne__ exist?

2018-01-07 Thread bartc
On 07/01/2018 21:51, Chris Angelico wrote: On Mon, Jan 8, 2018 at 7:41 AM, bartc wrote: Maybe someone wants to do weird stuff with == that doesn't yield a true or false result, so that you can't just reverse it for !=. For example (perhaps this is similar to what was suggested

Re: Tips or strategies to understanding how CPython works under the hood

2018-01-10 Thread bartc
quite fast, especially LuaJIT, but the language is also smaller and simpler.) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Simple graphic library for beginners

2018-01-10 Thread bartc
On 10/01/2018 14:55, Antoon Pardon wrote: On 10-01-18 13:40, Jan Erik Moström wrote: I'm looking for a really easy to use graphic library. The target users are teachers who have never programmed before and is taking a first (and possible last) programming course. I would like to have the abilit

Re: Simple graphic library for beginners

2018-01-10 Thread bartc
terminates.) The only way to get it simpler than that is where the display window is always present (like some old Basics). -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Tips or strategies to understanding how CPython works under the hood (Posting On Python-List Prohibited)

2018-01-10 Thread bartc
On 10/01/2018 23:31, Lawrence D’Oliveiro wrote: On Thursday, January 11, 2018 at 1:08:25 AM UTC+13, bartc wrote: But I'm not convinced that register-based is necessarily faster. Not if your code is dominated by memory accesses, as a dynamic language is likely to be. But ask the peopl

Re: Simple graphic library for beginners

2018-01-11 Thread bartc
On 11/01/2018 05:16, Michael Torrie wrote: On 01/10/2018 01:13 PM, bartc wrote: Yes the link didn't have the simple examples I hoped for. How's this: - import pygame import time pygame.init() screen = pygame.display.set_mode((1024, 768) ) red = (255,

Re: Simple graphic library for beginners

2018-01-11 Thread bartc
On 11/01/2018 15:23, Chris Angelico wrote: On Fri, Jan 12, 2018 at 12:38 AM, bartc wrote: Although I can't run it because 'pygame' is not available. I think installing this library is likely to be a bigger obstacle than programming any graphics! (If I try and download it a

Re: Simple graphic library for beginners

2018-01-11 Thread bartc
On 11/01/2018 18:42, Chris Angelico wrote: On Fri, Jan 12, 2018 at 5:33 AM, bartc wrote: Well, that seemed to do something, and it didn't need me to download any .whl files. But then I noticed a bunch of errors culminating with: "Command python setup.py egg_info failed with error

Re: Simple graphic library for beginners

2018-01-11 Thread bartc
On 11/01/2018 19:41, Paul Moore wrote: On 11 January 2018 at 18:33, bartc wrote: python -m pip install XXX just works, for 99% of things anyone wants. In particular it works for pygame. Continuing to complain about a situation that has been resolved for a year or more I tried that

Re: Simple graphic library for beginners

2018-01-11 Thread bartc
On 11/01/2018 20:12, Chris Angelico wrote: On Fri, Jan 12, 2018 at 7:02 AM, bartc wrote: On 11/01/2018 19:41, Paul Moore wrote: On 11 January 2018 at 18:33, bartc wrote: python -m pip install XXX just works, for 99% of things anyone wants. In particular it works for pygame

Re: Simple graphic library for beginners

2018-01-11 Thread bartc
On 11/01/2018 20:53, Chris Angelico wrote: On Fri, Jan 12, 2018 at 7:34 AM, bartc wrote: It failed on my 3.6, it failed on 3.4, it failed on 3.7 (is what 'pip' does really so leading edge?), and finally worked on a brand-new 3.6. In case you haven't figured it out by

Re: Simple graphic library for beginners

2018-01-11 Thread bartc
On 11/01/2018 22:32, Chris Angelico wrote: On Fri, Jan 12, 2018 at 9:21 AM, bartc wrote: As I understand it, pygame is just another add-on, which doesn't inherently need to use .whl format, and which doesn't inherently need to use 'pip' package installer. I even saw somew

Re: Simple graphic library for beginners

2018-01-11 Thread bartc
On 11/01/2018 23:23, Chris Angelico wrote: On Fri, Jan 12, 2018 at 10:11 AM, bartc wrote: I'm almost ready to plonk you, but I think there is still SOME value in your posts. But please, stop denigrating what you don't understand. And please try to see things from the pointer of

Re: Simple graphic library for beginners

2018-01-12 Thread bartc
On 12/01/2018 01:56, Chris Angelico wrote: On Fri, Jan 12, 2018 at 12:21 PM, bartc wrote: On 11/01/2018 23:23, Chris Angelico wrote: On Fri, Jan 12, 2018 at 10:11 AM, bartc wrote: I'm almost ready to plonk you, but I think there is still SOME value in your posts. But please,

Re: python to C code generator

2018-01-17 Thread bartc
On 17/01/2018 11:04, kushal bhattacharya wrote: Hi, Is there any python framework or any tool as which can generate C code from python code as it is . What C code would you expect to see from this line of Python: a = b + c ? -- https://mail.python.org/mailman/listinfo/python-list

Re: Can't get python running

2018-01-20 Thread bartc
you can open a command prompt. If not in python364, then substitute the actual installation path. Or click Start, and type python.exe into the search box. If it finds it, click it. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Can't get python running

2018-01-20 Thread bartc
On 21/01/2018 01:21, Chris Angelico wrote: On Sun, Jan 21, 2018 at 12:08 PM, bartc wrote: On 20/01/2018 17:16, Jim Sadler wrote: I downloaded python 3.6.4 and although everything about the installation seems correct (path, file size, checking on cmd to see if file installed correctly-it is

Re: Can't get python running

2018-01-21 Thread bartc
On 21/01/2018 01:52, Chris Angelico wrote: On Sun, Jan 21, 2018 at 12:40 PM, bartc wrote: Get it working anywhere first to find out what the problem is. Get it working in the default location before you change things. The %PATH% environment variable exists to save you from typing seven

Re: python to C code generator

2018-01-23 Thread bartc
nd a simpler one, as 'a=b+c' translates to 'a+b+c;' in C. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: python to C code generator

2018-01-23 Thread bartc
On 23/01/2018 13:34, bartc wrote: Perhaps you simply want to use Python syntax to write C code? That would > be a different kind of translator. And a simpler one, as 'a=b+c' > translates to 'a+b+c;' in C. Or rather, 'a=b+c;' (I've written source t

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-17 Thread bartc
- typically badly suited to interactive or exploratory programming, and less flexible; - may give the programmer a false sense of security that just because the program compiles, it must be bug-free. If the static language doesn't have flexible arrays, that can be a bit of

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-17 Thread bartc
e and complex also leading to such issues, where no one individual can see the whole picture. For example, in the system used for building CPython from source. But I guess what you're describing doesn't apply in such cases. Those 20K or 30K lines of configure scripts really /are/ nec

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-17 Thread bartc
On 17/02/2018 22:09, Chris Angelico wrote: On Sun, Feb 18, 2018 at 8:50 AM, bartc wrote: That's a very interesting observation. I've frequently made the complaint about systems that I consider large and complex also leading to such issues, where no one individual can see the who

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-17 Thread bartc
On 18/02/2018 00:45, Chris Angelico wrote: On Sun, Feb 18, 2018 at 11:13 AM, bartc wrote: It's text, but it is an intermediate or "object" file. It's not doing pointless stuff; it's coping with the myriad platforms and variants that Python has support for. It could

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-18 Thread bartc
On 18/02/2018 01:39, Chris Angelico wrote: On Sun, Feb 18, 2018 at 12:31 PM, bartc wrote: On 18/02/2018 00:45, Chris Angelico wrote: On Sun, Feb 18, 2018 at 11:13 AM, bartc wrote: It's text, but it is an intermediate or "object" file. It's not doing pointless stuff;

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-18 Thread bartc
blems such as redundancy. I'm taking the opportunity to say that that can apply in many other situations too. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-18 Thread bartc
odd numbers from 1 to 10 inclusive work? (That, a type consisting of one of the values in {1,3,5,7,9}.) Would they be ordered or unordered? Can I do arithmetic with them: will 3*3 work, but not 3*5? This is where keeping things simple pays off. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-19 Thread bartc
On 19/02/2018 02:59, Chris Angelico wrote: On Mon, Feb 19, 2018 at 1:14 PM, bartc wrote: How would even a type for the odd numbers from 1 to 10 inclusive work? (That, a type consisting of one of the values in {1,3,5,7,9}.) Would they be ordered or unordered? Can I do arithmetic with them

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread bartc
, that have types associated with them). That's scope; Python has that too. (Although not C's block scopes and its bizarre rules which mean that you can have up 5 different 'x' meanings even within the same block. And an unlimited number of 'x' scopes within the s

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread bartc
done at runtime and can't be conditional). Operators are static and cannot overridden. AFAIK, all these are dynamic in Python (not sure about operators).) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread bartc
ch older people prefer to round upwards, for some reason). So age is usually colloquially specified as an integer from 1 to around 100. Other than for young children where the lack of precision requires the use of fractions or to switch to whole numbers of months or weeks. -- bartc -- https:

Re: Are the critiques in "All the things I hate about Python" valid? (Posting On Python-List Prohibited)

2018-02-20 Thread bartc
On 20/02/2018 19:35, Lawrence D’Oliveiro wrote: On Wednesday, February 21, 2018 at 1:43:41 AM UTC+13, bartc wrote: In Pascal (and presumably Ada) then all the gubbins need to make this work properly: var x: 1..10; x = 10; x = x + 1; { error? } Error on both statements. Pascal

Re: Are the critiques in "All the things I hate about Python" valid?

2018-02-20 Thread bartc
On 20/02/2018 20:17, MRAB wrote: On 2018-02-20 19:17, bartc wrote: On 20/02/2018 19:04, Dennis Lee Bieber wrote: On Tue, 20 Feb 2018 17:11:05 +, "Wild, Marcel, Prof " declaimed the following: So the special type of the values 65..90 might not allow the type be multiplied

Re: Writing some floats in a file in an efficient way

2018-02-21 Thread bartc
proaches, have you tried outputting the numbers more than one at a time? I found that list or tuple of 10 floats produced a file of 98 or 97 bytes, a somewhat smaller overhead. 10,000, about 90KB, a 10% overhead. -- bartc -- https://mail.python.org/mailman/listinfo/python-list

Re: Writing some floats in a file in an efficient way

2018-02-21 Thread bartc
On 21/02/2018 15:54, ast wrote: Le 21/02/2018 à 15:02, bartc a écrit : On 21/02/2018 13:27, ast wrote: Time efficient or space efficient? space efficient If the latter, how many floats are we talking about? 10^9 OK. My experiment of writing the same 64-bit float a billion times to a

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

2018-02-22 Thread bartc
times speed-up over the original code. Here's another speed-up I found myself, although it was only 50 times faster, not 17,000: just write the code in C, and call it via os.system("fib.exe"). But you /do/ need to write it in a different language.) -- bartc -- https://mail.python.org/mailman/listinfo/python-list

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

2018-02-22 Thread bartc
On 22/02/2018 12:03, bartc wrote: On the fib(20) test, it suggests using this to get a 30,000 times speed-up: BTW while doing my tests, I found you could redefine the same function with no error: def fred(): pass def fred(): pass def fred(): pass For classes too

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