Re: [OT] fortran lib which provide python like data type
On Tue, Feb 3, 2015 at 5:34 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 02/02/2015 17:25, Chris Angelico wrote: On Tue, Feb 3, 2015 at 3:52 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: I'd like to see anybody define 'a' and 'the' without using 'a' and 'the'. Would that be formally rigorous or rigorously formal? a: Indefinite article, used to represent individual objects not otherwise identifiable. Near enough? Nope. 'article' begins with 'a' so you can't use it to define itself. Hrm. This is difficult. a: Indefinite identifier, used to represent non-specific objects. Not a perfectly accurate definition now, but hey, I avoided the self-reference! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Friday, January 30, 2015 at 5:51:38 PM UTC-5, Gregory Ewing wrote: Michael Torrie wrote: On 01/30/2015 10:31 AM, Rustom Mody wrote: And what about the grey area between lightweight and heavyweight? That's what the smart pointers are for. I'd say it's what higher-level languages are for. :-) I'm completely convinced nowadays that there is *no* use case for C++. If you need to program the bare metal, use C. For anything more complicated, use a language that has proper memory-management abstractions built in. Lots of people are using C++ to build packages for statistical programming language R, using the package Rcpp. It has been possible to build such packages for R and S using Fortran and C since the beginning, and many have done so, but the wide usage of Rcpp suggests that there are advantages to using C++. C++ is still the primary language used by financial derivatives quants. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Marko Rauhamaa ma...@pacujo.net writes: Chris Angelico ros...@gmail.com: On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: And there are underspecified rules too. What is the plural of octopus? No fair looking it up in the dictionary. Standard and well-known piece of trivia, and there are several options. Octopodes is one of the most rigorously formal, but octopuses is perfectly acceptable. Octopi is technically incorrect, as the -us ending does not derive from the Latin. Your brain's grammar engine will give you the correct answer. It may not match your English teacher's answer, but the language we are talking about is not standard English but the dialect you have acquired in childhood. Aha - the Humpty Dumpty approach to English usage: When I use a word it means just what I choose it to mean... -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Paul Rudin paul.nos...@rudin.co.uk: Marko Rauhamaa ma...@pacujo.net writes: Your brain's grammar engine will give you the correct answer. It may not match your English teacher's answer, but the language we are talking about is not standard English but the dialect you have acquired in childhood. Aha - the Humpty Dumpty approach to English usage: When I use a word it means just what I choose it to mean... Yes, and your Humpty Dumpty brain is stringent about the proper usage. Your brain happens to be highly aligned with those of your childhood friends. Your communal dialect has thousands of rigorous rules, only you couldn't make a complete list of them. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 02/02/2015 04:47, Chris Angelico wrote: On Mon, Feb 2, 2015 at 3:14 PM, Roy Smith r...@panix.com wrote: In article 54ceda0b$0$12977$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: What is the plural of octopus? It's a trick question. Octopus is already plural. Monopus is singular. People is already plural, too, but you can talk about all the peoples of the world. Also, I can use people as the subject and is as the verb, just to completely destroy any chance of a simple grammar parser being able to cope with English. ChrisA I'm simple and I cope (somehow) with English. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Monday, February 2, 2015 at 9:40:35 PM UTC+5:30, Mark Lawrence wrote: On 02/02/2015 08:52, Marko Rauhamaa wrote: Chris Angelico : On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano wrote: And there are underspecified rules too. What is the plural of octopus? No fair looking it up in the dictionary. Standard and well-known piece of trivia, and there are several options. Octopodes is one of the most rigorously formal, but octopuses is perfectly acceptable. Octopi is technically incorrect, as the -us ending does not derive from the Latin. Your brain's grammar engine will give you the correct answer. It may not match your English teacher's answer, but the language we are talking about is not standard English but the dialect you have acquired in childhood. Marko I'd love to see a formal definition for standard English. I'd also love to see a formal definition of 'formal' Elsewhere someone (Marko I think) used the term 'rigorous' Ive heard it said that formal is more rigorous than 'rigorous'. And of course the other way round as well ;-) -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 02/02/2015 16:21, Rustom Mody wrote: On Monday, February 2, 2015 at 9:40:35 PM UTC+5:30, Mark Lawrence wrote: On 02/02/2015 08:52, Marko Rauhamaa wrote: Chris Angelico : On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano wrote: And there are underspecified rules too. What is the plural of octopus? No fair looking it up in the dictionary. Standard and well-known piece of trivia, and there are several options. Octopodes is one of the most rigorously formal, but octopuses is perfectly acceptable. Octopi is technically incorrect, as the -us ending does not derive from the Latin. Your brain's grammar engine will give you the correct answer. It may not match your English teacher's answer, but the language we are talking about is not standard English but the dialect you have acquired in childhood. Marko I'd love to see a formal definition for standard English. I'd also love to see a formal definition of 'formal' Elsewhere someone (Marko I think) used the term 'rigorous' Ive heard it said that formal is more rigorous than 'rigorous'. And of course the other way round as well ;-) I'd like to see anybody define 'a' and 'the' without using 'a' and 'the'. Would that be formally rigorous or rigorously formal? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 02/02/2015 08:52, Marko Rauhamaa wrote: Chris Angelico ros...@gmail.com: On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: And there are underspecified rules too. What is the plural of octopus? No fair looking it up in the dictionary. Standard and well-known piece of trivia, and there are several options. Octopodes is one of the most rigorously formal, but octopuses is perfectly acceptable. Octopi is technically incorrect, as the -us ending does not derive from the Latin. Your brain's grammar engine will give you the correct answer. It may not match your English teacher's answer, but the language we are talking about is not standard English but the dialect you have acquired in childhood. Marko I'd love to see a formal definition for standard English. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 02/02/2015 12:39 AM, Marko Rauhamaa wrote: Michael Torrie torr...@gmail.com: http://en.cppreference.com/w/cpp/utility/functional/function Thus if we were to shoehorn your example into C++, the result would be idiomatically very similar to what you have in your Python code. I can understand why you wouldn't write out my example in C++: I wouldn't write it out because it's a contrived example, and why should I waste my time? You have no intention of being impressed with C++, let alone simply learn about it. using std::placeholders::_1; std::functionvoid(int) f_add_display2 = std::bind( Foo::print_add, foo, _1 ); Looks okay to me. That's normal C++ that would be clear to any C++ programmer. And for a statically compiled language, that's incredibly powerful while providing for a measure of safety. You may shudder, but it's a really good statically compiled solution, given the constraints of C++ and its compiler. But like I said, idiomatically in C++, this isn't normally what you'd do anyway. You'd store a std::ostream object. vs f_add_display2 = foo.print_add The cherry on top: _1! The C++ compiler figures out template types heroically but can't wrap its head around the arity of the method. std::bind is a generic function that works with undecorated function pointers. There's no possible way for the compiler to know the arity of the function without you telling it (how else would you do it? I honestly want to know.). That you would find this fact to be incredulous suggests that you have very little understanding of compilers in general. Python being a dynamic, interpreted language can examine a function at runtime. Python is a very expressive language compared to C++ that can do things at runtime that C++ cannot. It's also an interpreted, dynamically-typed language, whereas C++ is a statically-typed language that is clearly faster at many things than Python is. It's a matter of different tools for different jobs. For most of my jobs Python is the right tool. But I can see why people would still want to pick a compiled language, and I can understand why some people still use C++. It's a very powerful language. I'm a little unclear as to why you're even bringing up the comparison with C++. What's your point? To feel superior? -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 02/02/2015 10:57 AM, Marko Rauhamaa wrote: I really don't understand why you are taking all of this so personally. We are just discussing different aspects of different programming languages. Fair enough. You raise good points. I am not taking it personally; your emails, lacking emotional context, just seemed a bit unnecessarily argumentative. For example, The cherry on top: _1! The C++ compiler figures out template types heroically but can't wrap its head around the arity of the method. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 02/02/2015 17:25, Chris Angelico wrote: On Tue, Feb 3, 2015 at 3:52 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: I'd like to see anybody define 'a' and 'the' without using 'a' and 'the'. Would that be formally rigorous or rigorously formal? a: Indefinite article, used to represent individual objects not otherwise identifiable. the: Definite article, used to represent individual objects identifiable by context. Near enough? ChrisA Nope. 'article' begins with 'a' so you can't use it to define itself. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Michael Torrie torr...@gmail.com: Fair enough. You raise good points. I am not taking it personally; your emails, lacking emotional context, just seemed a bit unnecessarily argumentative. For example, The cherry on top: _1! The C++ compiler figures out template types heroically but can't wrap its head around the arity of the method. I feel programming languages, being inanimate abstractions, can take my abuse. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Michael Torrie torr...@gmail.com: You have no intention of being impressed with C++, let alone simply learn about it. I am fully open to being impressed. I have more than a decade of C++ programming under my belt, although not much for the past few years. There's no possible way for the compiler to know the arity of the function without you telling it (how else would you do it? Somehow, C# manages it just fine. I honestly want to know.). See URL: https://msdn.microsoft.com/en-us/library/aa288459%28v=vs.71%29.aspx That you would find this fact to be incredulous suggests that you have very little understanding of compilers in general. Python being a dynamic, interpreted language can examine a function at runtime. C# does it at compile-time. C++ could have and should have introduced delegates early on. The method pointer syntax was screaming for delegate semantics. Too bad that didn't occur to Stroustrup until it was too late. I'm a little unclear as to why you're even bringing up the comparison with C++. What's your point? To feel superior? I really don't understand why you are taking all of this so personally. We are just discussing different aspects of different programming languages. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Tue, Feb 3, 2015 at 3:52 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: I'd like to see anybody define 'a' and 'the' without using 'a' and 'the'. Would that be formally rigorous or rigorously formal? a: Indefinite article, used to represent individual objects not otherwise identifiable. the: Definite article, used to represent individual objects identifiable by context. Near enough? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: Steven D'Aprano wrote: Of course people make grammar mistakes that they don't spot. Ironically, this is one of them. It should of course be grammatical mistakes. I don't believe you made a mistake according to your brain's grammar engine. Parenthetically, I don't believe you made a mistake even according to your English teacher. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Chris Angelico ros...@gmail.com: On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: And there are underspecified rules too. What is the plural of octopus? No fair looking it up in the dictionary. Standard and well-known piece of trivia, and there are several options. Octopodes is one of the most rigorously formal, but octopuses is perfectly acceptable. Octopi is technically incorrect, as the -us ending does not derive from the Latin. Your brain's grammar engine will give you the correct answer. It may not match your English teacher's answer, but the language we are talking about is not standard English but the dialect you have acquired in childhood. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Am 01.02.15 um 08:58 schrieb Marko Rauhamaa: Paul Rubin no.email@nospam.invalid: Marko Rauhamaa ma...@pacujo.net writes: Stroustrup apparently has never had to deal with callbacks; his thick books never made a mention of them last time I checked. C++ has function pointers just like C, Et tu, Brute! C's callbacks always use a void pointer for the self reference. In C, I can use void pointers and type casts idiomatically. In C++, type casts are apostasy. Qt gave up on C++ when it comes to callbacks (signals) and went for an apocryphal metacompiler. Yes, but only because C++ compilers were not good enough when QT came out, and later is was too late to change it to a templated system. Lookup libsigc++ http://libsigc.sourceforge.net/ which does the same using standard C++ and http://qt-project.org/doc/qt-4.8/templates.html for a reasoning of QT. In C++11 (supported by MSVC, g++, clang) there re also lambda expressions Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Paul Rubin no.email@nospam.invalid: Marko Rauhamaa ma...@pacujo.net writes: Stroustrup apparently has never had to deal with callbacks; his thick books never made a mention of them last time I checked. C++ has function pointers just like C, Et tu, Brute! C's callbacks always use a void pointer for the self reference. In C, I can use void pointers and type casts idiomatically. In C++, type casts are apostasy. Qt gave up on C++ when it comes to callbacks (signals) and went for an apocryphal metacompiler. but more idiomatically you'd pass a class instance and the library would invoke some method on it. Yes, that's what I ended up doing, defining a class for each callback type: struct ButtonPushListener { virtual void buttonPush(int x, int y) = 0; }; (Yes, struct and not class! Why?) Typing all of that in was quite a chore. All because Stroustrup didn't think of delegates (Delphi, C#, Python). C++'s method pointers are ridiculous and useless, they should have been defined as delegates. There is also Boost::Coroutine which can get rid of the need for callbacks in some situations. Boost is the world's biggest fig leaf. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Marko Rauhamaa wrote: The natural language has a rigorous grammar plus a lexicon that includes a number of idioms. Nobody has so far been able to codify a natural language completely because the rigorous grammar consists of maybe 10,000 rules. If nobody has codified the rigorous grammar, how do they know it is rigorous? Given how natural languages are constantly in flux (in both space and time), I don't even know how you could define all the rules of a grammar rigorously. By the time you finished, it would be different. Of course, some rules are more rigorous than others. No English speaker would consider a sentence like Can me cheeseburger has? as grammatical. But how about: I can has cheezburger? If grammar is defined by usage, not formal rule books (which don't exist!), then surely LOLspeak is grammatical. (It's probably closer to an argot than a full language, but even so.) -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Christian Gollwitzer aurio...@gmx.de: Am 01.02.15 um 08:58 schrieb Marko Rauhamaa: Qt gave up on C++ when it comes to callbacks (signals) and went for an apocryphal metacompiler. Yes, but only because C++ compilers were not good enough when QT came out, and later is was too late to change it to a templated system. Lookup libsigc++ http://libsigc.sourceforge.net/ which does the same using standard C++ and http://qt-project.org/doc/qt-4.8/templates.html for a reasoning of QT. In C++11 (supported by MSVC, g++, clang) there re also lambda expressions So please implement this small piece of Python code in C++ so we can compare the idioms: import sys, time class MyLogger: def __init__(self, write): self.write = sys.stderr.write def register_writer(self, write): self.write = write def log(self, text): self.write({} {}\n.format(time.time(), text)) class MyApp: def __init__(self, logger): self.logf = open(thelog.log, a) logger.register_writer(self.log_write) def log_write(self, text): self.logf.write(text) self.logf.flush() Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: Marko Rauhamaa wrote: The natural language has a rigorous grammar plus a lexicon that includes a number of idioms. Nobody has so far been able to codify a natural language completely because the rigorous grammar consists of maybe 10,000 rules. If nobody has codified the rigorous grammar, how do they know it is rigorous? Even a five-year-old will immediately spot grammar mistakes (and let you know about them!). Given how natural languages are constantly in flux (in both space and time), I don't even know how you could define all the rules of a grammar rigorously. By the time you finished, it would be different. Every brain has a slightly different variant, and that is evolving, too. However, you can spot a non-native speaker (or a speaker outside your community) in a fraction of a second after they open their mouth. If grammar is defined by usage, not formal rule books (which don't exist!), then surely LOLspeak is grammatical. (It's probably closer to an argot than a full language, but even so.) Whatever it is, your brain will recognize its native language. You never make a grammar mistake that you don't spot yourself right away. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 02/01/2015 12:12 PM, Marko Rauhamaa wrote: Christian Gollwitzer aurio...@gmx.de: Am 01.02.15 um 08:58 schrieb Marko Rauhamaa: Qt gave up on C++ when it comes to callbacks (signals) and went for an apocryphal metacompiler. Yes, but only because C++ compilers were not good enough when QT came out, and later is was too late to change it to a templated system. Lookup libsigc++ http://libsigc.sourceforge.net/ which does the same using standard C++ and http://qt-project.org/doc/qt-4.8/templates.html for a reasoning of QT. In C++11 (supported by MSVC, g++, clang) there re also lambda expressions So please implement this small piece of Python code in C++ so we can compare the idioms: Honestly with the C++ standard library implementing std::function and std::bind macros, idiomatically it would look very much similar to the Python code you showed. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 02/01/2015 12:12 PM, Marko Rauhamaa wrote: So please implement this small piece of Python code in C++ so we can compare the idioms: So I though I might just for kicks code up a C++ version. In doing so, I realized that idomatically, this particular example would not really use callbacks in real life, but rather stream objects. Would look nearly the same but be more idiomatic C++. However, C++ function pointers are actually pretty slick in C++11. See the example near the bottom of the page: http://en.cppreference.com/w/cpp/utility/functional/function Thus if we were to shoehorn your example into C++, the result would be idiomatically very similar to what you have in your Python code. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 02/01/2015 05:50 PM, Michael Torrie wrote: Honestly with the C++ standard library implementing std::function and std::bind macros, idiomatically it would look very much similar to the Python code you showed. Make that templates, not macros. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
In article mailman.18388.1422845124.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Mon, Feb 2, 2015 at 1:35 PM, Matthew Barnett auxl...@mrabarnett.plus.com wrote: And the plural of virus is viruses, not viri (that's the plural of vir) or virii (that would be the plural of virius, if it existed). Yes indeed.Virii and octopi are as wrong as hice for houses (paralleling mice). And, of course, I die, but we dice. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
In article 54ceda0b$0$12977$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: What is the plural of octopus? It's a trick question. Octopus is already plural. Monopus is singular. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Marko Rauhamaa wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: Marko Rauhamaa wrote: The natural language has a rigorous grammar plus a lexicon that includes a number of idioms. Nobody has so far been able to codify a natural language completely because the rigorous grammar consists of maybe 10,000 rules. If nobody has codified the rigorous grammar, how do they know it is rigorous? Even a five-year-old will immediately spot grammar mistakes (and let you know about them!). That doesn't make it rigorous. That just means that there are rules, and five-years olds know some of the rules. There may be ambiguities in the rules. There could be sentences where no rule applies, or multiple contradictory rules. Children go through a period of language acquisition where they over-generalise rules, saying things like I eated the biscuit. Amusingly, there are at least some reports of children getting angry when their parents copy those over-generalisations, saying words to the effect of No Daddy, I say eated, you don't! This suggests that they know that the rule is wrong even when they say it, yet they continue to say it. This in turn suggests that there are multiple parts of the brain involved in grammar, and they aren't always in sync. Adults also commit hyper-correction. Anyone who has said a sentence like The dog barked at my daughter and I is being ungrammatical. Cross out the second party, and you are left with: The dog barked at I which is clearly wrong. And there are underspecified rules too. What is the plural of octopus? No fair looking it up in the dictionary. [...] Whatever it is, your brain will recognize its native language. You never make a grammar mistake that you don't spot yourself right away. Of course people make grammar mistakes that they don't spot. If you're interested in this topic, I can strongly recommend Steven Pinker's book Words And Rules. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: And there are underspecified rules too. What is the plural of octopus? No fair looking it up in the dictionary. Standard and well-known piece of trivia, and there are several options. Octopodes is one of the most rigorously formal, but octopuses is perfectly acceptable. Octopi is technically incorrect, as the -us ending does not derive from the Latin. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 2015-02-02 02:04, Chris Angelico wrote: On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: And there are underspecified rules too. What is the plural of octopus? No fair looking it up in the dictionary. Standard and well-known piece of trivia, and there are several options. Octopodes is one of the most rigorously formal, but octopuses is perfectly acceptable. Octopi is technically incorrect, as the -us ending does not derive from the Latin. And the plural of virus is viruses, not viri (that's the plural of vir) or virii (that would be the plural of virius, if it existed). -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Steven D'Aprano wrote: Of course people make grammar mistakes that they don't spot. Ironically, this is one of them. It should of course be grammatical mistakes. Seriously, I didn't do that on purpose. I only noticed the error on reading it back after sending. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Mon, Feb 2, 2015 at 1:35 PM, Matthew Barnett auxl...@mrabarnett.plus.com wrote: And the plural of virus is viruses, not viri (that's the plural of vir) or virii (that would be the plural of virius, if it existed). Yes indeed.Virii and octopi are as wrong as hice for houses (paralleling mice). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Michael Torrie torr...@gmail.com: http://en.cppreference.com/w/cpp/utility/functional/function Thus if we were to shoehorn your example into C++, the result would be idiomatically very similar to what you have in your Python code. I can understand why you wouldn't write out my example in C++: using std::placeholders::_1; std::functionvoid(int) f_add_display2 = std::bind( Foo::print_add, foo, _1 ); vs f_add_display2 = foo.print_add The cherry on top: _1! The C++ compiler figures out template types heroically but can't wrap its head around the arity of the method. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Chris Angelico wrote: On Mon, Feb 2, 2015 at 12:59 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: And there are underspecified rules too. What is the plural of octopus? No fair looking it up in the dictionary. Standard and well-known piece of trivia, and there are several options. Octopodes is one of the most rigorously formal, but octopuses is perfectly acceptable. Octopi is technically incorrect, as the -us ending does not derive from the Latin. And that would be relevant if we were speaking Latin, but we aren't :-P -- Steve -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Mon, Feb 2, 2015 at 3:14 PM, Roy Smith r...@panix.com wrote: In article 54ceda0b$0$12977$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: What is the plural of octopus? It's a trick question. Octopus is already plural. Monopus is singular. People is already plural, too, but you can talk about all the peoples of the world. Also, I can use people as the subject and is as the verb, just to completely destroy any chance of a simple grammar parser being able to cope with English. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Saturday, January 31, 2015 at 5:52:58 PM UTC+5:30, Marko Rauhamaa wrote: Esthetically, I'm most impressed with Scheme. One day it might give Python a run for its money. Marko Aren't you getting this backwards? http://www.wisdomandwonder.com/link/2110/why-mit-switched-from-scheme-to-python Dont get me wrong: Ive had more fun with scheme than any other language. [And APL for very different reasons] Its just that its 2015 now not 1985... People did not 'settle' the question: How many angels can dance on the head of a pin. It just stopped being relevant. Likewise, which is the 'best' programming language is a question without the edge it had when I was a student -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Saturday, January 31, 2015 at 4:34:14 PM UTC+5:30, Steven D'Aprano wrote: Yesterday, as I wrote that message, my web browser crashed *eight times* in a matter of half an hour. There are thousands of serious security vulnerabilities due to mishandled pointers. Anyone who thinks that Linux is secure is deluding themselves. It's only secure in comparison to nightmares like Windows. The fact is, the security of computer systems is best described as with care and attention to detail, we can make it merely awful. Beware that may be closer to ghost than you may think http://blog.trendmicro.com/trendlabs-security-intelligence/analyzing-cve-2015-0311-flash-zero-day-vulnerability/ -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Am 30.01.15 um 19:23 schrieb Paul Rubin: Michael Torrie torr...@gmail.com writes: Follow basic [C++] rules and 99% of segfaults will never happen and the majority of leaks will not happen either. That is a safe and simple approach, but it works by copying data all over the place instead of passing pointers, resulting in performance loss. This performance loss is partly a myth. Consider the following code, assuming it is compiled using a recent (C++11) compiler #include vector std::vectordouble compute() { const size_t N=10; std::vectordouble result(N); for (size_t i=0; iN; i++) { result[i]=2*i; } return result; } int main() { auto s = compute(); // print it or whatever return 0; } = At first, it may seem that this code copies the big vector twice: Once into a temporary return value, once into the automatic variable s. This is not the case, once for the move constructors in C++11 and second for return value optimization, some years already in the compilers. Instead, the vector is constructed directly into the place where the main functinos expects it to be. Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 31/01/2015 15:50, Rustom Mody wrote: On Saturday, January 31, 2015 at 5:52:58 PM UTC+5:30, Marko Rauhamaa wrote: Esthetically, I'm most impressed with Scheme. One day it might give Python a run for its money. Marko Aren't you getting this backwards? http://www.wisdomandwonder.com/link/2110/why-mit-switched-from-scheme-to-python Dont get me wrong: Ive had more fun with scheme than any other language. [And APL for very different reasons] Its just that its 2015 now not 1985... People did not 'settle' the question: How many angels can dance on the head of a pin. It just stopped being relevant. Likewise, which is the 'best' programming language is a question without the edge it had when I was a student The answer is beautifully put here https://mail.python.org/pipermail/python-list/2002-November/154258.html so I have no hesitation in reposting for the umpteenth time. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Rustom Mody rustompm...@gmail.com: On Saturday, January 31, 2015 at 5:52:58 PM UTC+5:30, Marko Rauhamaa wrote: Esthetically, I'm most impressed with Scheme. One day it might give Python a run for its money. Aren't you getting this backwards? Deep down I'm a minimalist romantic. Its just that its 2015 now not 1985... Python was conceived in the late 1980s [Python, Wikipedia] Scheme was conceived in the 1920s. [Combinatory Logic, Wikipedia] People did not 'settle' the question: How many angels can dance on the head of a pin. It just stopped being relevant. Speak for yourself. It's just that the answer was found: ι = λf.((fS)K) [Iota and Jot, Wikipedia] Donc Dieu existe, répondez! Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Marko Rauhamaa wrote: I'm most impressed with Scheme. One day it might give Python a run for its money. Scheme is forty years old, having come out in 1975. Python is 24 years old, having come out in 1991. If Scheme hasn't caught up with Python by now, it never will. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Rustom Mody rustompm...@gmail.com: There is a real conflict between the logician's goal and the educator's. The logician wants to minimize the variety of ideas, and doesn't mind a long, thin path. The educator (rightly) wants to make the paths short and doesn't mind–in fact, prefers–connections to many other ideas. And he cares almost not at all about the directions of the links. The natural language has a rigorous grammar plus a lexicon that includes a number of idioms. Nobody has so far been able to codify a natural language completely because the rigorous grammar consists of maybe 10,000 rules. Perl came out of the needs of natural language translation. Perl's novel idea was to make a programming language like a natural language (yes, there had been Cobol). So Perl's language description evades a complete, rigorous description, but it has numerous handy idioms for many common situations. Python showed that while interesting and amusing, Perl's way leads to unnecessary clutter. Why make things complicated when simple will serve everybody's needs best. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Saturday, January 31, 2015 at 11:13:29 PM UTC+5:30, Marko Rauhamaa wrote: Rustom Mody: On Saturday, January 31, 2015 at 5:52:58 PM UTC+5:30, Marko Rauhamaa wrote: Esthetically, I'm most impressed with Scheme. One day it might give Python a run for its money. Aren't you getting this backwards? Deep down I'm a minimalist romantic. Its just that its 2015 now not 1985... Python was conceived in the late 1980s [Python, Wikipedia] Scheme was conceived in the 1920s. [Combinatory Logic, Wikipedia] People did not 'settle' the question: How many angels can dance on the head of a pin. It just stopped being relevant. Speak for yourself. It's just that the answer was found: ι = λf.((fS)K) [Iota and Jot, Wikipedia] Donc Dieu existe, répondez! My répondez: Marvin Minsky's Turing award lecture http://web.media.mit.edu/~minsky/papers/TuringLecture/TuringLecture.html There is a real conflict between the logician's goal and the educator's. The logician wants to minimize the variety of ideas, and doesn't mind a long, thin path. The educator (rightly) wants to make the paths short and doesn't mind–in fact, prefers–connections to many other ideas. And he cares almost not at all about the directions of the links. Anyway… Thanks for those links or rather the pointer to http://en.wikipedia.org/wiki/Iota_and_Jot -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Marko Rauhamaa ma...@pacujo.net writes: The guiding principle in C++ language development is to take static type safety to the extreme. Heh, try Ada. Stroustrup apparently has never had to deal with callbacks; his thick books never made a mention of them last time I checked. C++ has function pointers just like C, but more idiomatically you'd pass a class instance and the library would invoke some method on it. There is also Boost::Coroutine which can get rid of the need for callbacks in some situations. Esthetically, I'm most impressed with Scheme. One day it might give Python a run for its money. It's in a small and shrinking niche, unfortunately. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Michael Torrie wrote: On 01/30/2015 04:50 PM, Steven D'Aprano wrote: Oh great. So if the average application creates a hundred thousand pointers of the course of a session, you'll only have a thousand or so seg faults and leaks. Well, that certainly explains this: https://access.redhat.com/articles/1332213 I fail to see the connection. The connection is that you made a comment about eliminating 99% of segfaults, as if that was something to be proud of. It's not. Like 99% uptime (which means you are down for over three and a half days per year), it's not very impressive. All it takes is *one* mishandled pointer, and you can have a seg fault, leak, buffer overflow, security exploit, or other serious bug. Which leads to vulnerabilities like Ghost. Yesterday, as I wrote that message, my web browser crashed *eight times* in a matter of half an hour. There are thousands of serious security vulnerabilities due to mishandled pointers. Anyone who thinks that Linux is secure is deluding themselves. It's only secure in comparison to nightmares like Windows. The fact is, the security of computer systems is best described as with care and attention to detail, we can make it merely awful. And the manual use of pointers in low-level languages like C is a huge factor in that. GLibc is a low-level library written in C, not C++. By its nature requires a lot of pointer use, and is prone to having errors. But not that many, seeing as *all* Linux software depends on it and uses at least part of it *all* the time. Pretty remarkable if you ask me. Wonder how they do it. Perhaps they try to follow basic rules. Exactly. And as Ghost demonstrates, that is *not good enough*. Manual low-level pointer manipulation is an anti-pattern. What you glibly describe as programmers following basic rules has proven to be beyond the ability of the programming community as a whole. I don't see how you would write system code without this anti-pattern as you describe. Python is a great language for everything else, but I certainly wouldn't call it a system language. I didn't actually mention Python. Couldn't write a kernel in it without providing it with some sort of unsafe memory access (pointers!). Or even write a Python interpreter (Yes there's PyPy, but with a jit it's still working with pointers). Systems languages now are, in a sense, in the same position that programming was back in the days before the invention of Fortran. The programmer, writing in a low-level assembly, was responsible for pushing items onto the stack, jumping to a sub-routine, popping the arguments off, then jumping back to the return address. Before Fortran, there were a number of proto-languages that aimed to make that safer, but Fortran was the first language where the compiler itself could completely handle all the book-keeping needed to use functions easily and safely. The problem is not *pointers*, but manual low-level pointer manipulation, as I said. We programmers are expected to work out how much memory we need before allocating a pointer, remember to check whether it is nil or not before dereferencing it, don't forget to release the memory when you're done, oh you just wrote past the end of the buffer and now the Russian mob owns your computer... Where are the systems languages that will do to pointer access what Fortran did to the stack? They do exist: Rust claims to be a blazing fast systems language that is memory-safe and eliminates dangling pointers and buffer overflows at compile time. Assuming this is true, that means that the Rust compiler could generate code that is just as fast and efficient as C but without all the unsafe memory accesses of C. http://doc.rust-lang.org/nightly/intro.html#ownership I've never used Rust. I don't know whether it is ready for kernel development, or whether it lives up to its claims. Rust itself is not the point: there are other approaches to memory-safety, some of them are suitable for application development and some are suitable for systems languages. C is now four decades old. It took a single decade to go from hand-writing machine code in binary to Fortran, and here we are sixty years later still having buffer overflows. The fact that C is still one of the top three *application development languages* is a shameful indictment on the conservatism, resistance to change, intellectual laziness and hubris of the programming community as a whole. I won't go so far as to say that C must die. But it must become a niche language, used for the tiny (and growing ever more tiny as time goes on) segment of code that modern, memory-safe languages *provably* cannot handle. What I call glibly basic rules are in fact shown to more or less work out, as Glibc proves. Pointer use does lead to potential vulnerabilities. And they must be corrected as they are found. Still not sure what your point is. No. They must be prevented from existing in the first place. We
Re: [OT] fortran lib which provide python like data type
Gregory Ewing greg.ew...@canterbury.ac.nz: I'm completely convinced nowadays that there is *no* use case for C++. While I wouldn't go quite that far (my most recent creation was written in C++; why? because the legacy support libraries were written in C++). However, C++ is like putting lipstick on a pig. In fact, C++ has so much makeup on you wouldn't even no there's a pig underneath it. The guiding principle in C++ language development is to take static type safety to the extreme. That overriding principle has sacrificed other objectives and made working with the language painful. And despite all that machinery, C++ omitted the simplest of things that Delphi/C# got right: delegates. Stroustrup apparently has never had to deal with callbacks; his thick books never made a mention of them last time I checked. Java was a masterful simplification of C++ although it, too, has taken on unnecessary weight in the form of annotations, generics and closures. I was exposed to Java very late in the game and was very positively impressed by the programming model. Too bad Java's ecosystem and stringent portability requirements make it difficult to integrate Java with other software. At any rate, Java makes for a great production server backend language with its high-level programming features coupled with great performance. Currently, my main programming languages are bash, Python and C. They work beautifully together and cover the whole gamut of programming needs from interrupt routines all the way to test automation. Over time, I've shifted more and more weight from bash to Python because Python's predictable, flexible semantics has turned out to be worth its clunky multiprocessing facilities. Python exposes the OS facilities so doing the right thing in the linux ecosystem is very possible (unlike in Java). Python, too, is fast picking up Stroustrup-esque features so I'm a bit concerned for losing Python as the no-nonsense swiss-army knife. Esthetically, I'm most impressed with Scheme. One day it might give Python a run for its money. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Friday, January 30, 2015 at 1:03:03 PM UTC+5:30, Christian Gollwitzer wrote: Am 30.01.15 um 02:40 schrieb Rustom Mody: FORTRAN use dictionary type(dictionary), pointer :: d d=dict_new() call set(d//'toto',1) v = d//'toto' call dict_free(d) The corresponding python d = dict() d['toto'] = 1 v = d['toto'] del(d) In particular note the del in the python. Should highlight the point that languages with gc, support data structures in a way that gc-less languages - Fortran, C, C++ - do not and cannot. For C++ this is not correct. Ususally a garbage collector is not used - though possible - but the constructor/destructor/assignment op in C++ (usually called RAII) provide semantics very similar to the CPython refcounting behaviour. You may be right... Dont claim to be able to wrap my head round C++ However... For example, I made a set of C++ interface methods to return nested dicts/list to Python, which is far from complete, but allows to write something like this: SWList do_something(SWDict attrs) { SWList result; for (int i=0; i5; i++) { SWDict entry; entry.insert(count, i); entry.insert(name, something); result.push_back(entry); } return result; } There is also Boost::Python which does the same, I think, and much more, but only supports Python, whereas I use SWIG to interface these dicts/lists to both CPython and Tcl. You cannot, however, resolve certain cyclic dependencies with pure reference counting. ... if I restate that in other words it says that sufficiently complex data structures will be beyond the reach of the standard RAII infrastructure. Of course this only brings up one side of memory-mgmt problems viz. unreclaimable memory. What about dangling pointers? C++ apps are prone to segfault. Seems to suggest (to me at least) that the memory-management infrastructure is not right. Stroustrup talks of the fact that C++ is suitable for lightweight abstractions. In view of the segfault-proneness I'd say they are rather leaky abstractions. But as I said at the outset I dont understand C++ -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 01/30/2015 09:27 AM, Rustom Mody wrote: ... if I restate that in other words it says that sufficiently complex data structures will be beyond the reach of the standard RAII infrastructure. Of course this only brings up one side of memory-mgmt problems viz. unreclaimable memory. What about dangling pointers? C++ apps are prone to segfault. Seems to suggest (to me at least) that the memory-management infrastructure is not right. Stroustrup talks of the fact that C++ is suitable for lightweight abstractions. In view of the segfault-proneness I'd say they are rather leaky abstractions. But as I said at the outset I dont understand C++ Yes I can tell you haven't used C++. Compared to C, I've always found memory management in C++ to be quite a lot easier. The main reason is that C++ guarantees objects will be destroyed when going out of scope. So when designing a class, you put any allocation routines in the constructor, and put deallocation routines in the destructor. And it just works. This is something I miss in other languages, even Python. And for many things, though it's not quite as efficient, when dealing with objects you can forgo pointers altogether and just use copy constructors, instead of the blah *a = new blah_with_label(hello) //allocate on heap //forget to delete a and it leaks the heap *and* anything //that class blah allocated on construction. just simply declare objects directly and use them: blah a(hello) //assuming there's a constructor that takes a string //deletes everything when it goes out of scope So for the lightweight abstractions Stroustrup talks about, this works very well. And you'll rarely have a memory leak (only in the class itself) and no dangling pointers. For other things, though, you have to dynamically create objects. But the C++ reference-counting smart pointers offer much of the same destruction semantics as using static objects. It's really a slick system. Almost makes memory management a non-issue. Circular references will still leak (just like they do on Python). But it certainly makes life a lot more pleasant than in C from a memory management perspective. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Michael Torrie torr...@gmail.com wrote: Yes I can tell you haven't used C++. Compared to C, I've always found memory management in C++ to be quite a lot easier. The main reason is that C++ guarantees objects will be destroyed when going out of scope. So when designing a class, you put any allocation routines in the constructor, and put deallocation routines in the destructor. And it just works. This is something I miss in other languages, even Python. Python has context managers for that. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Michael Torrie wrote: On 01/30/2015 10:31 AM, Rustom Mody wrote: And what about the grey area between lightweight and heavyweight? That's what the smart pointers are for. I'd say it's what higher-level languages are for. :-) I'm completely convinced nowadays that there is *no* use case for C++. If you need to program the bare metal, use C. For anything more complicated, use a language that has proper memory-management abstractions built in. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Friday, January 30, 2015 at 10:39:12 PM UTC+5:30, Michael Torrie wrote: On 01/30/2015 09:27 AM, Rustom Mody wrote: ... if I restate that in other words it says that sufficiently complex data structures will be beyond the reach of the standard RAII infrastructure. Of course this only brings up one side of memory-mgmt problems viz. unreclaimable memory. What about dangling pointers? C++ apps are prone to segfault. Seems to suggest (to me at least) that the memory-management infrastructure is not right. Stroustrup talks of the fact that C++ is suitable for lightweight abstractions. In view of the segfault-proneness I'd say they are rather leaky abstractions. But as I said at the outset I dont understand C++ Yes I can tell you haven't used C++. Compared to C, I've always found memory management in C++ to be quite a lot easier. The main reason is that C++ guarantees objects will be destroyed when going out of scope. I hear you and I trust you as a gentleman but I dont trust C++ :-) The only time in some near 15 years of python use that I got it to segfault was when Ranting Rick gave some wx code to try [at that time he was in rant-against-tk mode] Sure enough it was related to the fact that wx is written in C++ and some expectations were not being followed. So when designing a class, you put any allocation routines in the constructor, and put deallocation routines in the destructor. And it just works. This is something I miss in other languages, even Python. And for many things, though it's not quite as efficient, when dealing with objects you can forgo pointers altogether and just use copy constructors, instead of the blah *a = new blah_with_label(hello) //allocate on heap //forget to delete a and it leaks the heap *and* anything //that class blah allocated on construction. just simply declare objects directly and use them: blah a(hello) //assuming there's a constructor that takes a string //deletes everything when it goes out of scope So for the lightweight abstractions Stroustrup talks about, this works very well. And you'll rarely have a memory leak (only in the class itself) and no dangling pointers. And what about the grey area between lightweight and heavyweight? You say just use copy constructors and no pointers. Can you (ie C++) guarantee that no pointer is ever copied out of scope of these copy-constructed objects? For other things, though, you have to dynamically create objects. But the C++ reference-counting smart pointers offer much of the same destruction semantics as using static objects. It's really a slick system. Almost makes memory management a non-issue. Circular references will still leak (just like they do on Python). But it certainly makes life a lot more pleasant than in C from a memory management perspective. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 01/30/2015 10:31 AM, Rustom Mody wrote: And what about the grey area between lightweight and heavyweight? That's what the smart pointers are for. You say just use copy constructors and no pointers. Can you (ie C++) guarantee that no pointer is ever copied out of scope of these copy-constructed objects? If that happened, then it's because you the programmer wanted it to happen. It's not just going to happen all by itself. Yes anytime pointers are allowed, things are potentially unsafe in the hands of a programmer. I'm just saying it's not nearly so bad as you make it out to be. Follow basic rules and 99% of segfaults will never happen and the majority of leaks will not happen either. Python can still leak badly if a programmer causes it to. As for segfaulting, no your python code should not itself segfault. C++ code certainly could. Exposing pointers to the programmer can be very powerful (and necessary... cannot write a bare-metal OS in common Python) but the programmer can screw it up too on occasion. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Michael Torrie torr...@gmail.com writes: Follow basic [C++] rules and 99% of segfaults will never happen and the majority of leaks will not happen either. That is a safe and simple approach, but it works by copying data all over the place instead of passing pointers, resulting in performance loss. Alex Martelli used to post a good riff here about how the main reason to use C++ in the first place was for when you needed to explicitly control resources for performance. So the data copying style seems to somewhat miss the point. Smart pointers have similar issues to Python's reference-counted allocation, e.g. cache and thread unfriendliness, and no compaction mechanism AFAIK. Plus I always found them scary in terms of subtle bug potential due to abstraction leaks. But I haven't used them so far. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Michael Torrie wrote: If that happened, then it's because you the programmer wanted it to happen. It's not just going to happen all by itself. Yes anytime pointers are allowed, things are potentially unsafe in the hands of a programmer. I'm just saying it's not nearly so bad as you make it out to be. Follow basic rules and 99% of segfaults will never happen and the majority of leaks will not happen either. Oh great. So if the average application creates a hundred thousand pointers of the course of a session, you'll only have a thousand or so seg faults and leaks. Well, that certainly explains this: https://access.redhat.com/articles/1332213 Manual low-level pointer manipulation is an anti-pattern. What you glibly describe as programmers following basic rules has proven to be beyond the ability of the programming community as a whole. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Gregory Ewing wrote: I'm completely convinced nowadays that there is no use case for C++. I can think of one use-case for C++. You walk up to somebody in the street, say I wrote my own C++ parser!, and while they are gibbering and shaking in shock, you rifle through their pockets and steal any valuables you find. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 01/30/2015 04:50 PM, Steven D'Aprano wrote: Oh great. So if the average application creates a hundred thousand pointers of the course of a session, you'll only have a thousand or so seg faults and leaks. Well, that certainly explains this: https://access.redhat.com/articles/1332213 I fail to see the connection. GLibc is a low-level library written in C, not C++. By its nature requires a lot of pointer use, and is prone to having errors. But not that many, seeing as *all* Linux software depends on it and uses at least part of it *all* the time. Pretty remarkable if you ask me. Wonder how they do it. Perhaps they try to follow basic rules. Manual low-level pointer manipulation is an anti-pattern. What you glibly describe as programmers following basic rules has proven to be beyond the ability of the programming community as a whole. I don't see how you would write system code without this anti-pattern as you describe. Python is a great language for everything else, but I certainly wouldn't call it a system language. Couldn't write a kernel in it without providing it with some sort of unsafe memory access (pointers!). Or even write a Python interpreter (Yes there's PyPy, but with a jit it's still working with pointers). What I call glibly basic rules are in fact shown to more or less work out, as Glibc proves. Pointer use does lead to potential vulnerabilities. And they must be corrected as they are found. Still not sure what your point is. Is there a reason to use C or C++ for many of us? Nope. I'm not arguing that we should find them of use. It's easy for us to sit on Python and look with contempt at C or C++, but they really do have their place (C more than C++ IMO). This is so far off the original topic that it probably is construed that I am arguing for C++ vs Python or something. But I am not. I'm quite content with Python. There are a host of languages I find interesting including D, Google Go, Vala, FreeBASIC, Mozilla Rust, etc. But Python fits my needs so well, I can't be bothered to invest much time in these other languages. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On 01/30/2015 04:12 PM, Sturla Molden wrote: Michael Torrie torr...@gmail.com wrote: Yes I can tell you haven't used C++. Compared to C, I've always found memory management in C++ to be quite a lot easier. The main reason is that C++ guarantees objects will be destroyed when going out of scope. So when designing a class, you put any allocation routines in the constructor, and put deallocation routines in the destructor. And it just works. This is something I miss in other languages, even Python. Python has context managers for that. Right I had forgotten about that. That's a good solution for dynamic, GC languages. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Thursday, January 29, 2015 at 10:01:00 AM UTC-5, Liu Zhenhai wrote: Hi, I am not sure here is the right place to ask this question, but I want to give it a shot:) are there fortran libs providing python like data type, such as set, dict, list? Thanks, Yours liuzhenhai The Fortran library http://bigdft.org/Wiki/index.php?title=Fortran_library appears to have some of what you want. I have not tried the code. The flib library provides an object called dictionary which is -- strictly speaking -- more than just a dictionary. It is polymorphic and can be a list or a dictionary, as in the python language. The other difference is that it keeps the order of the elements, which is very useful if we want to dump its contents to the yaml output. It represents indeed a tree of data, and for these reasons it will most likely change name into f_tree in a future release of the module. These dictionaries are also used in the other parts of the flib library and are thus essential for its proper use. There are many examples in the file dicts.f90. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
On Friday, January 30, 2015 at 4:09:19 AM UTC+5:30, beli...@aol.com wrote: On Thursday, January 29, 2015 at 10:01:00 AM UTC-5, Liu Zhenhai wrote: Hi, I am not sure here is the right place to ask this question, but I want to give it a shot:) are there fortran libs providing python like data type, such as set, dict, list? Thanks, Yours liuzhenhai The Fortran library http://bigdft.org/Wiki/index.php?title=Fortran_library appears to have some of what you want. I have not tried the code. The flib library provides an object called dictionary which is -- strictly speaking -- more than just a dictionary. It is polymorphic and can be a list or a dictionary, as in the python language. The other difference is that it keeps the order of the elements, which is very useful if we want to dump its contents to the yaml output. It represents indeed a tree of data, and for these reasons it will most likely change name into f_tree in a future release of the module. These dictionaries are also used in the other parts of the flib library and are thus essential for its proper use. There are many examples in the file dicts.f90. Interesting Note the very first minimal example FORTRAN use dictionary type(dictionary), pointer :: d d=dict_new() call set(d//'toto',1) v = d//'toto' call dict_free(d) The corresponding python d = dict() d['toto'] = 1 v = d['toto'] del(d) In particular note the del in the python. Should highlight the point that languages with gc, support data structures in a way that gc-less languages - Fortran, C, C++ - do not and cannot. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] fortran lib which provide python like data type
Am 30.01.15 um 02:40 schrieb Rustom Mody: FORTRAN use dictionary type(dictionary), pointer :: d d=dict_new() call set(d//'toto',1) v = d//'toto' call dict_free(d) The corresponding python d = dict() d['toto'] = 1 v = d['toto'] del(d) In particular note the del in the python. Should highlight the point that languages with gc, support data structures in a way that gc-less languages - Fortran, C, C++ - do not and cannot. For C++ this is not correct. Ususally a garbage collector is not used - though possible - but the constructor/destructor/assignment op in C++ (usually called RAII) provide semantics very similar to the CPython refcounting behaviour. For example, I made a set of C++ interface methods to return nested dicts/list to Python, which is far from complete, but allows to write something like this: SWList do_something(SWDict attrs) { SWList result; for (int i=0; i5; i++) { SWDict entry; entry.insert(count, i); entry.insert(name, something); result.push_back(entry); } return result; } There is also Boost::Python which does the same, I think, and much more, but only supports Python, whereas I use SWIG to interface these dicts/lists to both CPython and Tcl. You cannot, however, resolve certain cyclic dependencies with pure reference counting. Christian -- https://mail.python.org/mailman/listinfo/python-list