Re: Useless expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Chris Angelico
On Mon, Mar 28, 2016 at 1:59 PM, Tim Chase wrote: > On 2016-03-28 12:38, Chris Angelico wrote: >> I would still look askance at code that adds two things and drops >> the result, though. The compiler can't discard it, but if a linter >> complains, I'd support that. A DSL that requires you to do th

Re: Useless expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Tim Chase
On 2016-03-28 12:38, Chris Angelico wrote: > I would still look askance at code that adds two things and drops > the result, though. The compiler can't discard it, but if a linter > complains, I'd support that. A DSL that requires you to do this is, > imo, poorly designed. Is it only the "*add* tw

Useless expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Steven D'Aprano
On Mon, 28 Mar 2016 01:43 am, BartC wrote: [... talk about function and procedures ...] > Well, that could be done in Python (not so usefully because you can't > take account of such info until a call is attempted), but that's not > what I'm talking about, which is simply allowing: > >fn(...)

Re: Useless expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Chris Angelico
On Mon, Mar 28, 2016 at 12:24 PM, Steven D'Aprano wrote: >> >>f() # Probably OK >>g() # Probably OK >>f()+g() # Probably not OK > > You don't and can't know what's "probably not" okay unless you know what > type of object both f and g return. > > Don't think about f

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Paul Rubin
Steven D'Aprano writes: > if condition: > print(1) > print(2) > else: > print(3) > print(4) > what value should it return? Justify your choice. It could whatever value that the last call to print() returns. Lisp has worked like that since the 1950's. > What should be the return

Useless expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Steven D'Aprano
On Mon, 28 Mar 2016 03:39 am, Terry Reedy wrote: > On 3/27/2016 11:48 AM, Ned Batchelder wrote: >> On Sunday, March 27, 2016 at 10:43:49 AM UTC-4, BartC wrote: > >>> whether fn has an explicit return or not, and not allowing: >>> >>> fn # and other kinds of expression >>> >>> unless s

Re: How to make Python interpreter a little more strict?

2016-03-27 Thread Steven D'Aprano
On Mon, 28 Mar 2016 07:49 am, BartC wrote: > On 27/03/2016 21:32, Tim Chase wrote: >> On 2016-03-27 14:28, Steven D'Aprano wrote: > >>> In this case, the two lines "fnc" and "next" simply look up the >>> function names, but without actually calling them. They're not >>> quite "no-ops", since they

Useless expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Steven D'Aprano
On Sun, 27 Mar 2016 10:31 pm, BartC wrote: > On 27/03/2016 07:34, Paul Rubin wrote: >> BartC writes: >>> But my suggestion was to have required a keyword in front of >>> such expressions. >> >> Should there be a keyword in front of a line containing "sqrt(x)" ? >> What about "launch(missiles)"

Re: Suggestion: make sequence and map interfaces more similar

2016-03-27 Thread Steven D'Aprano
On Mon, 28 Mar 2016 05:01 am, Marco S. wrote: > Steven D'Aprano wrote: > >> The point you might have missed is that treating lists as if they were >> mappings violates at least one critical property of mappings: that the >> relationship between keys and values are stable. > > > This is true for

Statements as expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Steven D'Aprano
On Mon, 28 Mar 2016 03:58 am, BartC wrote: >> One of Guido's principles in designing Python was to keep it simple, >> even where that might mean people could make errors with it. This part >> of the language is no different: any expression can be a statement. > > Yeah, but even simpler would be

Re: help with program

2016-03-27 Thread Steven D'Aprano
On Mon, 28 Mar 2016 01:18 am, Bob Gailer wrote: > The problem with putting input at the end of a program is: if the program > raises an exception you won't see it. True. But the solution to that is simple: don't make mistakes when programming :-) If you have a better solution, please speak up. I

Re: List of Functions

2016-03-27 Thread Ben Bacarisse
Richard Riehle writes: > Several months ago, I posted a question regarding how to create a list > of functions. > I realize that this seems trivial to many experience Pythonistas. But > it might prove useful for those who are relative newcomers to the > language. In any case, I hope someone ca

Re: Calling the source command from subprocess.popen to update the os.environ.

2016-03-27 Thread Hongyi Zhao
On Sun, 27 Mar 2016 13:24:05 +, Hongyi Zhao wrote: > # replace env > os.environ.clear() I find another method which can solve this issue, ie., changing the above code into the follows: # ref : http://unix.stackexchange.com/questions/178522/unsetting- environment-variable-with-an-empty-name

Re: How to make Python interpreter a little more strict?

2016-03-27 Thread Nobody
On Sat, 26 Mar 2016 23:30:30 +, John Pote wrote: > So I have sympathy with the OP, I would expect the compiler to pick this > up Why? The code is valid, the compiler knows how to generate the appropriate bytecode for it. The compiler isn't "lint". Reporting code which is actually invalid is

Re: List of Functions

2016-03-27 Thread Erik
Hi Richard, On 27/03/16 20:38, Richard Riehle wrote: I realize that this seems trivial to many experience Pythonistas. But it might prove useful for those who are relative newcomers Thanks for sharing your solution (people finding the original question because it happens to match their own

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread BartC
On 27/03/2016 22:55, Ned Batchelder wrote: On Sunday, March 27, 2016 at 4:19:12 PM UTC-4, BartC wrote: On 27/03/2016 18:19, Ned Batchelder wrote: On Sunday, March 27, 2016 at 12:58:23 PM UTC-4, BartC wrote: There would be a list of expression terms that can also form independent statements.

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Ned Batchelder
On Sunday, March 27, 2016 at 4:19:12 PM UTC-4, BartC wrote: > On 27/03/2016 18:19, Ned Batchelder wrote: > > On Sunday, March 27, 2016 at 12:58:23 PM UTC-4, BartC wrote: > > >> There would be a list of expression terms that can also form independent > >> statements. Not knowing Python, the list wo

Re: How to make Python interpreter a little more strict?

2016-03-27 Thread Chris Angelico
On Mon, Mar 28, 2016 at 7:49 AM, BartC wrote: > On 27/03/2016 21:32, Tim Chase wrote: >> >> On 2016-03-27 14:28, Steven D'Aprano wrote: > > >>> In this case, the two lines "fnc" and "next" simply look up the >>> function names, but without actually calling them. They're not >>> quite "no-ops", sin

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Oscar Benjamin
On 27 Mar 2016 23:11, "Ben Bacarisse" wrote: > > Steven D'Aprano writes: > > > On Sun, 27 Mar 2016 05:13 pm, Paul Rubin wrote: > > > >> Steven D'Aprano writes: > >>> For example, would you consider that this isolated C code is > >>> "meaningless"? > >>> int i = n + 1; > >> > >> It's meaningful a

Re: How to make Python interpreter a little more strict?

2016-03-27 Thread BartC
On 27/03/2016 21:32, Tim Chase wrote: On 2016-03-27 14:28, Steven D'Aprano wrote: In this case, the two lines "fnc" and "next" simply look up the function names, but without actually calling them. They're not quite "no-ops", since they can fail and raise NameError if the name doesn't exist, bu

Re: How to make Python interpreter a little more strict?

2016-03-27 Thread Tim Chase
On 2016-03-27 14:28, Steven D'Aprano wrote: > > So intrigued by this question I tried the following > > def fnc( n ): > > print "fnc called with parameter '%d'" % n > > return n > > > > for i in range(0,5): > > if i%2 == 0: > > fnc > > next > > print i > > >

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread BartC
On 27/03/2016 18:19, Ned Batchelder wrote: On Sunday, March 27, 2016 at 12:58:23 PM UTC-4, BartC wrote: There would be a list of expression terms that can also form independent statements. Not knowing Python, the list would comprise function calls (ie. the function call is top node in the AST

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Ben Bacarisse
Steven D'Aprano writes: > On Sun, 27 Mar 2016 05:13 pm, Paul Rubin wrote: > >> Steven D'Aprano writes: >>> For example, would you consider that this isolated C code is >>> "meaningless"? >>> int i = n + 1; >> >> It's meaningful as long as n is in a certain range of values so there's >> no overf

List of Functions

2016-03-27 Thread Richard Riehle
Several months ago, I posted a question regarding how to create a list of functions. I quickly solved the problem on my own, but I am just now getting around to sharing my solution. It was actually quite simple, and also quite useful for the problem I had at hand. Below is an example of one w

Re: Suggestion: make sequence and map interfaces more similar

2016-03-27 Thread Mark Lawrence
On 27/03/2016 19:01, Marco S. via Python-list wrote: Mark Lawrence wrote: I cannot see this happening unless you provide a patch on the bug tracker. However I suspect you can get the same thing by subclassing dict. Why don't you try it and let us know how you get on? The problem with a vdi

Re: Help with python script for NMR

2016-03-27 Thread mohamadmaaz5
On Sunday, March 27, 2016 at 7:40:06 PM UTC+2, Peter Otten wrote: > mohamadma...@gmail.com wrote: > > > On Sunday, March 27, 2016 at 4:50:01 PM UTC+2, Joel Goldstick wrote: > >> On Sun, Mar 27, 2016 at 10:38 AM, wrote: > >> > >> > Hello there, > >> > I found a python script in a scientific artic

Re: Suggestion: make sequence and map interfaces more similar

2016-03-27 Thread Marco S. via Python-list
Steven D'Aprano wrote: > The point you might have missed is that treating lists as if they were > mappings violates at least one critical property of mappings: that the > relationship between keys and values are stable. This is true for immutable maps, but for mutable ones, you can simply do ma

Re: Help with python script for NMR

2016-03-27 Thread Peter Otten
mohamadma...@gmail.com wrote: > On Sunday, March 27, 2016 at 4:50:01 PM UTC+2, Joel Goldstick wrote: >> On Sun, Mar 27, 2016 at 10:38 AM, wrote: >> >> > Hello there, >> > I found a python script in a scientific article that enables a simple >> > calculation on an NMR spectrum. >> > I have no exp

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Ned Batchelder
On Sunday, March 27, 2016 at 12:58:23 PM UTC-4, BartC wrote: > On 27/03/2016 16:48, Ned Batchelder wrote: > > On Sunday, March 27, 2016 at 10:43:49 AM UTC-4, BartC wrote: > >> On 27/03/2016 14:47, Dennis Lee Bieber wrote: > > >> Well, that could be done in Python (not so usefully because you can't

Re: Help with python script for NMR

2016-03-27 Thread Wildman via Python-list
On Sun, 27 Mar 2016 09:40:57 -0700, mohamadmaaz5 wrote: > On Sunday, March 27, 2016 at 6:27:59 PM UTC+2, Wildman wrote: >> On Sun, 27 Mar 2016 09:15:39 -0700, mohamadmaaz5 wrote: >> >> > On Sunday, March 27, 2016 at 6:07:43 PM UTC+2, Wildman wrote: >> >> On Sun, 27 Mar 2016 08:13:49 -0700, mohama

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread BartC
On 27/03/2016 16:48, Ned Batchelder wrote: On Sunday, March 27, 2016 at 10:43:49 AM UTC-4, BartC wrote: On 27/03/2016 14:47, Dennis Lee Bieber wrote: Well, that could be done in Python (not so usefully because you can't take account of such info until a call is attempted), but that's not what

Re: Help with python script for NMR

2016-03-27 Thread mohamadmaaz5
On Sunday, March 27, 2016 at 6:27:59 PM UTC+2, Wildman wrote: > On Sun, 27 Mar 2016 09:15:39 -0700, mohamadmaaz5 wrote: > > > On Sunday, March 27, 2016 at 6:07:43 PM UTC+2, Wildman wrote: > >> On Sun, 27 Mar 2016 08:13:49 -0700, mohamadmaaz5 wrote: > >> > >> >> > Hello there, > >> >> > I found a

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Terry Reedy
On 3/27/2016 11:48 AM, Ned Batchelder wrote: On Sunday, March 27, 2016 at 10:43:49 AM UTC-4, BartC wrote: whether fn has an explicit return or not, and not allowing: fn # and other kinds of expression unless some keyword is used. Python *could* have made it an error to have a u

Re: Help with python script for NMR

2016-03-27 Thread Peter Pearson
On Sun, 27 Mar 2016 08:13:49 -0700 (PDT), mohamadma...@gmail.com wrote: > On Sunday, March 27, 2016 at 4:50:01 PM UTC+2, Joel Goldstick wrote: >> On Sun, Mar 27, 2016 at 10:38 AM, wrote: >> >> > Hello there, >> > I found a python script in a scientific article that enables a simple >> > calculati

Re: Help with python script for NMR

2016-03-27 Thread Wildman via Python-list
On Sun, 27 Mar 2016 09:15:39 -0700, mohamadmaaz5 wrote: > On Sunday, March 27, 2016 at 6:07:43 PM UTC+2, Wildman wrote: >> On Sun, 27 Mar 2016 08:13:49 -0700, mohamadmaaz5 wrote: >> >> >> > Hello there, >> >> > I found a python script >> >> The formatting of the script is all wrong. There are m

Re: Help with python script for NMR

2016-03-27 Thread mohamadmaaz5
On Sunday, March 27, 2016 at 6:07:43 PM UTC+2, Wildman wrote: > On Sun, 27 Mar 2016 08:13:49 -0700, mohamadmaaz5 wrote: > > >> > Hello there, > >> > I found a python script > > The formatting of the script is all wrong. There are many > spaces that should not be there and no indentations. It >

Re: Why lambda in loop requires default?

2016-03-27 Thread Terry Reedy
On 3/26/2016 9:46 PM, gvim wrote: Given that Python, like Ruby, is an object-oriented language why doesn't this: def m(): a = [] for i in range(3): a.append(lambda: i) return a def echo_i: return i b = m() for n in range(3): print(b[n]()) # => 2 2 2 ) # => 2 2 2 ... work

Re: Help with python script for NMR

2016-03-27 Thread Wildman via Python-list
On Sun, 27 Mar 2016 08:13:49 -0700, mohamadmaaz5 wrote: >> > Hello there, >> > I found a python script The formatting of the script is all wrong. There are many spaces that should not be there and no indentations. It could take a long time to figure it out. It could be just a copy/paste proble

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Ned Batchelder
On Sunday, March 27, 2016 at 10:43:49 AM UTC-4, BartC wrote: > On 27/03/2016 14:47, Dennis Lee Bieber wrote: > > On Sun, 27 Mar 2016 12:31:26 +0100, BartC declaimed the > > following: > > > >> On 27/03/2016 07:34, Paul Rubin wrote: > >>> BartC writes: > But my suggestion was to have requi

Re: help with program

2016-03-27 Thread Terry Reedy
On 3/27/2016 10:18 AM, Bob Gailer wrote: The problem with putting input at the end of a program is: if the program raises an exception you won't see it. What you are saying is that putting input() at the end of a program (or before any exit point) is insufficient for keeping a window alive if

Re: Why lambda in loop requires default?

2016-03-27 Thread Ned Batchelder
On Sunday, March 27, 2016 at 9:55:16 AM UTC-4, g vim wrote: > Given that Python, like Ruby, is an object-oriented language It turns out that "object-oriented" means very little, and lots of languages that are object-oriented will behave differently from each other, even where object behavior is c

Re: Why lambda in loop requires default?

2016-03-27 Thread Jussi Piitulainen
gvim writes: > Given that Python, like Ruby, is an object-oriented language why > doesn't this: > > def m(): > a = [] > for i in range(3): a.append(lambda: i) > return a > > b = m() > for n in range(3): print(b[n]()) # => 2 2 2 > > ... work the same as this in Ruby: > > def m > a = []

Re: Help with python script for NMR

2016-03-27 Thread mohamadmaaz5
On Sunday, March 27, 2016 at 4:50:01 PM UTC+2, Joel Goldstick wrote: > On Sun, Mar 27, 2016 at 10:38 AM, wrote: > > > Hello there, > > I found a python script in a scientific article that enables a simple > > calculation on an NMR spectrum. > > I have no experience in programming and i would appr

Re: Calling the source command from subprocess.popen to update the os.environ.

2016-03-27 Thread Chris Angelico
On Mon, Mar 28, 2016 at 12:24 AM, Hongyi Zhao wrote: > # replace env > os.environ.clear() > os.environ.update(line.partition('=')[::2] for line in output.split('\0')) > > Traceback (most recent call last): > File "/home/werner/anaconda2/lib/python2.7/site-packages/IPython/core/ > interactiveshel

Re: Help with python script for NMR

2016-03-27 Thread Joel Goldstick
On Sun, Mar 27, 2016 at 10:38 AM, wrote: > Hello there, > I found a python script in a scientific article that enables a simple > calculation on an NMR spectrum. > I have no experience in programming and i would appreciate it if i can > communicate with someone who can write this script and send

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread BartC
On 27/03/2016 14:47, Dennis Lee Bieber wrote: On Sun, 27 Mar 2016 12:31:26 +0100, BartC declaimed the following: On 27/03/2016 07:34, Paul Rubin wrote: BartC writes: But my suggestion was to have required a keyword in front of such expressions. Should there be a keyword in front of a l

Help with python script for NMR

2016-03-27 Thread mohamadmaaz5
Hello there, I found a python script in a scientific article that enables a simple calculation on an NMR spectrum. I have no experience in programming and i would appreciate it if i can communicate with someone who can write this script and send it to me by mail in py format. It's a short script

Re: Why lambda in loop requires default?

2016-03-27 Thread Jussi Piitulainen
gvim writes: > Given that Python, like Ruby, is an object-oriented language why > doesn't this: > > def m(): > a = [] > for i in range(3): a.append(lambda: i) > return a > > b = m() > for n in range(3): print(b[n]()) # => 2 2 2 I'm going to suggest two variations that may or may not wor

Re: help with program

2016-03-27 Thread Bob Gailer
The problem with putting input at the end of a program is: if the program raises an exception you won't see it. -- https://mail.python.org/mailman/listinfo/python-list

Re: Calling the source command from subprocess.popen to update the os.environ.

2016-03-27 Thread Oscar Benjamin
On 27 Mar 2016 17:01, "Ben Finney" wrote: > > Hongyi Zhao writes: > > > I use the following code the update the os.environ: > > > > import os > > from subprocess import check_output > > > > # POSIX: name shall not contain '=', value doesn't contain '\0' > > output = check_output("source /home/wer

Re: Announcing the release of Yosai: a security framework for python applications

2016-03-27 Thread Ben Finney
Darin Gordon writes: > I am very glad to announce the first release of Yosai, a security > framework for python applications. > > Details, including link to project: > http://www.daringordon.com/introducing_yosai Rather than just a link, can you please give a couple of paragraphs explaining what

Re: Calling the source command from subprocess.popen to update the os.environ.

2016-03-27 Thread Ben Finney
Hongyi Zhao writes: > I use the following code the update the os.environ: > > import os > from subprocess import check_output > > # POSIX: name shall not contain '=', value doesn't contain '\0' > output = check_output("source /home/werner/env-intel-toolchains.sh; > env -0", shell=True, e

Why lambda in loop requires default?

2016-03-27 Thread gvim
Given that Python, like Ruby, is an object-oriented language why doesn't this: def m(): a = [] for i in range(3): a.append(lambda: i) return a b = m() for n in range(3): print(b[n]()) # => 2 2 2 ... work the same as this in Ruby: def m a = [] (0..2).each {|i| a << ->(){i}} a e

Announcing the release of Yosai: a security framework for python applications

2016-03-27 Thread Darin Gordon
Hey Everyone! I am very glad to announce the first release of Yosai, a security framework for python applications. Details, including link to project: http://www.daringordon.com/introducing_yosai Regards Darin -- https://mail.python.org/mailman/listinfo/python-list

Calling the source command from subprocess.popen to update the os.environ.

2016-03-27 Thread Hongyi Zhao
Hi all, Based on the methods here: http://stackoverflow.com/questions/7040592/calling-the-source-command- from-subprocess-popen/18897007#comment30954741_12708396 I use the following code the update the os.environ: import os from subprocess import check_output # POSIX: name shall not contain '=

EuroPython 2016: More than 150 sessions waiting for you

2016-03-27 Thread M.-A. Lemburg
Just in case you didn’t find enough Easter eggs today, we have a whole basket of them waiting for you: the first set of accepted sessions for EuroPython 2016 in Bilbao. *** EuroPython 2016 Session List *** https://ep2016.europython.eu/en/events/sessions/ The session

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread BartC
On 27/03/2016 07:34, Paul Rubin wrote: BartC writes: But my suggestion was to have required a keyword in front of such expressions. Should there be a keyword in front of a line containing "sqrt(x)" ? What about "launch(missiles)" ? They both look like function calls. Function calls are *v

Re: repeat items in a list

2016-03-27 Thread Antonio Caminero Garcia
On Sunday, March 27, 2016 at 11:52:22 AM UTC+2, larudwer wrote: > how about > > sorted(["a", "b"]*3) > ['a', 'a', 'a', 'b', 'b', 'b'] that's cooler, less efficient though and do not maintain the original order. In case such order was important, you should proceed as follows: If the elemen

Re: repeat items in a list

2016-03-27 Thread Jussi Piitulainen
Antonio Caminero Garcia writes: > On Saturday, March 26, 2016 at 11:12:58 PM UTC+1, beli...@aol.com wrote: >> I can create a list that has repeated elements of another list as >> follows: >> >> xx = ["a","b"] >> nrep = 3 >> print xx >> yy = [] >> for aa in xx: >> for i in range(nrep): >>

Re: Threading is foobared?

2016-03-27 Thread Tim Golden
On 27/03/2016 07:25, Random832 wrote: On Sat, Mar 26, 2016, at 23:18, Ben Finney wrote: What you've demonstrated is that at least one host is violating communication standards by altering existing reference fields on messages in transit. The usenet gateway relays posts that originated on the m

Re: repeat items in a list

2016-03-27 Thread larudwer
how about sorted(["a", "b"]*3) ['a', 'a', 'a', 'b', 'b', 'b'] -- https://mail.python.org/mailman/listinfo/python-list

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Oscar Benjamin
On 27 Mar 2016 10:56, "Steven D'Aprano" wrote: > > > My C is a bit rusty, so excuse me if I get the syntax wrong. I have a > function: > > void foo(int n) { > int i = n + 1; > bar(i); > } > > There's a possible overflow of a signed int in there. This is undefined > behaviour. Now, you migh

Re: repeat items in a list

2016-03-27 Thread Antonio Caminero Garcia
On Sunday, March 27, 2016 at 10:02:44 AM UTC+2, Antonio Caminero Garcia wrote: > On Saturday, March 26, 2016 at 11:12:58 PM UTC+1, beli...@aol.com wrote: > > I can create a list that has repeated elements of another list as follows: > > > > xx = ["a","b"] > > nrep = 3 > > print xx > > yy = [] > >

Re: repeat items in a list

2016-03-27 Thread Antonio Caminero Garcia
On Saturday, March 26, 2016 at 11:12:58 PM UTC+1, beli...@aol.com wrote: > I can create a list that has repeated elements of another list as follows: > > xx = ["a","b"] > nrep = 3 > print xx > yy = [] > for aa in xx: > for i in range(nrep): > yy.append(aa) > print yy > > output: > ['a

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Rustom Mody
On Sunday, March 27, 2016 at 1:10:51 PM UTC+5:30, Steven D'Aprano wrote: > On Sun, 27 Mar 2016 05:13 pm, Paul Rubin wrote: > > > No it's not meaningless if it "might" overflow, it's meaningless if it > > -does- overflow, > > No! That's exactly wrong! > > Paul, thank you for inadvertently provin

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Steven D'Aprano
On Sun, 27 Mar 2016 01:30 am, Chris Angelico wrote: > On Sun, Mar 27, 2016 at 1:09 AM, BartC wrote: >> I'm surprised that both C and Python allow statements that apparently do >> nothing. In both, an example is: >> >> x >> >> on a line by itself. This expression is evaluated, but then any resul

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Steven D'Aprano
On Sun, 27 Mar 2016 05:13 pm, Paul Rubin wrote: > Steven D'Aprano writes: >> For example, would you consider that this isolated C code is >> "meaningless"? >> int i = n + 1; > > It's meaningful as long as n is in a certain range of values so there's > no overflow. > >> But according to the stan

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Steven D'Aprano
On Sat, 26 Mar 2016 08:23 am, Chris Angelico wrote: > On Sat, Mar 26, 2016 at 2:50 AM, Steven D'Aprano > wrote: >> Undefined behaviour does not mean "implementation specific behaviour". >> Nor does it mean "something sensible will happen but we don't promise >> what it will be". It means "the co

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Rustom Mody
On Sunday, March 27, 2016 at 12:05:01 PM UTC+5:30, Paul Rubin wrote: > Rustom Mody writes: > > eg haskell (ghc) is written in ghc > > Where did the first bootstrap start from? > > The very earliest Haskell implementation was written in Lisp. Ummm So you found a little chink in my argument -- Ok :