Re: Default .py program and Edit with IDLE problem
On Wednesday, August 16, 2017 at 4:55:17 PM UTC-5, Kevi Aday (Katch22) wrote: > I installed python 3.6.2 for making running and editing > programs. Later on I installed python 2.7 because a program > that I downloaded only works with that. Later I deleted the > program. I then wanted to run a program from cmd but it was > giving me all kinds of errors What kind of errors? You should have copy/pasted the exception messages here. > I thought the problem was being caused by python 2.7 and I > didn’t even need it anymore so I uninstalled it. After I > uninstalled it, all my .py files’ icons disappeared and > when I right clicked on it the “Edit with IDLE” > disappeared. I tried all kinds of things like repairing > python, Don't waste your time with that stupid "repair option". What does an uninstall and reinstall process take these days... all of two minutes? > editing the registry, etc. Oh boy... The first rule of troubleshooting is always to apply the simplist fix first, then start walking up the "staircase of complexity" until you find a solution. Something specific and esoteric as editing the registry is very near the top of the staircase. In this case, the "easy fix" is a quick and painless uninstall+reinstall. One of the core philosophical principals of Python is: "In the face of ambiguity, refuse the temptation to guess", and while uninstall+reinstall may indeed seem like a drastic measure, it is the most practical solution for this kind of problem. > but I just can’t fix the problem and this has never > happened to me and its really bugging me. Please help. (1) Uninstall all versions of Python on your machine. (2) Install Python 3, and be sure to check the box that says (I'm paraphrasing here): "Make this my default installation" All better now? -- rr >>> import this # The path to enlightenment begins here... -- https://mail.python.org/mailman/listinfo/python-list
Re: A question on modification of a list via a function invocation
On Wednesday, August 16, 2017 at 4:07:14 PM UTC-5, Mok-Kong Shen wrote: > The above shows that with , i.e. assigning > single values to individual members of alist (with > alist[0]=3 etc.) is "principally" different from assigning > a whole list to alist (with alist=[30,60,90]). The first > operation doesn't affect the connection between ss and > alist, while the second separates the connection between ss > and alist, as your diagram above clearly indicates. And why is that so difficult for you to understand? It has always seemed perfectly logical to me... [A thought experiment] Consider automobiles as an example. Automobiles are constructed in factories, and they are machines that are made of many subcomponents, but we reference the entire "conglomeration of subcomponents" (a "car") as single unit, and each unit is given a serial number (aka: "Vehicle Identification Number"). Now image one day your car is wrecked, and your mechanic replaces a few (or all) of the subcomponents with new subcomponents... would he also modify the VIN? Of course not! Because the subcomponents do not define the vehicle. If we want a new vehicle, then we request one from the factory. So when you do this: car = [1,2,3] You are requesting a _new_ car from the factory. But when you do this: car[0] = 10 car[1] = 20 car[2] = 30 ... You are merely changing out subcomponents of an _existing_ car. And even if you exchange every component, the car will never be a "factory new" car. > Isn't this kind of convention/rule something that appears > to be not quite natural/"logical" to the common users (non- > experts)? No. -- https://mail.python.org/mailman/listinfo/python-list
Re: Default .py program and Edit with IDLE problem
On Sat, Aug 19, 2017 at 7:43 PM, Rick Johnson wrote: > Don't waste your time with that stupid "repair option". What > does an uninstall and reinstall process take these days... > all of two minutes? > > Oh boy... The first rule of troubleshooting is always to > apply the simplist fix first, then start walking up the > "staircase of complexity" until you find a solution. > Something specific and esoteric as editing the registry is > very near the top of the staircase. In this case, the "easy > fix" is a quick and painless uninstall+reinstall. One of the > core philosophical principals of Python is: "In the face of > ambiguity, refuse the temptation to guess", and while > uninstall+reinstall may indeed seem like a drastic measure, > it is the most practical solution for this kind of problem. I'm not sure how "refuse to guess" translates into "wipe it out and start over". I *never* recommend uninstall/reinstall as a first measure. It's a stupid idea unless you actually know that it's going to help. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: A question on modification of a list via a function invocation
On Sat, 19 Aug 2017 08:07 pm, Rick Johnson wrote: > And why is that so difficult for you to understand? It has > always seemed perfectly logical to me... > > [A thought experiment] > Consider automobiles as an example. Automobiles are > constructed in factories, and they are machines that are > made of many subcomponents, but we reference the entire > "conglomeration of subcomponents" (a "car") as single unit, > and each unit is given a serial number (aka: "Vehicle > Identification Number"). Now image one day your car is > wrecked, and your mechanic replaces a few (or all) of the > subcomponents with new subcomponents... would he also modify > the VIN? Of course not! Because the subcomponents do not > define the vehicle. If we want a new vehicle, then we > request one from the factory. I'm not sure that the VIN defines the vehicle exactly... I wouldn't want to try driving a VIN without the rest of the vehicle. The mileage is terrible... Quoting Fredrik Lundh: well, I guess you can, in theory, value an artificial number assigned to an object as much as the object itself. "Joe, I think our son might be lost in the woods" "Don't worry, I have his social security number" but putting that aside, your car analogy glosses over a genuine paradox here. Consider that in my family, one of our most precious heirlooms is the axe of my great-great-great grandfather, which we have passed down from eldest son to eldest son for generations. The axe is now almost 200 years old. Of course, occasionally the handle has broken and we've had to replace it, and from time to time the axe head itself was so worn out that it had to be replaced, but apart from those repairs the axe is the same one that my great-great-great grandfather used almost two centuries ago. https://plato.stanford.edu/entries/identity-time/ -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list
Re: Default .py program and Edit with IDLE problem
On Saturday, August 19, 2017 at 5:39:19 AM UTC-5, Chris Angelico wrote: > I'm not sure how "refuse to guess" translates into "wipe it > out and start over". I *never* recommend > uninstall/reinstall as a first measure. It's a stupid idea > unless you actually know that it's going to help. No, what's stupid is spending hours running down non-issues because you'd rather take random guesses than choose the easy, practical solution. I suppose if your library includes many third-party add-ons, the rebuild process could be more than a few minutes, but that's the very reason i have elected to keep my dependancy pool small. For instance, if i need a GUI, i opt for the stdlib module Tkinter first. Sure, Tkinter is a very basic library, and sometimes you have to roll your own widgets (while rolling your eyes!), but if it gets the job done, who cares! "Practicality beats purity!" In the end, even if i'm forced to extend a builtin library to get some missing functionality, my efficiency is increased because (1) i don't need to corral a herd of third party dependencies for distribution or rebuilds, and (2) I don't need to keep up with the latest changes in multiple dependencies (which can drastically affect my existing interfaces and APIs down-stream). If your goal is to be a hoarding "dependancy herder", then have fun with that! Meanwhile, i'll be focusing on new features and functionality. My software design philosophy is to be lean and mean. If we don't moderate ourselves, cruft has a way of piling up very quickly. -- https://mail.python.org/mailman/listinfo/python-list
Re: A question on modification of a list via a function invocation
Steve D'Aprano wrote: > I'm not sure that the VIN defines the vehicle exactly... I > wouldn't want to try driving a VIN without the rest of the > vehicle. The mileage is terrible... Quoting Fredrik Lundh: > well, I guess you can, in theory, value an artificial > number assigned to an object as much as the object itself. > "Joe, I think our son might be lost in the woods" "Don't > worry, I have his social security number" While i'll admit your story is quite funny, it's not relevant to my example. > but putting that aside, your car analogy glosses over a > genuine paradox here. Consider that in my family, one of > our most precious heirlooms is the axe of my great-great- > great grandfather, which we have passed down from eldest > son to eldest son for generations. The axe is now almost > 200 years old. Of course, occasionally the handle has > broken and we've had to replace it, and from time to time > the axe head itself was so worn out that it had to be > replaced, but apart from those repairs the axe is the same > one that my great-great-great grandfather used almost two > centuries ago. No it isn't. You're conflating the "history of the axe" with the "physical axe" itself -- two distinct and unrelatable concepts -- one tangible, and one not. Generally, an axe consists of a handle and a blade, and if you replace the blade and the handle, you have a whole new axe. The axe you _now_ hold is merely a symbolic representation of the physical object that your great-great- great... deep breath... grandpappy held in his hand many centuries ago, and neither love nor nostalgia can overcome the reality that your axe, and the axe of your, urm, "distant relative", is not the same object anymore. Unfortunately, while my "car example" did correctly mirror many of the aspects of Python lists, i admit it was clumsily of me to conflate "components" with "contents". And although components can be added and removed (like contents), the adding and removing of these components do affect the overall "identity" of the car object, in a way that say, groceries in the back seat or passengers would not. So for that reason, it fails. With that in mind, a "basket full of apples" would be a better representation of lists, as the basket is not defined by its content. For instance, apples can be added, or taken away, or even oranges can be placed inside, but it will always be a unique basket. A unique object. And how the basket is referenced, in this reguard, is inconsequential. And whether we choose to uniquely identify the basket by say, placing a serial number on it or giving it a friendly name like: "Mr. Weaves", it will always be a unique object, regardless of content. -- https://mail.python.org/mailman/listinfo/python-list
Re: What extended ASCII character set uses 0x9D?
Ian Kelly wrote: One possibility is that it's the same two bytes. That would make it 0xE2 0x80 0x9D which is "right double quotation mark". Since it keeps appearing after ending double quotes that seems plausible, although one has to wonder why it appears *in addition to* the ASCII double quotes. Maybe something tried to replace right double quote marks with ascii double quotes, but got it wrong by only replacing 2 bytes instead of 3. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Default .py program and Edit with IDLE problem
On Sun, 20 Aug 2017 12:11 am, Rick Johnson wrote: > On Saturday, August 19, 2017 at 5:39:19 AM UTC-5, Chris Angelico wrote: >> I'm not sure how "refuse to guess" translates into "wipe it >> out and start over". I *never* recommend >> uninstall/reinstall as a first measure. It's a stupid idea >> unless you actually know that it's going to help. > > No, what's stupid is spending hours running down non-issues > because you'd rather take random guesses than choose the > easy, practical solution. Assuming that it is the solution, which it often isn't. Just in recent months, there have been a spate of posts from people with problems on Windows, invariably ending with some plaintive cry of: "I've uninstalled and reinstalled again and again and it didn't help!" I must admit I don't remember the solution because, not being a Windows guy I didn't care that much, but if you care you can search the archives. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list
Re: Default .py program and Edit with IDLE problem
Steve D'Aprano wrote: > Rick Johnson wrote: > > Chris Angelico wrote: > > > I'm not sure how "refuse to guess" translates into "wipe > > > it out and start over". I *never* recommend > > > uninstall/reinstall as a first measure. It's a stupid > > > idea unless you actually know that it's going to help. > > > > No, what's stupid is spending hours running down non- > > issues because you'd rather take random guesses than > > choose the easy, practical solution. > > Assuming that it is the solution, which it often isn't. > Just in recent months, there have been a spate of posts > from people with problems on Windows, invariably ending > with some plaintive cry of: "I've uninstalled and > reinstalled again and again and it didn't help!" And remind me again, what's the definition of insanity? ;-) > I must admit I don't remember the solution because, not > being a Windows guy I didn't care that much, but if you > care you can search the archives. My solution for a Python3 that won't install would be to revert back to the Python2.x line. Like HTML tables, older features can be less buggy and suffer less compatibility issues in the wild (at least for a time). Being that Python3 is still cutting its teeth in the middle of constant churn, i await Python4. And i sure hope Python4 will be a little more stable. I think too many features have been added too quickly. For instance, the type-hints thing is a major shift from the founding philosophy, and one of my greatest pet peeves. -- https://mail.python.org/mailman/listinfo/python-list
Re: Default .py program and Edit with IDLE problem
On Sun, 20 Aug 2017 01:56:14 +1000, Steve D'Aprano wrote: > On Sun, 20 Aug 2017 12:11 am, Rick Johnson wrote: > >> On Saturday, August 19, 2017 at 5:39:19 AM UTC-5, Chris Angelico wrote: >>> I'm not sure how "refuse to guess" translates into "wipe it out and >>> start over". I *never* recommend uninstall/reinstall as a first >>> measure. It's a stupid idea unless you actually know that it's going >>> to help. >> >> No, what's stupid is spending hours running down non-issues because >> you'd rather take random guesses than choose the easy, practical >> solution. > > Assuming that it is the solution, which it often isn't. > > Just in recent months, there have been a spate of posts from people with > problems on Windows, invariably ending with some plaintive cry of: > > "I've uninstalled and reinstalled again and again and it didn't help!" > > I must admit I don't remember the solution because, not being a Windows > guy I didn't care that much, but if you care you can search the > archives. I think to a point I have to agree with rick, windows installers can be flaky and time is money. if something does not work after installation (& does not gibe any clues as to why) a quick install (reboot) & re install is work a try & probably has a 25-50% success rate. however you are also correct in that if this does not work there is nothing to be gained by repeating the process & further investigation as to what is causing the issue is needed. one approach I have found useful in the past is to try to start the program (what ever it is) from the command line - something that windows users have all but forgotten exists. -- The trouble is that things *never* get better, they just stay the same, only more so. (Eric) -- https://mail.python.org/mailman/listinfo/python-list
Re: Proposed new syntax
On Sat, Aug 19, 2017 at 2:15 PM, Steve D'Aprano wrote: > Indeed. People find imperative (recipe) algorithms easy to follow, and pure > functional reasoning hard. I'm glad that functional programming is fashionable > again, and hope that people will learn good habits from it, but I think that > mathematical purity is not necessary or even helpful in the majority of > programming tasks. > > I expect that languages like Haskell, like Scheme and Lisp, will be greatly > influential but remain niche languages themselves. Agreed. Functional programming languages teach us about recursion, immutability, declarative programming styles, etc, all of which are incredibly useful. I don't particularly enjoy writing Scheme code (only ever done it because of Lilypond), but I think I'm a better programmer for having gotten my head around it. > > [1] Assuming that mathematics actually is sound, which thanks to Gödel we know > is unprovable. Harmony in audio signals is based on frequency ratios. Therefore sound is mathematics, and by the reflexive principle of equality, mathematics is sound. Sorry, Gödel, I just proved it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: A question on modification of a list via a function invocation
On Saturday, August 19, 2017 at 11:59:41 AM UTC+1, Steve D'Aprano wrote: > Consider that in my family, one of our most precious heirlooms is the axe of > my > great-great-great grandfather, which we have passed down from eldest son to > eldest son for generations. > > The axe is now almost 200 years old. Of course, occasionally the handle has > broken and we've had to replace it, and from time to time the axe head itself > was so worn out that it had to be replaced, but apart from those repairs the > axe is the same one that my great-great-great grandfather used almost two > centuries ago. > > https://plato.stanford.edu/entries/identity-time/ > > -- > Steve > “Cheer up,” they said, “things could be worse.” So I cheered up, and sure > enough, things got worse. Rather like Trigger's roadsweeping broom https://www.youtube.com/watch?v=s1VNNbSYdt0 Kindest regards. Mark Lawrence. -- https://mail.python.org/mailman/listinfo/python-list
[no subject]
I'm new to python and having trouble with the most basic step. I have tried to install python (Web-based installer) on my home pc to mess around and attempt to develop a program. when I install the launcher it is fine but when I try and open the file it launches a modify setup window. I have no clue how to fix this issue and start using the actual program. how do I go about fixing this issue? any information would be greatly valued. Thank you [image: Inline image 2] Modify [image: Inline image 3] Next [image: Inline image 4] Install [image: Inline image 5] -- https://mail.python.org/mailman/listinfo/python-list
Re: Default .py program and Edit with IDLE problem
alister wrote: > Steve D'Aprano wrote: > > Rick Johnson wrote: [...] > I think to a point I have to agree with rick, Well, alister, i'll take what i can get around here. :-) > windows installers can be flaky and time is money. Indeed. > if something does not work after installation (& does not > gibe any clues as to why) a quick install (reboot) & re > install is work a try & probably has a 25-50% success rate. Well, part of the problem here is that OP failed to provide the necessary information. Ssorry OP, but i gotta call you out on this one! First of all, the OP made it sound as though the Python3 install was working all fine-and-dandy until Python2 was installed, then some command-line hackery became problematic with "some errors i didn't used to get" --- whatever that means... Then after uninstalling Python2, the OP reports some weird OS specific behavior about icons disappearing and missing commands from the Windows Contextual Menu. Okay, the later issue would seem to indicate that the system file associations related to Python had been deleted and that the Python 2.x uninstaller, being unaware that the Python3 would hang around for a while longer, did its normal "hey, i'm the last fella here, so i'll clean up the empty beer cans and pizza boxess before i go" routine, by removing python related commands from the context menu (and gawd know what else!). The clue that could solve this whole mystery would be specific information about these "strange errors"... (1) Were these python exception messages? (2) Were they Windows error messages? (3) Perhaps the flux capacitor failed to produce the expected 1.21 GigaWatts? Great Scott!!! With such limited information, all we can do is guess here. But in my experience, with Python on windoze at least, the installers can be, as you said, flaky. Especially when you have multiple versions on the same machine and you forget to select the little "Make-This-My-Default-Python" box. But of course, that won't help when you do the uninstall later, because there's no "Use-VersionXY-As-My-Default-Python" for the uninstaller. It's a one-way street with no U-Turns allowed. -- https://mail.python.org/mailman/listinfo/python-list
Re:
Unfortunately the images did not come through, since this is a text-only email list. I suggest you put your images on an online resource such as Photobucket and post the links in your email. Unfortunately your description of the problem is not very precise. Obviously the images would help. Terms like installing the launcher and open the file don't help. Please get the images online send us the links and be more verbose in your explanation. On Aug 19, 2017 1:52 PM, "Owen Berry" wrote: > I'm new to python and having trouble with the most basic step. I have tried > to install python (Web-based installer) on my home pc to mess around and > attempt to develop a program. when I install the launcher it is fine but > when I try and open the file it launches a modify setup window. I have no > clue how to fix this issue and start using the actual program. how do I go > about fixing this issue? any information would be greatly valued. > > Thank you > > > > > [image: Inline image 2] > > Modify > [image: Inline image 3] > > Next > [image: Inline image 4] > > Install > [image: Inline image 5] > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: Proposed new syntax
On Sat, 19 Aug 2017 03:42 pm, Chris Angelico wrote: >> [1] Assuming that mathematics actually is sound, which thanks to Gödel we >> [know >> is unprovable. > > Harmony in audio signals is based on frequency ratios. Therefore sound > is mathematics, and by the reflexive principle of equality, > mathematics is sound. Sorry, Gödel, I just proved it. All prime numbers are odd. The primes 3, 5, 7, 11, 13, ... are not divisible by two, which makes them odd numbers. The prime 2 is unique in being the only prime which is divisible by two, which makes it the oddest prime of all. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list
how to create root with treelib?
http://treelib.readthedocs.io/en/latest/examples.html tree = Tree() #create root tree.create_node((0,0), "root") result = [aa[0]] previousnode = (0,0) >>> #create root ... tree.create_node((0,0), "root") Traceback (most recent call last): File "", line 2, in File "C:\Python27\lib\site-packages\treelib\node.py", line 142, in __repr__ "tag=%r" % self.tag, TypeError: not all arguments converted during string formatting -- https://mail.python.org/mailman/listinfo/python-list
Re: how to create root with treelib?
On 2017-08-20 01:58, Ho Yeung Lee wrote: http://treelib.readthedocs.io/en/latest/examples.html tree = Tree() #create root tree.create_node((0,0), "root") result = [aa[0]] previousnode = (0,0) #create root ... tree.create_node((0,0), "root") Traceback (most recent call last): File "", line 2, in File "C:\Python27\lib\site-packages\treelib\node.py", line 142, in __repr__ "tag=%r" % self.tag, TypeError: not all arguments converted during string formatting You should probably report that as a bug. -- https://mail.python.org/mailman/listinfo/python-list
Re: Proposed new syntax
On Saturday, August 19, 2017 at 9:45:48 AM UTC+5:30, Steve D'Aprano wrote: > On Sat, 19 Aug 2017 12:59 am, Chris Angelico wrote: > > > On Fri, Aug 18, 2017 at 11:46 PM, Rustom Mody wrote: > >> Compare the well-known haskell tutorial > >> http://learnyouahaskell.com/starting-out > >> whose comprehension intro starts: > >> > >> | If you've ever taken a course in mathematics, you've probably run into > >> set > >> | comprehensions. They're normally used for building more specific sets out > >> | of general sets. A basic comprehension for a set that contains the first > >> | ten even | natural numbers is > >> > >> | S = {2·x | x ∈ ℕ, x ≤ 10} > > For the record, this is not the best example to give, since the Natural > numbers > ℕ are not well-defined. Some people include 0, and some do not, so there's a > slight ambiguity to the above. > > http://mathworld.wolfram.com/NaturalNumber.html > > Despite that nit-pick, set builder notation is very common in maths, but not > universal. It is taught in secondary education (high school) in Australia, but > not to all students. There's more than just a nit-pick wrong with that expression Here’s an actual Haskell run Prelude> [x*2 | x <- [1..], x <= 10] [2,4,6,8,10,12,14,16,18,20^CInterrupted. Prelude> ie after “…,20” instead of printing a ']' and giving back the "Prelude>" prompt it hangs… searching in the entire set of integers > 10… for an integer <= 10 (!!) …until a Control-C is given What’s the conclusion?? Take your pick: - Functional programming is stupid - Haskell is not all that intelligent - Halting problem is unsolvable - Converting the borderline uncomputable notion of set builder /comprehensions into the computational framework of programming is fraught with trouble - Sets are a harder data-structure from computational pov than lists - ?? > > > > >> Analogous thing shown at ghci prompt: > >> > >> | ghci> [x*2 | x <- [1..10]] > >> | [2,4,6,8,10,12,14,16,18,20] So not really analogous! [Its the first time I am reading that article/book… just searched a standard Haskell tutorial source and posted it] > > > > And what if you HAVEN'T taken a course in mathematics? What use is > > this then? How would you teach this to a non-mathematician? > > Speaking as someone who *has* taken a course of mathematics or two, I find > that > Rustom's insistence in coming back to the fundamentals of set theory and the > Zermelo–Fraenkel axioms is not terribly helpful. Even among professional > mathematicians. Z-F and the axiom of choice and related matters are extremely > specialised and abstract fields of little interest to the average working > mathematician. Dunno where you got that My reference to Zermelo-Fraenkel was entirely from the point of tracing the history, not to say that the logic-studies of a 100 years ago has any relevance to today Specifically the term 'comprehension' used today as a programming construct traces somewhat tenuously to an axiom that Zermelo/Fraenkel formulated in the 1920s Lives today in python in the fact that the russel-set gives a straightforward syntax error and nothing more grandly profound >>> R = {x if x not in x} File "", line 1 R = {x if x not in x} ^ SyntaxError: invalid syntax >>> ie the first element of a comprehension must be a 'for' not Almost… Unfortunately python muddies the discussion by overloading predicate 'in' and generator 'in'. So following follows the stricture above but still does not work 😦 >>> R = {x for x not in x} File "", line 1 R = {x for x not in x} ^ SyntaxError: invalid syntax >>> > > In my experience, they're of more interest to philosophers and dilettantes > than > actual mathematicians, outside of the minority working in that specific field. > > Yes yes, it is absolutely fundamental to mathematics, just as quantum > mechanics > is absolutely fundamental to an understanding of matter. How many bridge > builders care about quantum mechanics? > > Python is not Haskell and makes no pretence at being mathematically sound[1]. > The Zen of Python sets forth some of the design principles in the language, > and "mathematical purity" is not one of them. > > The opposite, in fact: "practicality beats purity." > > To answer your (Chris') question: Strawman argument as usual! For myself, thanks to Peter's clarification that 'comprehension' is best thought of as 'comprise', I am now going to teach to my students: “Comprehension is a misspelling of comprision” [Comprehensivesion would be more tolerable semantically than comprehension but hurts mouth and eyes!] > > When I teach comprehension syntax, I always mention set builder notation and > say "you may have been taught this is school". I don't think I have ever come > across someone who both *was* taught it and *remembers* so, but I'll keep > trying. For those who don't understand set builder notation (so far, everyone > I've tried to teach comps to) I explain them in terms
Re: Proposed new syntax
Rustom Mody writes: > Specifically the term 'comprehension' used today as a programming construct > traces somewhat tenuously to an axiom that Zermelo/Fraenkel formulated > in the 1920s I thought went back to Frege. Also, it appears in Zermelo set theory Z. ZF is Z with the Axiom of Replacement added, but Z was somewhat earlier than ZF. -- https://mail.python.org/mailman/listinfo/python-list
Re: Proposed new syntax
On Sun, Aug 20, 2017 at 2:28 PM, Rustom Mody wrote: > So if Chris can answer how to teach music to a tone-deaf person, I can > consider how to answer the question of how to teach programming to a > math-challenged one You don't HAVE to understand math to be a programmer. Plenty of math-challenged people can cook. See my earlier example of recipes. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Proposed new syntax
On Sun, 20 Aug 2017 02:28 pm, Rustom Mody wrote: >> >> | S = {2·x | x ∈ ℕ, x ≤ 10} [...] > There's more than just a nit-pick wrong with that expression The expression is fine. It is a mathematical expression, not Haskell code, so your example of Haskell code is irrelevant to judging maths notation. > Here’s an actual Haskell run > > Prelude> [x*2 | x <- [1..], x <= 10] > [2,4,6,8,10,12,14,16,18,20^CInterrupted. > Prelude> > > ie after “…,20” instead of printing a ']' and giving back the "Prelude>" > prompt it hangs… searching in the entire set of integers > 10… > for an integer <= 10 (!!) > …until a Control-C is given If only Haskell supported the Clojure syntax: (for [x (range 1) :while (<= x 10)] x*2) (I may have got the order of x and 10 backwards, I haven't tested the above in a Clojure interpreter.) http://clojuredocs.org/clojure.core/for > What’s the conclusion?? Take your pick: > - Functional programming is stupid > - Haskell is not all that intelligent > - Halting problem is unsolvable > - Converting the borderline uncomputable notion of set builder /comprehensions > into the computational framework of programming is fraught with trouble > - Sets are a harder data-structure from computational pov than lists > - ?? None of the above. How about...? - abstract mathematics is not programming. [...] > Lives today in python in the fact that the russel-set gives a straightforward > syntax error and nothing more grandly profound > R = {x if x not in x} > File "", line 1 > R = {x if x not in x} > ^ > SyntaxError: invalid syntax Rustom, please write 100 times on the blackboard, "I cannot mechanically translate abstract maths notation into programming languages without understanding the semantics of both." Thank you. All you have demonstrated is that mechanically translating abstract maths notation into Python code without considering the semantics of either is, in general, doomed to fail. > Strawman argument as usual! If I had a dollar for every time somebody misused "strawman argument" to mean "a valid argument against my position that I cannot counter", I'd be able to afford to purchase a small island in the Pacific. Such as New Zealand. > For myself, thanks to Peter's clarification that 'comprehension' is best > thought of as 'comprise', I am now going to teach to my students: > “Comprehension is a misspelling of comprision” Only if you wish to mislead your students. "How do you know that, Herr Doktor Professor Mody?" "Oh, some random person on the internet gave me his guess as to the etymology of the word, I made up my own word 'comprision', and put 2 and 2 together to get 7. Any other questions?" Comprehension is not a misspelling of anything, and I don't think Peter is correct. According to the OED, the etymology of "comprehension" comes from French compréhension or Latin comprehensio, to seize. Comprise is also derived from the same words, but independently. Both are first attested to in the late Middle Ages. By the way, this was discussed in detail at least once before: http://code.activestate.com/lists/python-list/123564/ -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list