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

2018-02-19 Thread Alain Ketterlin
Steven D'Aprano writes: > On Mon, 19 Feb 2018 09:40:09 +0100, Alain Ketterlin wrote: > >> Tim Delaney writes: >> >> [...] >>> As others have said, typing is about how the underlying memory is >>> treated. >> >> No. It is much more t

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

2018-02-19 Thread Alain Ketterlin
Chris Angelico writes: > On Mon, Feb 19, 2018 at 9:04 PM, Alain Ketterlin > wrote: >> Look at the C11 standard, section 6.3.2.3 ("Pointers"), 6.5.§6-7 >> ("effective types"), and 6.5.3.2 ("Address and indirection operators"). >> It i

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

2018-02-19 Thread Alain Ketterlin
Chris Angelico writes: > On Mon, Feb 19, 2018 at 7:40 PM, Alain Ketterlin > wrote: >> No. C has much stronger rules, not on casting, but on accessing the >> pointees, which basically invalidates your argument. Refer to the C >> standard for details. > > Really

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

2018-02-19 Thread Alain Ketterlin
too complex to capture, testing will be incomplete, and all you can do is run your program and see whether is goes through. As a general rule, if that's all you expect from typing, then, fine, call this "strong". I won't go as far, and just say that it is good enough for th

Re: "None" and "pass"

2018-02-05 Thread Alain Ketterlin
any side-effect and/or throw an exception). And be fired right after your first code review. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Doubt in line_profiler documentation

2018-01-27 Thread Alain Ketterlin
/conventional resolution. By the way, the use of gettimeofday() is strange since this function is now deprecated... clock_gettime() should be used instead. It has an associated clock_getres() as well. -- Alain. [*] WTF is wrong with these microsoft developpers? Clocks and performance counters are

Re: CSV file edition

2018-01-09 Thread Alain Ketterlin
ck that 39 is correct). Your data look like fixed-width fields. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

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

2018-01-09 Thread Alain Ketterlin
w Lua operates too? No. Lua uses a register-based (virtual) machine. See https://www.lua.org/doc/jucs05.pdf I think Lua was the first language in widespread use to move to a register-based machine. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: integer copy

2017-10-20 Thread Alain Ketterlin
hod, | nor stack trace, stack frame, nor file, socket, window, nor array, nor | any similar types. But who knows what "similar types" are... -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Typo-squatting PyPi

2017-09-17 Thread Alain Ketterlin
loaded to a Chinese IP address. NBU officials contacted PyPI | administrators last week who removed the packages before officials | published a security advisory on Saturday." -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Proposed new syntax

2017-08-11 Thread Alain Ketterlin
expressions (but I still dislike it, and don't think such a feature requires syntactic support). -- Alain. [1] https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries -- https://mail.python.org/mailman/listinfo/python-list

[OT] Re: how to guess the number of cluster when do not know?

2017-08-04 Thread Alain Ketterlin
Ho Yeung Lee writes: > i find kmeans has to input number of cluster [...] https://en.wikipedia.org/wiki/Determining_the_number_of_clusters_in_a_data_set Completely off-topic on this group/list, please direct your questions elsewhere. -- Alain. -- https://mail.python.org/mailman/listi

Re: Write this accumuator in a functional style

2017-07-11 Thread Alain Ketterlin
b,g,r = collect(list_of_parrots[1:]) h = list_of_parrots[0] if h.color == 'blue': return ([h]+b,g,r) elif h.color == 'green': ... and so on -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Text-mode apps (Was :Who are the "spacists"?)

2017-04-01 Thread Alain Ketterlin
ave tried this once. "Next time you're fired/dead" (and less pleasant variants) was the only comment I got from people I shared files with. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Who are the "spacists"?

2017-03-19 Thread Alain Ketterlin
ded. > Remember, kids: Just Say No to the Invisible Menace. And US government officials call them "alternative spaces". Enough said. -- Alain. P/S: just in case: https://www.jwz.org/doc/tabs-vs-spaces.html -- https://mail.python.org/mailman/listinfo/python-list

Re: When will os.remove fail?

2017-03-12 Thread Alain Ketterlin
emove work like this under Windows too? No, Windows has its own set of rules: https://msdn.microsoft.com/en-us/library/bb727008.aspx > Under what circumstances will os.remove fail to remove a file? > > If you don't own the file and have no write permission, if it is on > read-only media, anything else? I'm not sure which system you are asking about, here. See above. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: The hardest problem in computer science...

2017-01-06 Thread Alain Ketterlin
d horizontal line elements? Box-drawing characters. At least that's how Unicode calls them. Even if you don't draw boxes... https://en.wikipedia.org/wiki/Box-drawing_character -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why does this list swap fail?

2016-11-14 Thread Alain Ketterlin
taneously), you just overwrite the first element twice. Congratulations, a very good corner case (you can't call it a bug, since it conforms to the definition of the language). -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to pick out the same titles.

2016-10-16 Thread Alain Ketterlin
tle will > have the date a year off. > > What I would like to do it output to another file that show those two > as a match. Try the difflib module (read the doc, its default behavior may be surprising). -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to process syntax errors

2016-10-14 Thread Pierre-Alain Dorange
python to understand your new syntax, just write a small interpreter to translate your new language to python. -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses

Re: How to process syntax errors

2016-10-12 Thread Pierre-Alain Dorange
m just an amateur developer. But what confuse me, is that Python require "real live" interpratation of the code to work properly (or perhaps i also confuse on that but Python rely on interpretation of the code to conform to its own standard, ie variables can change type during execution...) -- Pierre

Re: Python code is compiled before execution

2016-10-11 Thread Pierre-Alain Dorange
trange the initial request. And sure, i overinterpret or simplify thing (compiling)... But it seems that all this talk do not interested the initial requester (Mr Puneet) : at that time he has not answer to the thread. -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/&

Re: Python code is compiled before execution

2016-10-11 Thread Pierre-Alain Dorange
interpretation, byte-code compilation, JIT compilation, AOT compilation... So yes Python compile (bytecode). -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licens

Re: How to process syntax errors

2016-10-11 Thread Pierre-Alain Dorange
means it is most definitely > meant to be able to be caught. Using compile() function yes. So yes there is a way to check "syntax error" before executing code (using compile function and exceptions) but it was not standard, nor widely used... It was still a hack for me, but perhaps

Re: How to process syntax errors

2016-10-10 Thread Pierre-Alain Dorange
uested but that only a hack and should not be used in real world. -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- 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 Alain Ketterlin
t I haven't checked). Are you sure this is your (real) problem? -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: BeautifulSoup help !!

2016-10-07 Thread Pierre-Alain Dorange
ve the page, extract data, extract last river level and mean the 24h last levels. <https://www.dropbox.com/sh/k5974t374zmcoj6/AACes_Xo5DrxCbE1RjSaeKXYa?dl=0> Note : it was probably not beautiful python code, but it works for the purpose it was written. -- Pierre-Alain Dorange

Re: Problem with difflib SequenceMatcher

2016-09-12 Thread Alain Ketterlin
ns no matching blocks). It is all due to the "Autojunk" heuristics (see difflib's doc for details), which considers the first characters as junk. Call SM(...,autojunk=False). I have no idea why the maintainers made this stupid autojunk idea the default. Complain with them. -- Al

Re: Creating a calculator

2016-07-04 Thread Pierre-Alain Dorange
DFS wrote: > > 2 lines? Love it! > > But apparently eval==evil. > > http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html > > I bet you get hammered about it here on clp. It was a software to be deploy, it was just for educational purpose.

Re: Well, I finally ran into a Python Unicode problem, sort of

2016-07-03 Thread Alain Ketterlin
l#identifiers To me it makes a lot of sense to *not* include category Sm characters in identifiers, since they are usually used to denote operators (like +). It would be very confusing to have a variable named ∇f, as confusing as naming a variable a+b or √x. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a calculator

2016-07-01 Thread Pierre-Alain Dorange
- env={} env["__builtins__"] = None u=raw_input('Enter calculation:") print eval(u,env) - -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a calculator

2016-07-01 Thread Pierre-Alain Dorange
;*':c=n1*n2 > if op=='/':c=n1/n2 > print(ui+' = '+str(c)) > --- More reduced : -- u=raw_input('Enter calculation:") print eval(u) -- works and compute : 1+2+3+4-1+4*2 2+3.0/2-0.5 Pe

Re: Assignment Versus Equality

2016-06-27 Thread Alain Ketterlin
he poor sod who wrote the compiler think it was a good idea? I don't know, but he has a good excuse: he was one of the first to ever write a compiler (see https://en.wikipedia.org/wiki/Compiler, the section on History). You just called John Backus a "poor sod". Think again. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Empty List

2016-06-27 Thread Pierre-Alain Dorange
;something" that perhaps will fill the list (word.append("hello"). Then after do your job, you perhaps need to print it. But initializing and just print, will do nothing else than initialize and print the result... As state before this code more or less like : a=0 print a -- P

Re: Break and Continue: While Loops

2016-06-24 Thread Pierre-Alain Dorange
something must exist first. -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: Can math.atan2 return INF?

2016-06-24 Thread Pierre-Alain Dorange
Marko Rauhamaa wrote: > Note that the "valid point of view for external observers" is the only > valid scientific point of view. For a scientific point of view, right. But tell this to the one that will be close to a blackhole ;-) -- Pierre-Alain Dorange Moof <

Re: Can math.atan2 return INF?

2016-06-23 Thread Pierre-Alain Dorange
Steven D'Aprano wrote: > > which infinity. There are many - some larger than others > > China has just announced a new supercomputer that is so fast it can run an > infinite loop in 3.7 seconds. Near a black hole 3.7 seconds can last an infinite time... -- Pierre-Alain

Re: Can math.atan2 return INF?

2016-06-23 Thread Pierre-Alain Dorange
ncy is always atan2(y,x) tend to pi/4 if you looks at lot od y and x that will be grater and greater each time : the final frontier would always be pi/4, even if t take a long time to reach it. -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence C

Re: [tkinter] widget size adjustment

2016-06-22 Thread Pierre-Alain Dorange
not explore this, i just thought NSEW was also CENTERED. Many Thanks. -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: [tkinter] widget size adjustment

2016-06-22 Thread Pierre-Alain Dorange
pmx-bigmap> the tkinter code is in pmx.py the canvas class was TMap GUI was created in main_gui.__init__() callback function was main_gui.resize() -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons &quo

Re: Can math.atan2 return INF?

2016-06-22 Thread Pierre-Alain Dorange
been NaN too but i'm not a math expert, but the limit of atan2 would be 45°, so pi/4 radians (0,7854). As x,y are coordinates, the both infinite would tend toward 45°. x only infinite would be 0° (0 radians) y only infinite woudl be 180° (pi/2 radians) -- Pierre-Alain Dorange&

Re: Can math.atan2 return INF?

2016-06-21 Thread Pierre-Alain Dorange
Steven D'Aprano wrote: > py> math.atan2(NAN, 0) > nan > > I think that the only way it will return a NAN is if passed a NAN. yes of course if you pass an invalid argument (NAN is not a real value, atan2 except coordinate x,y), the result would be invalid... --

Re: [tkinter] widget size adjustment

2016-06-21 Thread Pierre-Alain Dorange
to see a different portion. So i except the map to be resized to show a bigger portion of the whole map : no streching. -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.

Re: Can math.atan2 return INF?

2016-06-21 Thread Pierre-Alain Dorange
quadrant (for angle answer). -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: [tkinter] widget size adjustment

2016-06-21 Thread Pierre-Alain Dorange
he cell where the canvas widget is put). I think i can resize the canvas, but i can't find a way to get the available space after resize. Perhaps using the grid manager is not the godd idea for that ? I except it was more understandable. -- Pierre-Alain Dorange<http://microwar.sour

[tkinter] widget size adjustment

2016-06-19 Thread Pierre-Alain Dorange
at to do from that. Any clue or advice or tutorial ? -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: Detecting repeated subsequences of identical items

2016-04-21 Thread Alain Ketterlin
e a job for a suffix trees. Depending on what you are after, you may also be interested in the sequitur algorithm (http://www.sequitur.info/). -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Serious error in int() function?

2016-04-13 Thread Alain Ketterlin
"float". See http://floating-point-gui.de/ for a nice explanation. Use decimal (https://docs.python.org/2/library/decimal.html) if you need exact representations. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: A new module for performing tail-call elimination

2015-07-16 Thread Alain Ketterlin
ator has a corresponding fixed-point combinator called Y*. There is quite a bit of theory behind this, anybody interested can google, e.g., "Y combinator mutual recursion", whose first result is: http://stackoverflow.com/questions/4899113/fixed-point-combinator-for-mutually-recursive-functions -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Can Python function return multiple data?

2015-06-05 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> Grant Edwards writes: >> >> [...] >>> Or to be a bit obtuse: Python parameters are passed by value, but all >>> values are references. >> >> Exactly, that's a perfect description. Ther

Re: Can Python function return multiple data?

2015-06-05 Thread Alain Ketterlin
attributes) are references. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Can Python function return multiple data?

2015-06-05 Thread Alain Ketterlin
Steven D'Aprano writes: > On Fri, 5 Jun 2015 04:17 am, Alain Ketterlin wrote: > >> Steven D'Aprano writes: >> >> [...] >>> But you still find a few people here and there who have been exposed to >>> Java foolishness, and will argue that

Re: Can Python function return multiple data?

2015-06-04 Thread Alain Ketterlin
, reference to 23. No, Java doesn't work like that for primitive types (assuming that by "Java" you mean the language and execution environment defined in reference documents). -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: fork/exec & close file descriptors

2015-06-03 Thread Alain Ketterlin
random...@fastmail.us writes: > On Wed, Jun 3, 2015, at 03:11, Alain Ketterlin wrote: >> Thank you, I know this. What I mean is: what are the reasons that you >> cannot access your file descriptors one by one? To me closing a range of >> descriptors has absolutely no me

Re: fork/exec & close file descriptors

2015-06-03 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> Marko Rauhamaa writes: >>> First, if close() fails, what's a poor program to do? >> >> Warn the user? Not assume everything went well? It all depends on the >> application, and what the file descripto

Re: fork/exec & close file descriptors

2015-06-03 Thread Alain Ketterlin
Chris Angelico writes: > On Wed, Jun 3, 2015 at 7:06 AM, Alain Ketterlin > wrote: >> I've no idea what the OP's program was doing, so I'm not going to split >> hairs. I can't imagine why one would like to mass-close an arbitrary set >> of file desc

Re: fork/exec & close file descriptors

2015-06-02 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> The close(2) manpage has the following warning on my Linux system: >> >> | Not checking the return value of close() is a common but >> | nevertheless serious programming error. It is quite possible that >> | err

Re: fork/exec & close file descriptors

2015-06-02 Thread Alain Ketterlin
especially be observed with NFS and with disk quota. | (I haven't followed the thread, but if your problem is to make sure fds are closed on exec, you may be better off using the... close-on-exec flag. Or simply do the bookkeeping.) -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Using Python instead of Bash

2015-05-31 Thread Alain Ketterlin
'media=A4', > output]) > p.wait() Maybe using check_call() would be simpler, but it will, well, check for the exit code of convert/lpr (which you should do anyway). And I would call that variable "threshold" instead of "treshold". (What I don't see is the advantage you find in writing such scripts in python instead of sh, but I guess you have your own reasons.) -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: subprocess.Popen zombie

2015-05-20 Thread Alain Ketterlin
s). > I suppose I needed to keep a record of all the pid's and wait on them > at some convenient time. Yes. > The subprocess version appears to be doing that for me somehow. Not sure what you mean. You have to do the bookkeeping yourself. (But, does beep really take so much time that you can't just call() it?) -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Throw the cat among the pigeons

2015-05-07 Thread Alain Ketterlin
Dave Angel writes: > On 05/06/2015 11:36 AM, Alain Ketterlin wrote: >> Yes, plus the time for memory allocation. Since the code uses "r *= >> ...", space is reallocated when the result doesn't fit. The new size is >> probably proportional to the current (in

Re: Throw the cat among the pigeons

2015-05-06 Thread Alain Ketterlin
ge > as your timings, but I think it still gives some explanation of the > effect. Yes, plus the time for memory allocation. Since the code uses "r *= ...", space is reallocated when the result doesn't fit. The new size is probably proportional to the current (insufficient) size

Re: Am I missing something here? ipaddress vs socket

2015-05-01 Thread Alain Ketterlin
k.AF_INET == 2 > sock.AF_INET6 == 10 > ip.version == 4 or 6 Check the value of the "version" attribute. Or use socket.getaddrinfo(), which is more convenient if all you need is an address parser. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Best search algorithm to find condition within a range

2015-04-09 Thread Alain Ketterlin
Chris Angelico writes: > On Thu, Apr 9, 2015 at 11:57 PM, Alain Ketterlin > wrote: >> Because, in: >> >> z = x+y; // all signed ints >> if ( z < x ) >> ... >> >> either there was no overflow (and the condition is false), or

Re: Best search algorithm to find condition within a range

2015-04-09 Thread Alain Ketterlin
; for unsigned and for signed, while the underlying architecture of >> every twos complement machine I have used did add, subtract, and >> multiply as though the numbers were unsigned (what you call modular >> arithmetic). > > Alain did have a point. *If* I had used int64_t in my

Re: Best search algorithm to find condition within a range

2015-04-09 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> No, it would not work for signed integers (i.e., with lo and hi of >> int64_t type), because overflow is undefined behavior for signed. > > All architectures I've ever had dealings with have used 2's-complement &g

Re: Best search algorithm to find condition within a range

2015-04-09 Thread Alain Ketterlin
both for signed and unsigned integers. (Slightly off-topic, but...) No, it would not work for signed integers (i.e., with lo and hi of int64_t type), because overflow is undefined behavior for signed. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Socket ICMP V6 error

2015-01-22 Thread Alain Ketterlin
fo on "FE80...%eth0" (change eth0 to the name of the interface you want to use) to get a valid 4-tuple. Use that instead of your (HOST,0). You can also try '::' (kind of inaddr6_any), I don't know if that's what you want. But I think you can't bind a raw socket

Re: OTish: using short-term TCP connections to send to multiple slaves

2014-11-16 Thread Alain Ketterlin
here is a pysctp module on pypi. (Haven't tried it, I've just made a quick search on SCTP in Python.) Or roll your own protocol on top of UDP, but that's another story. [...] -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Send UDP packet to link-local IPv6 address?

2014-10-29 Thread Alain Ketterlin
t;,port,...) should work for you (family, socktype etc should be passed also to avoid searching the results of getaddrinfo()). Hope this helps, -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Truthiness

2014-10-23 Thread Alain Ketterlin
zero of all types, and empty strings and containers (including strings, tuples, lists, dictionaries, sets and frozensets). All other values are interpreted as true." (links are to the 2.7 version of the reference manual, I think not much has changed in 3.* versions.) -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: (test) ? a:b

2014-10-23 Thread Alain Ketterlin
0 else 3 > <=> > j = (lambda: 3, lambda: j + 1)[j < 10]() This is just a way to delay evaluation *of the potential results*, i.e., instill a bit of lazyness. One could object that, again, both expressions in the tuple have been evaluated (building two lambdas), only one of which is finally called. I guess that's what BartC meant. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: your mail

2014-10-18 Thread Alain Ketterlin
: >for line in open('flooding-psiphi.dat','r'): >x, y, z = map(float, line.split()) >xs.append(x) >ys.append(y) >zs.append(z) Or even: xs,ys,zs = zip(*[ map(float,line.split()) for line in open('flooding-psiphi.dat&#

Re: OT: This Swift thing

2014-06-07 Thread Alain Ketterlin
Mark Lawrence writes: > On 07/06/2014 09:20, Alain Ketterlin wrote: >> Sturla Molden writes: >>>>>> Many of these students suggest Python as the >>>>>> development language (they learned it and liked it), and the suggestion >>>>>

Re: OT: This Swift thing

2014-06-07 Thread Alain Ketterlin
Sturla Molden writes: > Alain Ketterlin wrote: >> Sturla Molden writes: >> >>> Alain Ketterlin wrote: >>> >>>> Many of these students suggest Python as the >>>> development language (they learned it and liked it), and the suggestio

Re: OT: This Swift thing

2014-06-06 Thread Alain Ketterlin
Sturla Molden writes: > On 05/06/14 22:27, Alain Ketterlin wrote: >> I have seen dozens of projects where Python was dismissed because of the >> lack of static typing, and the lack of static analysis tools. [...] > When is static analysis actually needed and for what purpose?

Re: OT: This Swift thing

2014-06-06 Thread Alain Ketterlin
Chris Angelico writes: > On Fri, Jun 6, 2014 at 7:23 AM, Mark Lawrence wrote: >> On 05/06/2014 21:07, Alain Ketterlin wrote: >>> >>> Sturla Molden writes: >>> >>>> On 05/06/14 10:14, Alain Ketterlin wrote: >>>> >>>>>

Re: OT: This Swift thing

2014-06-06 Thread Alain Ketterlin
Sturla Molden writes: > Alain Ketterlin wrote: > >> Many of these students suggest Python as the >> development language (they learned it and liked it), and the suggestion >> is (almost) always rejected, in favor of Java or C# or C/C++. > > And it was almost a

Re: OT: This Swift thing

2014-06-06 Thread Alain Ketterlin
Terry Reedy writes: > On 6/5/2014 4:07 PM, Alain Ketterlin wrote: > >>> When I compile Cython modules I use LLVM on this computer. >> >> Cython is not Python, it is another language, with an incompatible >> syntax. > > Cython compiles Python with optional e

Re: OT: This Swift thing

2014-06-06 Thread Alain Ketterlin
Travis Griggs writes: >> On Jun 5, 2014, at 1:14, Alain Ketterlin wrote: >> >> Swift's memory management is similar to python's (ref. counting). Which >> makes me think that a subset of python with the same type safety would >> be an instant success.

Re: OT: This Swift thing

2014-06-05 Thread Alain Ketterlin
Chris Angelico writes: > On Fri, Jun 6, 2014 at 6:07 AM, Alain Ketterlin > wrote: >>> Perhaps, perhaps not. My experience is that only a small percentage of >>> the CPU time is spent in the Python interpreter. >> >> Basically, you're saying that a major

Re: OT: This Swift thing

2014-06-05 Thread Alain Ketterlin
Chris Angelico writes: > On Thu, Jun 5, 2014 at 7:42 PM, Alain Ketterlin > wrote: >> Chris Angelico writes: >> >>> On Thu, Jun 5, 2014 at 6:14 PM, Alain Ketterlin >>> wrote: >>>> Swift's memory management is similar to python's (

Re: OT: This Swift thing

2014-06-05 Thread Alain Ketterlin
Sturla Molden writes: > On 05/06/14 10:14, Alain Ketterlin wrote: > >> Type safety. > > Perhaps. Python has strong type safety. Come on. [...] >>(And with it comes better performance ---read battery >> life--- and better static analysis tools, etc.) > > Pe

Re: OT: This Swift thing

2014-06-05 Thread Alain Ketterlin
Chris Angelico writes: > On Thu, Jun 5, 2014 at 6:14 PM, Alain Ketterlin > wrote: >> Swift's memory management is similar to python's (ref. counting). Which >> makes me think that a subset of python with the same type safety would >> be an instant success.

Re: OT: This Swift thing

2014-06-05 Thread Alain Ketterlin
middle- and back-end, and a brand new front-end incorporating a decent type system (including optional types for instance). Swift's memory management is similar to python's (ref. counting). Which makes me think that a subset of python with the same type safety would be an instant success

Re: Fortran

2014-05-14 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> The real nice thing that makes Julia a different language is the >> optional static typing, which the JIT can use to produce efficient code. >> It's the only meaningful difference with the current state of python.

Re: Fortran

2014-05-13 Thread Alain Ketterlin
Mark H Harris writes: > On 5/12/14 3:44 AM, Alain Ketterlin wrote: >> When you are doing scientific computation, this overhead is >> unacceptable, because you'll have zillions of computations to perform. > > I'm still trying to sort that out. I have not teste

Re: Fortran (Was: The "does Python have variables?" debate)

2014-05-12 Thread Alain Ketterlin
Mark H Harris writes: > On 5/11/14 12:05 PM, Alain Ketterlin wrote: >>> Julia is Matlab and R, Python, Lisp, Scheme; all rolled together on >>> steroids. Its amazing as a dynamic language, and its fast, like >>> lightning fast as well as multiprocessing (parall

Re: Fortran (Was: The "does Python have variables?" debate)

2014-05-11 Thread Alain Ketterlin
also Matlab, Mathematica, NumPy, & SciPy (and > others). Keep your eye on her fellows. Well, Fortran experts around me are skeptic. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: How can this assert() ever trigger?

2014-05-10 Thread Alain Ketterlin
ry: 1.*1e-162*1e-162. Equals zero. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: parsing multiple root element XML into text

2014-05-09 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> which does an exact traversal of potential the DOM tree... (assuming a >> DOM is even defined on a non well-formed XML document). >> >> Anyway, my point was only to warn the OP that he is not doing XML. > > I c

Re: parsing multiple root element XML into text

2014-05-09 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> Marko Rauhamaa writes: >>> Sometimes the XML elements come through a pipe as an endless >>> sequence. You can still use the wrapping technique and a SAX parser. >>> However, the other option is to write a t

Re: parsing multiple root element XML into text

2014-05-09 Thread Alain Ketterlin
Marko Rauhamaa writes: > Alain Ketterlin : > >> Technically speaking, this is not a well-formed XML document (it is a >> well-formed external general parsed entity, though). If you have other >> XML processors in your workflow, they will/should reject it. > > S

Re: parsing multiple root element XML into text

2014-05-09 Thread Alain Ketterlin
orkflow, they will/should reject it. The easiest fix is to wrap this inside a root element (see other messages in this thread), or use a DTD-declared entity to include this fragment in a document. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: A curious bit of code...

2014-02-13 Thread Alain Ketterlin
gt; if key.startswith('<') and key.endswith('>'): ... > > and: > > if (key[:1], key[-1:]) == ('<', '>'): ... I would do: if key[0] == '<' and key[-1] == '>' ... -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Flag control variable

2014-02-12 Thread Alain Ketterlin
luke.gee...@gmail.com writes: > Can I make it that if > C = int(sys.argv[3]) > But when I only enter 2 argumentvariable it sets c automaticly to 0 or 1 C = int(sys.argv[3]) if len(sys.argv) > 3 else 0 is one possibility. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to write this as a list comprehension?

2014-01-18 Thread Alain Ketterlin
a x:e)(v) In your case: [ (lambda na,ti : somefunc(ti[1],ti[2],ti[6],na))(name,localtime(then)) for then,name in mylist ] Warning: absolutely untested (not even syntax-checked). You may also use *localtime(...) and keep underscores. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: using ffmpeg command line with python's subprocess module

2013-12-03 Thread Alain Ketterlin
pipes (FIFOs) or the /dev/fd method of naming open files. It |takes the form of <(list) or >(list). The process list is run |with its input or output connected to a FIFO or some file in |/dev/fd. The name of this file is passed as an argument to the |current command as the result of the expansion. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list

Re: Basic Python Questions - Oct. 31, 2013

2013-10-31 Thread Alain Ketterlin
Mark Lawrence writes: > On 31/10/2013 13:17, Alain Ketterlin wrote: >> "E.D.G." writes: >> >>>The calculation speed question just involves relatively simple >>> math such as multiplications and divisions and trig calculations such >>

Re: Basic Python Questions - Oct. 31, 2013

2013-10-31 Thread Alain Ketterlin
Chris Angelico writes: > On Fri, Nov 1, 2013 at 12:17 AM, Alain Ketterlin > wrote: >> "E.D.G." writes: >> >>> The calculation speed question just involves relatively simple >>> math such as multiplications and divisions and trig calculation

  1   2   3   >