Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!
On Feb 29, 5:09 am, Xah Lee wrote: > New Science Discovery: Perl Idiots Remain Idiots After A Decade! > > A excerpt from the new book 〈Modern Perl〉, just published, chapter 4 > on “Operators”. Quote: > > «The associativity of an operator governs whether it evaluates from > left to right or right to left. Addition is left associative, such > that 2 + 3 + 4 evaluates 2 + 3 first, then adds 4 to the result. > Exponentiation is right associative, such that 2 ** 3 ** 4 evaluates 3 > ** 4 first, then raises 2 to the 81st power. » > > LOL. Looks like the perl folks haven't changed. Fundamentals of > serious math got botched so badly. > > Let me explain the idiocy. > > It says “The associativity of an operator governs whether it evaluates > from left to right or right to left.”. Ok, so let's say we have 2 > operators: a white triangle △ and a black triangle ▲. Now, by the > perl's teaching above, let's suppose the white triangle is “right > associative” and the black triangle is “left associative”. Now, look > at this: > > 3 △ 6 ▲ 5 > > seems like the white and black triangles are going to draw a pistol > and fight for the chick 6 there. LOL. > > Now, let me tell you what operator precedence is. First of all, let's > limit ourselfs to discuss operators that are so-called binary > operators, which, in our context, basically means single symbol > operator that takes it's left and right side as operands. Now, each > symbol have a “precedence”, or in other words, the set of operators > has a order. (one easy way to think of this is that, suppose you have > n symbols, then you give each a number, from 1 to n, as their order) > So, when 2 symbols are placed side by side such as 「3 △ 6 ▲ 5」, the > symbol with higher precedence wins. Another easy way to think of this > is that each operator has a stickiness level. The higher its level, it > more sticky it is. > > the problem with the perl explanations is that it's one misleading > confusion ball. It isn't about “left/right associativity”. It isn't > about “evaluates from left to right or right to left”. Worse, the word > “associativity” is a math term that describe a property of algebra > that has nothing to do with operator precedence, yet is easily > confused with because it is a property about order of evaluation. (for > example, the addition function is associative, meaning: 「(3+6)+5 = > 3+(6+5)」.) > > compare it with this: > > 〈Perl & Python: Complex > Numbers〉http://xahlee.org/perl-python/complex_numbers.html > > and for a good understanding of functions and operators, see: > > 〈What's Function, What's > Operator?〉http://xahlee.org/math/function_and_operators.html associativity of operators mean little in the Lisp world obviously, so why was this posted here? Sorry, perl, python and emacs folks... BTW, it's the same in javascript: it is so such that 2 + 3 + "4" is "54" and "2" + 3 + 4 is "234". Blame weak typing and + overloading, though it may be a blessing. -- http://mail.python.org/mailman/listinfo/python-list
Re: Google AI challenge: planet war. Lisp won.
On Dec 22 2010, 12:46 pm, Xah Lee wrote: > On Dec 20, 10:06 pm, "Jon Harrop" wrote: > > > Wasn't that the "challenge" where they wouldn't even accept solutions > > written in many other languages (including both OCaml and F#)? > > Ocaml is one of the supported lang. See: > > http://ai-contest.com/starter_packages.php > > there are 12 teams using OCaml. See:http://ai-contest.com/rankings.php > (click on the lang to see all teams using that lang) > > Xah PWNED -- http://mail.python.org/mailman/listinfo/python-list
Re: Google AI challenge: planet war. Lisp won.
On 2 dez, 15:06, Xah Lee wrote: > discovered this rather late. > > Google has a AI Challenge: planet wars.http://ai-contest.com/index.php > > it started sometimes 2 months ago and ended first this month. > > the winner is Gábor Melis, with his code written in lisp. > > Congrats lispers! > > Gábor wrote a blog about it > herehttp://quotenil.com/Planet-Wars-Post-Mortem.html > > (not sure if this has been mentioned here but quick search didn't find > it) > > Xah ∑http://xahlee.org/☄ definitely cool! -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 25 nov, 14:30, m_mom...@yahoo.com (Mario S. Mommer) wrote: > Raffael Cavallaro > writes: > > > On 2010-11-24 16:19:49 -0500, toby said: > > >> And furthermore, he has cooties. > > > Once again, not all ad hominem arguments are ad hominem > > fallacies. Financial conflict of interest is a prime example of a > > perfectly valid ad hominem argument. > > It has limited validity. People are way more complicated than the > simplistic "follow your own selfish egoistic interests to the letter > without taking prisoners" model of human behavior that seems > (unfortunately) so prevalent nowadays. > > > People who parse patterns but not semantics are apt to fall into the > > error of believing that "ad hominem" automatically means "logically > > invalid." This is not the case. > > In the realm of pure logic, ad hominems are logically invalid, > period. However, if the question cannot be resolved by its own merits, > simple logic has little to say, and you may include additional > information in a sort-of Bayesian fashion. > > Saying that a conflict of interest means that nothing this person says > makes any sense at all is in a way an admission that the subject of > discussion is not very amenable to rational argument. I have to say I'm always amazed how ad hominens can generate quite strong responses to the point of making a lot of new faces (or mail accounts) suddenly appear... ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 25 nov, 09:23, Elena wrote: > On Oct 13, 9:09 pm, namekuseijin wrote: > > > > > > > On 11 out, 08:49, Oleg Parashchenko wrote: > > > > Hello, > > > > I'd like to try the idea that Scheme can be considered as a new > > > portable assembler. We could code something in Scheme and then compile > > > it to PHP or Python or Java or whatever. > > > > Any suggestions and pointers to existing and related work are welcome. > > > Thanks! > > > > My current approach is to take an existing Scheme implementation and > > > hijack into its backend. At this moment Scheme code is converted to > > > some representation with a minimal set of bytecodes, and it should be > > > quite easy to compile this representation to a target language. After > > > some research, the main candidates are Gambit, Chicken and CPSCM: > > > >http://uucode.com/blog/2010/09/28/r5rs-scheme-as-a-virtual-machine-i/... > > > > If there is an interest in this work, I could publish progress > > > reports. > > > > -- > > > Oleg Parashchenko o...@http://uucode.com/http://uucode.com/blog/ XML, > > > TeX, Python, Mac, Chess > > > it may be assembler, too bad scheme libs are scattered around written > > in far too many different flavors of assembler... > > > It warms my heart though to realize that Scheme's usual small size and > > footprint has allowed for many quality implementations targetting many > > different backends, be it x86 assembly, C, javascript or .NET. Take > > python and you have a slow c bytecode interpreter and a slow > > bytecode .NET compiler. Take haskell and its so friggin' huge and > > complex that its got its very own scary monolithic gcc. When you > > think of it, Scheme is the one true high-level language with many > > quality perfomant backends -- CL has a few scary compilers for native > > code, but not one to java, .NET or javascript that I know of... > > Take R5RS Scheme and you get a language which doesn't allow you to get > things done. > > Scheme is as far from Assembly as one language can be. Assembly > exists to get things done, R5RS Scheme does not even allows you load > native libraries of the underlying operating-system, does it? It's > easy to stay small and clean when you don't have to dirty your hands > with such crap as real-world applications development.- Ocultar texto das > mensagens anteriores - assembly in the sense that it's what other languages could compile to. Like many are targetting javascript, the de facto assembly of the web... In any case, the original poster was advocating the opposite: to code in Scheme and compile it to more common backends, such as PHP or javascript... I misunderstood his point. But the flamewars that followed were far more entertaining anyway... :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 22 nov, 14:47, Howard Brazee wrote: > On Mon, 22 Nov 2010 08:14:40 -0800 (PST), toby > > wrote: > >This is a good (if familiar) observation. Teaching children (or young > >people with little exposure to computers) how to program in various > >paradigms could produce interesting primary evidence. Pity that this > >isn't examined widely and systematically. We could learn something > >about how to teach programming and design languages this way, don't > >you agree? > > I do. > > A study such as that would be more useful than how to teach languages > - it could be useful in teaching other stuff as well. yes, pity most children are (used to be) taught Basic first. Also, with a study like this, it's likely some children would be taught some lame language and others would be taught some "industrial strength" language and still others would be taught some esoteric language. I'm not sure it'd prove as much as we are hoping for -- as they are all Turing equivalent and the kids would be able to eventually do the task asked for in any of them -- but I'm sure some of those children would be mentally hurt for all their life. Poor pioneers :p JH, nice to have you back! :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Land Of Lisp is out
On 29 out, 19:06, Alessio Stalla wrote: > On 28 Ott, 10:42, p...@informatimago.com (Pascal J. Bourguignon) > wrote: > > > sthueb...@googlemail.com (Stefan Hübner) writes: > > >> Would it be right to say that the only Lisp still in common use is the > > >> Elisp > > >> built into Emacs? > > > > Clojure (http://clojure.org) is a Lisp on the JVM. It's gaining more and > > > more traction. > > > There are actually 2 REAL Lisp on the JVM: > > > - abclhttp://common-lisp.net/project/armedbear/and > > > - CLforJavahttp://www.clforjava.org > > Well, there are a few Scheme implementations too. Kawa is "famous" for > having been used by Google as the basis for their App Inventor for > Android. And I wouldn't define Clojure a "fake" Lisp. It has some > aspects I don't like, but it is definitely in the Lisp family. > Actually CLforJava as far as I know is missing crucial features (e.g. > CLOS) and in some aspects is more tied to Java than Clojure. Schemes are also missing CLOS, as is Clojure, and I still see them as Lisps... CLforJava is a student project not in the same league as even single- maintainer projects like bigloo or gambit... -- http://mail.python.org/mailman/listinfo/python-list
Re: Land Of Lisp is out
On 27 out, 21:55, Lawrence D'Oliveiro wrote: > Would it be right to say that the only Lisp still in common use is the Elisp > built into Emacs? Perhaps you should ask Google's Peter Norvig... -- http://mail.python.org/mailman/listinfo/python-list
Re: Land Of Lisp is out
On 28 out, 07:02, p...@informatimago.com (Pascal J. Bourguignon) wrote: > Alain Ketterlin writes: > > Lawrence D'Oliveiro writes: > > Would it be right to say that the only Lisp still in common use is the > Elisp built into Emacs? > > >>> There is a new version of Lisp called Clojure that runs on the Java > >>> Virtual Machine (JVM) that is on the upswing. > > >> Now is not exactly a good time to build new systems crucially dependent on > >> the continuing good health of Java though, is it? > > > Nonsense. See > >http://blogs.sun.com/theaquarium/entry/ibm_and_oracle_to_collaborate > > Last time I remember a corporation having developed a nice software > (NeXTSTEP), Sun joined it to make an "OpenStep", and a few years alter > it was over, bought by Apple, and morphed into MacOSX, and none of my > NeXTSTEP (or even OpenStep) programs compile anymore on my computers. > > In the meantime, I switched to Linux. great, now you can use GNUStep: http://gnustep.org/ :D > So now IBM and Oracle join to make an OpenJDK? java is sinking, soon enough java programmers will be as rare and well paid as COBOLlers... -- http://mail.python.org/mailman/listinfo/python-list
Re: Land Of Lisp is out
On 28 out, 06:46, Xah Lee wrote: > lol. He said REAL! > > how about the 10 Scheme Lisps on JVM? guess they are UNREAL. lol you know only CL is the real lisp and schmers are just zanny time- travelling folks as the webcomic depict. :p > btw, who cross posted this thread to python? i call troll! glad to be of help. -- http://mail.python.org/mailman/listinfo/python-list
Re: Land Of Lisp is out
On 27 out, 09:46, Xah Lee wrote: > The Land Of Lisp is out! > > http://landoflisp.com/ > > Very well done site. > > spread the news, team lisp! > > Xah haha, I've read some of the comics before. It's truly remarkably funny, no matter the language of your choice... going well down the rabbit hole should convince one... :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 14 out, 00:26, Ertugrul Söylemez wrote: > BTW, you mentioned symbols ('$', '.' and '>>='), which are not syntactic > sugar at all. They are just normal functions, for which it makes sense > to be infix. The fact that you sold them as syntactic sugar or > "perlisms" proves that you have no idea about the language, so stop > crying. Also Python-style significant whitespace is strictly optional. > It's nice though. After all most Haskell programmers prefer it. it still makes haskell code scattered with perlisms, be it syntax or function name... in practice, Haskell code is ridden with such perlisms and significant whitespace, and infix function application and more special cases. All of these contribute to a harder to parse language and to less compilers for it. > > And one as complex and scary beast as gcc... that's the cost of a very > > irregular syntax... > > What also proves that you have no idea is the fact that there is no > Haskell compiler called 'gcc'. That's the GNU C compiler. ORLY? do you understand what a comparison is? > Glasgow Haskell Compiler, GHC, and it's by far not the only one. It's > just the one most people use, and there is such a compiler for all > languages. yeah, there's also some Yale Haskell compiler in some graveyard, last time I heard... -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 13 out, 19:41, p...@informatimago.com (Pascal J. Bourguignon) wrote: > namekuseijin writes: > > On 11 out, 08:49, Oleg Parashchenko wrote: > >> Hello, > > >> I'd like to try the idea that Scheme can be considered as a new > >> portable assembler. We could code something in Scheme and then compile > >> it to PHP or Python or Java or whatever. > > >> Any suggestions and pointers to existing and related work are welcome. > >> Thanks! > > >> My current approach is to take an existing Scheme implementation and > >> hijack into its backend. At this moment Scheme code is converted to > >> some representation with a minimal set of bytecodes, and it should be > >> quite easy to compile this representation to a target language. After > >> some research, the main candidates are Gambit, Chicken and CPSCM: > > >>http://uucode.com/blog/2010/09/28/r5rs-scheme-as-a-virtual-machine-i/... > > >> If there is an interest in this work, I could publish progress > >> reports. > > >> -- > >> Oleg Parashchenko o...@http://uucode.com/http://uucode.com/blog/ XML, > >> TeX, Python, Mac, Chess > > > it may be assembler, too bad scheme libs are scattered around written > > in far too many different flavors of assembler... > > > It warms my heart though to realize that Scheme's usual small size and > > footprint has allowed for many quality implementations targetting many > > different backends, be it x86 assembly, C, javascript or .NET. Take > > python and you have a slow c bytecode interpreter and a slow > > bytecode .NET compiler. Take haskell and its so friggin' huge and > > complex that its got its very own scary monolithic gcc. When you > > think of it, Scheme is the one true high-level language with many > > quality perfomant backends -- CL has a few scary compilers for native > > code, but not one to java, > > Yep, it only has two for java. I hope those are not Clojure and Qi... :p -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 13 out, 21:01, Ertugrul Söylemez wrote: > What exactly is "friggin' huge" and "complex" about Haskell, and what's > this stuff about a "very own monolithic gcc"? Haskell isn't a lot more > complex than Scheme. In fact, Python is much more complex. Reduced to > bare metal (i.e. leaving out syntactic sugar) Haskell is one of the > simplest languages. yeah, like scheme, it's essentially evaluation of lambda expressions. Unlike scheme, it's got a huge plethora of syntatic sugar as big and complex as a full numeric tower. Such is the fear to avoid parentheses at all costs that they allowed lots of perlisms into the language ($ . `` >>= etc) plus python's significant whitespace. So, in practice, even though at the core it's as simple as scheme's core, at practice it's so mindnumbing complex that only one implementation is worth of note. And one as complex and scary beast as gcc... that's the cost of a very irregular syntax... -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 11 out, 08:49, Oleg Parashchenko wrote: > Hello, > > I'd like to try the idea that Scheme can be considered as a new > portable assembler. We could code something in Scheme and then compile > it to PHP or Python or Java or whatever. > > Any suggestions and pointers to existing and related work are welcome. > Thanks! > > My current approach is to take an existing Scheme implementation and > hijack into its backend. At this moment Scheme code is converted to > some representation with a minimal set of bytecodes, and it should be > quite easy to compile this representation to a target language. After > some research, the main candidates are Gambit, Chicken and CPSCM: > > http://uucode.com/blog/2010/09/28/r5rs-scheme-as-a-virtual-machine-i/http://uucode.com/blog/2010/09/28/r5rs-scheme-as-a-virtual-machine-ii/ > > If there is an interest in this work, I could publish progress > reports. > > -- > Oleg Parashchenko o...@http://uucode.com/http://uucode.com/blog/ XML, TeX, > Python, Mac, Chess it may be assembler, too bad scheme libs are scattered around written in far too many different flavors of assembler... It warms my heart though to realize that Scheme's usual small size and footprint has allowed for many quality implementations targetting many different backends, be it x86 assembly, C, javascript or .NET. Take python and you have a slow c bytecode interpreter and a slow bytecode .NET compiler. Take haskell and its so friggin' huge and complex that its got its very own scary monolithic gcc. When you think of it, Scheme is the one true high-level language with many quality perfomant backends -- CL has a few scary compilers for native code, but not one to java, .NET or javascript that I know of... -- http://mail.python.org/mailman/listinfo/python-list
Re: toy list processing problem: collect similar terms
On 30 set, 09:35, namekuseijin wrote: > On 29 set, 11:04, w_a_x_man wrote: > > > > > On Sep 26, 9:24 am, p...@informatimago.com (Pascal J. Bourguignon) > > wrote: > > > > Xah Lee writes: > > > > here's a interesting toy list processing problem. > > > > > I have a list of lists, where each sublist is labelled by > > > > a number. I need to collect together the contents of all sublists > > > > sharing > > > > the same label. So if I have the list > > > > > ((0 a b) (1 c d) (2 e f) (3 g h) (1 i j) (2 k l) (4 m n) (2 o p) (4 q > > > > r) (5 s t)) > > > > > where the first element of each sublist is the label, I need to > > > > produce: > > > > > output: > > > > ((a b) (c d i j) (e f k l o p) (g h) (m n q r) (s t)) > > > > > a Mathematica solution is here: > > > >http://xahlee.org/UnixResource_dir/writ/notations_mma.html > > > > > R5RS Scheme lisp solution: > > > >http://xahlee.org/UnixResource_dir/writ/Sourav_Mukherjee_sourav.work_... > > > > by Sourav Mukherjee > > > > > also, a Common Lisp solution can be found here: > > > >http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/5d1de... > > > > It's too complex. Just write: > > > > (let ((list '((0 a b) (1 c d) (2 e f) (3 g h) (1 i j) (2 k l) (4 m n) > > > (2 o p) (4 q r) (5 s t > > > > (mapcar (lambda (class) (reduce (function append) class :key (function > > > rest))) > > > (com.informatimago.common-lisp.list:equivalence-classes list > > > :key (function first))) > > > > ) > > > > --> ((S T) (Q R M N) (G H) (O P K L E F) (I J C D) (A B)) > > > > -- > > > __Pascal Bourguignon__ http://www.informatimago.com/ > > > Ruby: > > > [[0, 'a', 'b'], [1, 'c', 'd'], [2, 'e', 'f'], [3, 'g', 'h'], [1, > > 'i', 'j'], [2, 'k', 'l'], [4, 'm', 'n'], [2, 'o', 'p'], [4, 'q', 'r'], > > [5, 's', 't']]. > > group_by{|x| x.first}.values.map{|x| x.map{|y| y[1..-1]}.flatten} > > > ==>[["s", "t"], ["a", "b"], ["c", "d", "i", "j"], > > ["e", "f", "k", "l", "o", "p"], > > ["g", "h"], ["m", "n", "q", "r"]] > > cool, it comes with order all fucked up. This is something I was > criticized for before, though not all that important to most > functional processing. Not the case here, though. > > here's a scheme version that is hopefully better than the given one: (define (dig in) (if (null? in) '() (let* ((n (first-of-first in)) (all-n (filter in (lambda (x) (eq? n (first x) (all-but-n (filter in (lambda (x) (not (eq? n (first x))) (pair (fold all-n (lambda (i o) (pair (second i) (pair (third i) o (dig all-but-n) ; given these aliases to lisp n00bs (define pair cons) (define first car) (define rest cdr) (define first-of-first caar) (define second cadr) (define third caddr) ; and these well-known functions (non-tail-recursive for benefit of n00bs) (define (fold ls f) ; AKA reduce (if (null? ls) '() (f (first ls) (fold (rest ls) f (define (filter ls f) (fold ls (lambda (i o) (if (f i) (pair i o) o ; testing (let ((in '((0 a b) (1 c d) (2 e f) (3 g h) (1 i j) (2 k l) (4 m n) (2 o p) (4 q r) (5 s t (display (dig in)) (newline)) ;frakkin text editor... -- http://mail.python.org/mailman/listinfo/python-list
Re: toy list processing problem: collect similar terms
On 29 set, 11:04, w_a_x_man wrote: > On Sep 26, 9:24 am, p...@informatimago.com (Pascal J. Bourguignon) > wrote: > > > > > Xah Lee writes: > > > here's a interesting toy list processing problem. > > > > I have a list of lists, where each sublist is labelled by > > > a number. I need to collect together the contents of all sublists > > > sharing > > > the same label. So if I have the list > > > > ((0 a b) (1 c d) (2 e f) (3 g h) (1 i j) (2 k l) (4 m n) (2 o p) (4 q > > > r) (5 s t)) > > > > where the first element of each sublist is the label, I need to > > > produce: > > > > output: > > > ((a b) (c d i j) (e f k l o p) (g h) (m n q r) (s t)) > > > > a Mathematica solution is here: > > >http://xahlee.org/UnixResource_dir/writ/notations_mma.html > > > > R5RS Scheme lisp solution: > > >http://xahlee.org/UnixResource_dir/writ/Sourav_Mukherjee_sourav.work_... > > > by Sourav Mukherjee > > > > also, a Common Lisp solution can be found here: > > >http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/5d1de... > > > It's too complex. Just write: > > > (let ((list '((0 a b) (1 c d) (2 e f) (3 g h) (1 i j) (2 k l) (4 m n) > > (2 o p) (4 q r) (5 s t > > > (mapcar (lambda (class) (reduce (function append) class :key (function > > rest))) > > (com.informatimago.common-lisp.list:equivalence-classes list > > :key (function first))) > > > ) > > > --> ((S T) (Q R M N) (G H) (O P K L E F) (I J C D) (A B)) > > > -- > > __Pascal Bourguignon__ http://www.informatimago.com/ > > Ruby: > > [[0, 'a', 'b'], [1, 'c', 'd'], [2, 'e', 'f'], [3, 'g', 'h'], [1, > 'i', 'j'], [2, 'k', 'l'], [4, 'm', 'n'], [2, 'o', 'p'], [4, 'q', 'r'], > [5, 's', 't']]. > group_by{|x| x.first}.values.map{|x| x.map{|y| y[1..-1]}.flatten} > > ==>[["s", "t"], ["a", "b"], ["c", "d", "i", "j"], > ["e", "f", "k", "l", "o", "p"], > ["g", "h"], ["m", "n", "q", "r"]] cool, it comes with order all fucked up. This is something I was criticized for before, though not all that important to most functional processing. Not the case here, though. here's a scheme version that is hopefully better than the given one: (define (dig in) (if (null? in) '() (let* ((n (first-of-first in)) (all-n (filter in (lambda (x) (eq? n (first x) (all-but-n (filter in (lambda (x) (not (eq? n (first x))) (pair (fold all-n (lambda (i o) (pair (second i) (pair (third i) o (dig all-but-n) ; given these aliases to lisp n00bs (define pair cons) (define first car) (define rest cdr) (define first-of-first caar) (define second cadr) (define third caddr) ; and these well-known functions (non-tail-recursive for benefit of n00bs) (define (fold ls f) ; AKA reduce (if (null? ls) '() (f (first ls) (fold (rest ls) f (define (filter ls f) (fold ls (lambda (i o) (if (f i) (pair i o) o ; testing (let ((in '((0 a b) (1 c d) (2 e f) (3 g h) (1 i j) (2 k l) (4 m n) (2 o p) (4 q r) (5 s t (display (dig in)) (newline)) -- http://mail.python.org/mailman/listinfo/python-list
Re: (and scheme lisp) x Python and modern langs [was Re: gossip, Guy Steel, Lojban, Racket]
On 29 set, 17:46, Xah Lee wrote: > On Sep 29, 11:02 am, namekuseijin wrote: > > > On 28 set, 19:38, Xah Lee wrote: > > > > • “list comprehension” is a very bad jargon; thus harmful to > > > functional programing or programing in general. Being a bad jargon, it > > > encourage mis-communication, mis-understanding. > > > I disagree: it is a quite intuitive term to describe what the > > expression does. > > what's your basis in saying that “list comprehension” is intuitive? it generates a list from syntax comprehended in list-like syntax! > any statics, survery, research, references you have to cite? how about common sense? > to put this in context, are you saying that lambda, is also intuitive? No. > “let” is intuitive? yes, it's focking everyday term used in the same way: let this be this and that be that and thus... > “for” is intuitive? yes, it's focking everyday term used in the same way: for this and this and this do that... > “when” is intuitive? when this, then that? common sense, Xah! > For example, let us know, in your view, how good are terms: currying, > lisp1 lisp2, tail recursion, closure, subroutine, command, object. These terms have a technical meaning coming from historic events in the areas they are used. It's like that in all areas, you may also bash medicine jargon if you want. Though subroutine, command and object are pretty intuitive by common sense alone. > perhaps expound on the comparative merits and meaning on the terms > module vs package vs add-on vs library. I would like to see your view > on this with at least few paragraphs of analysis on each. They are all the same shit. These were developed by managers and buzzwriters... ;) > Also, “being intuitive” is not the only aspect to consider whether a > term is good or bad. For example, emacs's uses the term “frame”. It's > quite intuitive, because frame is a common english word, everyone > understands. You know, door frame, window frame, picture frame, are > all analogous to emacs's “frame” on a computer. However, by some turn > of history, in computer software we call such as “window” now, and by > happance the term “window” also has a technical meaning in emacs, what > we call “split window” or “pane” today. So, in emacs, the term “frame” > and “window” is confusing, because emacs's “frame” is what we call > “window”, while emacs's “window” is what me might call a pane of a > split window. So here, is a example, that even when a term is > intuitive, it can still be bad. emacs is all FUBAR in more than one way. being intuitive is not exactly what it is known for... ;) well, I shouldn't be bashing it, my vim is not that funky among commoners anymore anyway... :p > I wrote about 14 essays on various jargons in past decade. You can > find them on my site. yeah, I've read them once in a while... -- http://mail.python.org/mailman/listinfo/python-list
Re: (and scheme lisp) x Python and modern langs [was Re: gossip, Guy Steel, Lojban, Racket]
On 28 set, 19:38, Xah Lee wrote: > • “list comprehension” is a very bad jargon; thus harmful to > functional programing or programing in general. Being a bad jargon, it > encourage mis-communication, mis-understanding. I disagree: it is a quite intuitive term to describe what the expression does. > • “list comprehension” is a redundant concept in programing. The > concept is of historical interest. e.g. when people talk about the > history of computer languages. The LC can simply be filter(map(func, > list), predicate). I agree it is redundant. Like pretty much all syntax: all one needs is a way to define functions and to apply function to arguments (or assignment and pre-defined loops for imperative folks). Syntax may still be more convenient, though. Which is strange since you were an ardent syntax lover a few iterations ago. > • The special syntax of “list comprehension” as it exists in many > langs, are not necessary. It can simply be a plain function, e.g > LC(function, list, filter). I disagree. Syntax may be redundant, but it is there to be convenient. I'll quote it again: "For instance, this is far more convenient: [x+1 for x in [1,2,3,4,5] if x%2==0] than this: map(lambda x:x+1,filter(lambda x:x%2==0,[1,2,3,4,5])) but on the other hand, this is more convenient: map(inc,filter(evenp,[1,2,3,4,5])) (ignoring the lines of code for inc and evenp, of course. But as long as they are used in many parts, it *is* more convenient) In short, list comprehensions are useful syntatic expressions returning lists as long as you don't care for the short functions used in them." > «do syntax does allow for imperative commands to be issued in scheme, > just like let. It does not mean it was used in said examples nor that > do is automatically inherently imperative just because of choice of > name. imperative do -> (do (steppers ...) (final-condition? result) > malign-imperative-code-here ...)» > > i don't think your argument is forceful enough. > > It appears that by this argument you even say that “let” is not > functional. In the case of Lisps, it depends on context: let is an expression returning a value, but Lisps are not purely functional languages and you *may* use imperative statements in the body, resulting in useful side-effect computations. That's why I said do is no more imperative than let: 1) because it *is* let and 2) because Lisps *allow* imperative constructs in the body of lambdas. do is not inherently imperative in the same sense Lisp/Scheme is not inherently imperative: they allow you to do purely functional evaluation of expressions but also to tint the computations with side-effects... your choice. > So, overall, i consider your argument for “do” in Scheme lisp being > functional is weak, or trivial. It seems to be a pet peeve. It is a pet peeve in that you call `do' imperative without arguments while a few other Schemers call `do' imperative on the basis of political bickering. Nobody gives `do' a chance of the base of it being what it is: a macro transform into let. Any imperative programming you do with `do' will get the same effect as if you do the same imperative programming with let. Imperative or functional, it's up to the user, not inherently from any language construct. > You got > annoyed because i seem to have ignored it entirely. But i got annoyed > by you because you don't get the point about what i consider more > significant opinion on “list comprehension”, which you totally ignored > and kept at hacking the “do” in Scheme lisp. It's because I don't think I have much to comment on list comprehensions other than being useful syntax at times for an expression returning a list. -- http://mail.python.org/mailman/listinfo/python-list
Re: (and scheme lisp) x Python and modern langs [was Re: gossip, Guy Steel, Lojban, Racket]
On 27 set, 18:39, Xah Lee wrote: > On Sep 27, 12:11 pm, namekuseijin wrote: > > > On 27 set, 16:06, Xah Lee wrote:> 2010-09-27 > > > > > For instance, this is far more convenient: > > > > [x+1 for x in [1,2,3,4,5] if x%2==0] > > > > than this: > > > > map(lambda x:x+1,filter(lambda x:x%2==0,[1,2,3,4,5])) > > > > How about this: > > > [snip] > > > how about this: read before replying. > > hum??? > > i read your post quite carefully, and rather thought i replied well. I don't think so. You completely missed the point where I agreed about filter map being more convenient when calling predefined functions and also the detailed explanation of why do in scheme is not imperative at all. -- http://mail.python.org/mailman/listinfo/python-list
Re: (and scheme lisp) x Python and modern langs [was Re: gossip, Guy Steel, Lojban, Racket]
On 27 set, 16:06, Xah Lee wrote: > 2010-09-27 > > > For instance, this is far more convenient: > > [x+1 for x in [1,2,3,4,5] if x%2==0] > > than this: > > map(lambda x:x+1,filter(lambda x:x%2==0,[1,2,3,4,5])) > > How about this: [snip] how about this: read before replying. -- http://mail.python.org/mailman/listinfo/python-list
Re: "Strong typing vs. strong testing"
On 27 set, 05:46, TheFlyingDutchman wrote: > On Sep 27, 12:58 am, p...@informatimago.com (Pascal J. Bourguignon) > wrote: > > RG writes: > > > In article > > > <7df0eb06-9be1-4c9c-8057-e9fdb7f0b...@q16g2000prf.googlegroups.com>, > > > TheFlyingDutchman wrote: > > > >> On Sep 22, 10:26 pm, "Scott L. Burson" wrote: > > >> > This might have been mentioned here before, but I just came across it: > > >> > a > > >> > 2003 essay by Bruce Eckel on how reliable systems can get built in > > >> > dynamically-typed languages. It echoes things we've all said here, but > > >> > I think it's interesting because it describes a conversion experience: > > >> > Eckel started out in the strong-typing camp and was won over. > > > >> > https://docs.google.com/View?id=dcsvntt2_25wpjvbbhk > > > >> > -- Scott > > > >> If you are writing a function to determine the maximum of two numbers > > >> passed as arguents in a dynamic typed language, what is the normal > > >> procedure used by Eckel and others to handle someone passing in > > >> invalid values - such as a file handle for one varible and an array > > >> for the other? > > > > The normal procedure is to hit such a person over the head with a stick > > > and shout "FOO". > > > Moreover, the functions returning the maximum may be able to work on > > non-numbers, as long as they're comparable. What's more, there are > > numbers that are NOT comparable by the operator you're thinking about!. > > > So to implement your specifications, that function would have to be > > implemented for example as: > > > (defmethod lessp ((x real) (y real)) (< x y)) > > (defmethod lessp ((x complex) (y complex)) > > (or (< (real-part x) (real-part y)) > > (and (= (real-part x) (real-part y)) > > (< (imag-part x) (imag-part y) > > > (defun maximum (a b) > > (if (lessp a b) b a)) > > > And then the client of that function could very well add methods: > > > (defmethod lessp ((x symbol) (y t)) (lessp (string x) y)) > > (defmethod lessp ((x t) (y symbol)) (lessp x (string y))) > > (defmethod lessp ((x string) (y string)) (string< x y)) > > > and call: > > > (maximum 'hello "WORLD") --> "WORLD" > > > and who are you to forbid it!? > > > -- > > __Pascal Bourguignon__ > > http://www.informatimago.com/-Hide quoted text - > > > - Show quoted text - > > in C I can have a function maximum(int a, int b) that will always > work. Never blow up, and never give an invalid answer. If someone > tries to call it incorrectly it is a compile error. > In a dynamic typed language maximum(a, b) can be called with incorrect > datatypes. Even if I make it so it can handle many types as you did > above, it could still be inadvertantly called with a file handle for a > parameter or some other type not provided for. So does Eckel and > others, when they are writing their dynamically typed code advocate > just letting the function blow up or give a bogus answer, or do they > check for valid types passed? If they are checking for valid types it > would seem that any benefits gained by not specifying type are lost by > checking for type. And if they don't check for type it would seem that > their code's error handling is poor. that is a lie. Compilation only makes sure that values provided at compilation-time are of the right datatype. What happens though is that in the real world, pretty much all computation depends on user provided values at runtime. See where are we heading? this works at compilation time without warnings: int m=numbermax( 2, 6 ); this too: int a, b, m; scanf( "%d", &a ); scanf( "%d", &b ); m=numbermax( a, b ); no compiler issues, but will not work just as much as in python if user provides "foo" and "bar" for a and b... fail. What you do if you're feeling insecure and paranoid? Just what dynamically typed languages do: add runtime checks. Unit tests are great to assert those. Fact is: almost all user data from the external words comes into programs as strings. No typesystem or compiler handles this fact all that graceful... -- http://mail.python.org/mailman/listinfo/python-list
Re: reddit = porn fodder
Xah Lee escreveu: reddit = porn fodder Didn't realize, but Reddit is now a porn fodder. http://www.reddit.com/r/LegalTeens/ http://www.reddit.com/r/highheels http://www.reddit.com/r/gonewild/ Its traffic also seems to incleased 10 times since 2008. See: Computer Language Websites Popularity. From my experience, if you just add one page that is remotely related to sex, that page's traffic will eclipse your other hundred pages [snip] note that reddit was originally somewhat a site for programers, written in common lisp. guess the lesson here is that Python is more sexy than Lisp. :p -- a game sig: http://tinyurl.com/d3rxz9 --- news://freenews.netfront.net/ - complaints: n...@netfront.net --- -- http://mail.python.org/mailman/listinfo/python-list
Python shared lib
So, I was trying to get the yafaray raytracer to work with the 3D package Blender, but it asks for python2.6 and all I got is a 2.5. Actually, quite a lot of other related Blender packages are also migrating to 2.6, so a compilation was inevitable. Then I go: ./configure --prefix=~/ && make && make install and then I realize that, for whatever reason, the super popular and trendy python DOESN'T FRIGGIN BUILD SHARED LIBS BY DEFAULT! why oh why it is so popular and doesn't even think of poor software packages that might use its shared libs?... You gotta activate it with a friggin' --enable-shared, which isn't listed by --help as either yes or no as default (I assumed yes for obvious reasons)... bored and annoyed after second recompilation... hope some dev picks this minor nitpick... -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming Praxis
Phil Bewig escreveu: Please visit my blog, Programming Praxis, which presents a collection of programming etudes. Newbies will find exercises that extend their programming abilities. Savvy programmers can use the exercises to sharpen their skills or learn a new language. Brave programmers can submit their code to the review of their colleagues. Programming Praxis isn't a contest. No points are awarded, no scores are kept. The exercises simply provide an opportunity to hone your skills; the effort is its own reward. Programming Praxis is available on the web at http://programmingpraxis.wordpress.com. Come join us! It's very good, yes. :) -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance java vs. python
On May 21, 7:47 am, s...@viridian.paintbox (Sion Arrowsmith) wrote: > Duncan Booth wrote: > > >namekuseijin wrote: > >> I find it completely unimaginable that people would even think > >> suggesting the idea that Java is simpler. It's one of the most stupidly > >> verbose and cranky languages out there, to the point you can't really do > >> anything of relevance without an IDE automatically pumping out lots of > >> scaffold code for you. > >But that means Java programmers are obviously more productive than Python > >programmers: they produce many more lines of code per day even if much of > >it is boileplate or even automatically generated. Managers like that. > > >OTOH, I consider it a productive day if I end up with fewer lines of code > >than I started with. > > A friend once justified a negative LOC count as being the sign of a > good day with the following observation: > > Code that doesn't exist contains no bugs. > Code that doesn't exist takes no time to execute. > Code that doesn't exist takes up no space. > Code that doesn't exist doesn't need maintenance. Amusing tales. And very true too -- managers just love LOC and straightjacket programming environments. Here's what the father of Unix, Ken Thompson, said once about LOC: "One of my most productive days was throwing away 1000 lines of code." http://www.brainyquote.com/quotes/quotes/k/kenthompso254858.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance java vs. python
Ant escreveu: # Python fh = open("myfile.txt") for line in fh: print line // Java ... BufferedReader reader = new BufferedReader(new FileReader ("myfile.txt")); String line = reader.readLine(); while (line != null) { System.out.println(line); } ... And that's without all of the class/main method boilerplate or try catch block required due to checked exceptions. Indeed, and it's so complex and such a manual burden that you even forgot a further line = reader.readLine(); inside your while block. I find it completely unimaginable that people would even think suggesting the idea that Java is simpler. It's one of the most stupidly verbose and cranky languages out there, to the point you can't really do anything of relevance without an IDE automatically pumping out lots of scaffold code for you. -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance java vs. python
On Tue, May 19, 2009 at 7:21 PM, David Stanek wrote: > On Tue, May 19, 2009 at 5:43 PM, namekuseijin wrote: >> someone said: >>>>>> >>>>>> If you took a look at Java, you would >>>>>> notice that the core language syntax is much simpler than Python's. >> >> thanks for the laughs whoever you are! >> > > I'm no Java fan, but I do agree that the core language is a bit easier > for people to grasp. I have also heard that from other developers as > well. Really? Core language, eh? Just take a look at just the summary of the Java language spec: http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html Then compare with the summary for Python 3.0 language reference: http://docs.python.org/3.0/reference/ Like comparing a mammoth to a zebra. Besides, how is: for( int i=0; i<10; i++ ) simpler than: for i in (range(10)) ? Scripting languages like Python eventually led Java to provide a more friendly for, which they call, quite appropriately, enhacedFor. Here's it in action: for (Map.Entry e : histogram.entrySet()) in Python: for e in histogram.items() fun. Here's a more complete example, available a bit down from: http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.14.2 Map histogram = ...; double total = 0; for (int i : histogram.values()) total += i; for (Map.Entry e : histogram.entrySet()) System.out.println(e.getKey() + " " + e.getValue() / total); in Python: histogram = ... total=0 for i in histogram.values(): total+=i for e in histogram.items(): print( e[0] + " " + str( e[1]/float(total) )) yeah, surely a friggin' lot more complex... and we didn't even come to use any of Java's HUUUGE APIs, just the core lang... BTW, I'm amused that Java's string concatanating doesn't require an explicit cast from the float result. anyway, again, thanks for the laughs. -- http://mail.python.org/mailman/listinfo/python-list
Re: Performance java vs. python
someone said: If you took a look at Java, you would notice that the core language syntax is much simpler than Python's. thanks for the laughs whoever you are! -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/listinfo/python-list
Re: Nimrod programming language
On May 8, 12:48 pm, Andreas Rumpf wrote: > Dear Python-users, > > I invented a new programming language called "Nimrod" that combines Python's > readability with C's performance. Please check it out:http://force7.de/nimrod/ > Any feedback is appreciated. heh, looks more like a streamlined Object Pascal (i.e class declarations) than Python. And indeed I see that it has a nice bridge to old Object Pascal code. OTOH, Python always felt to me very close to Pascal in the choice of syntax keywords and readability. Some people of late have been comparing Python to Basic, but I guess that's only to widespread it more among the american public, where Pascal as foreign tech never quite grasped foot. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to consume .NET webservice
On May 12, 4:12 am, "Diez B. Roggisch" wrote: > namekuseijin schrieb: > > Diez B. Roggisch wrote: > >> namekuseijin schrieb: > >>> bav escreveu: > >>>> question from a python newbie; > >>>> > >>>> how can i consume in python language, a .NET web service, passing > >>>> a string array as parameter in some easy steps? > >>> > >>> Unless Microsoft extended the standard in any way, then it should > be just as you consume any web service, I guess. ;) > >> > >> Microsoft *created* the standard.. > > > > No: > > Yes: > > http://webservices.xml.com/pub/a/ws/2001/04/04/soap.html You are right, sorry. > MS created it. That it *became* a standard of the W3C later - well, they > did that with OOXML as well... OpenOfficeXML document format AKA ODF? ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: how to consume .NET webservice
Diez B. Roggisch wrote: namekuseijin schrieb: bav escreveu: question from a python newbie; how can i consume in python language, a .NET web service, passing a string array as parameter in some easy steps? Unless Microsoft extended the standard in any way, then it should be just as you consume any web service, I guess. ;) Microsoft *created* the standard.. No: http://en.wikipedia.org/wiki/Web_service It's a W3C internet standard. Microsoft is one of many software companies behind the Consortium. Here's the relevant official standards: http://www.w3.org/2002/ws/#documents -- http://mail.python.org/mailman/listinfo/python-list
Re: how to consume .NET webservice
bav escreveu: question from a python newbie; how can i consume in python language, a .NET web service, passing a string array as parameter in some easy steps? Unless Microsoft extended the standard in any way, then it should be just as you consume any web service, I guess. ;) -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm intrigued that Python has some functional constructions in the language.
On May 10, 7:18 pm, Carl Banks wrote: > On May 10, 12:40 pm, namekuseijin > wrote: > theoretical argument like, "everything reduces to a function so it > doesn't matter what syntax you use," yet people in the real world are > out there trying to find alternatives because functional languages' > syntax sucks so bad in general. It's not that it sucks. More that it's pretty much non-existent. Yes, many people are very sensitive to such issue -- that is, that they feel lost without common constructs permeating the code rather than the fluid and recursive nature of functional programming and its never-ending flow of userland function calls. OTOH, I can't help but think part of it has to do with plain text in your face rather than lots of colorful keywords in your fav editor. > The reason the OP was asking about separating pure code from impure > was to see if some subset of Python could be used as a pure functional > language, that way they could employ Python and its already-much- > better-than-Haskell's syntax as a pedagogical replacement for Haskell. ah, probably. Python has replaced Scheme in certain pedagogical circles too. Scheme was considered a great tool for teaching basic compsci concepts *precisely* for it's lack of syntax so that students could concentrate on the concepts and problems at hand rather than fight against the compiler or have to learn a huge tome of libs and frameworks before even outputting a single "hello world". But Java was all the rage in the past few years at introductory compsci and at least no doubt Python is a blessing compared to that. Though it too is not without a lot of quirks itself... > I am sure there are many people who think that even "f a b" is cryptic > compared to "f(a,b)", but if that's the only issue it wouldn't be that > big of a deal. It's not the only issue. When a language requires you > to read and write stuff like "map :: (x -> y) -> f x -> f y" This is a type annotation and there's nothing similar in Python given it's typeless nature. Should I call Python's non-existent type annotations horrible too? >"f s@ (x:xs) = x:s" then it's going to turn a lot of people off. what about @foobize def dingle( n, *boz ): return boz[n:-2] ? Sounds perfectly cryptic for the non-initiated too. -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm intrigued that Python has some functional constructions in the language.
Carl Banks wrote: On May 9, 10:57 am, namekuseijin wrote: Carl Banks wrote: On May 8, 7:19 pm, namekuseijin wrote: On May 8, 10:13 pm, Carl Banks wrote: In Haskell, Lisp and other functional programming languages, any extra syntax gets converted into the core lambda constructs. So? The user still uses that syntax, so how can you claim it doesn't matter? In Lisp languages, that syntax is merely user-defined macros, but in Haskell it's builtin the compiler for convenience. I don't even know what you're saying here I'm saying syntax is nothing special. They are user-defined, as functions. And it all gets converted into functions. Functions matter, syntax is irrelevant because you can do away with it. Nope, sorry, you're ignoring half the problem here. Syntax is only irrelevant if you actually do do away with it. As long as syntax is there and people use it, then it matters, regardless of whether it all reduces to function calls. It's handy, yes. It's just nothing special, specially when composing programs out of function composition. For a very benign example, consider the ways that Python and Haskell write listcomps: [ x for x in ss ] [ x | x <- ss ] One of these might be more readable than the other (I make no implication which); Haskell uses math notation, which may not be to everyone's tastes as far as IT has largely left its compsci and math roots and every Joe Sixpack might assembly an usable app with a scripting language, some template-writing IDE and a few frameworks. however, readability has nothing to do with whether the compiler internally reduces it to a function call or not. Readibility counts, therefore syntax matters. Function calls are perfectly readable. Now, maybe readability concerns don't matter to you personally, but it does matter to the OP, who is trying to advocate functional programming but is having difficulty because most purely functional languages have hideous minimalist syntax that turns people off. BTW, rereading it again, the OP was originally questioning about compiler optimizations for purely functional constructs within Python, but somehow syntax got in the middle. I don't see how "syntax would be a lot easier to understand" if it would "be possible to more clearly separate the pure code (without side effects) from the impure code (that deals with state changes, I/O, etc.), so that the pure code could be compiled and have aggressive functional transformations applied to it for efficiency." Syntax would remain the same, I guess. In functional programming languages, predefined syntax is mostly irrelevant. In Python and other imperative languages, it's absolutely necessary. That's my point. I think you are overstating this by a lot. Perhaps. -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm intrigued that Python has some functional constructions in the language.
Steven D'Aprano wrote: On Sat, 09 May 2009 14:57:24 -0300, namekuseijin wrote: I'm saying syntax is nothing special. They are user-defined, as functions. And it all gets converted into functions. Functions matter, syntax is irrelevant because you can do away with it. How do you call functions without syntax? By mental telepathy? By direct manipulation of the electromagnetic fields inside the CPU? That's all the syntax notation you need in functional programming languages: one to define functions, and another to call them. Any extras are sugar around the basic definition and calling forms. -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm intrigued that Python has some functional constructions in the language.
Carl Banks wrote: On May 8, 7:19 pm, namekuseijin wrote: On May 8, 10:13 pm, Carl Banks wrote: In Haskell, Lisp and other functional programming languages, any extra syntax gets converted into the core lambda constructs. So? The user still uses that syntax, so how can you claim it doesn't matter? In Lisp languages, that syntax is merely user-defined macros, but in Haskell it's builtin the compiler for convenience. I don't even know what you're saying here I'm saying syntax is nothing special. They are user-defined, as functions. And it all gets converted into functions. Functions matter, syntax is irrelevant because you can do away with it. In Haskell, point free style of programming shows almost no signs of predefined syntax at all. It's all function composition. In functional programming languages, predefined syntax is mostly irrelevant. In Python and other imperative languages, it's absolutely necessary. That's my point. -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm intrigued that Python has some functional constructions in the language.
Lawrence D'Oliveiro wrote: In message <692b7ae8-0c5b-498a- a012-51bda980f...@s28g2000vbp.googlegroups.com>, namekuseijin wrote: On May 8, 6:48 pm, Lawrence D'Oliveiro wrote: In message , namekuseijin wrote: Carl Banks escreveu: 2. However, functional programming is cryptic at some level no matter how nice you make the syntax. When your program is nothing but function definition and function application, syntax is meaningless. On the contrary, syntax is vital to the correct interpretation of functional constructs. See, for example, <http://mail.python.org/pipermail/python-list/2008-October/683816.html>. Yeah, it's important in an imperative language ... That was an example of functional programming. I noticed the use of list comprehensions. The fact that list comprehensions are only available as predefined syntax in Python is noticed too. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple programme - Just want to know whether this is correct way of coding
On May 8, 3:37 am, guptha wrote: > The code Works fine ,but I doubt about the performance issue ,My > intention is to send mails concurrently to large number of mail. > 1.For every mail id i send It creates a new SMTP object,in case, if i > send to 1000 or more ids why should I help a spammer... ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm intrigued that Python has some functional constructions in the language.
On May 8, 10:13 pm, Carl Banks wrote: > On May 8, 5:47 pm, namekuseijin wrote: > > > My point is that when all you do is call functions, syntax is > > irrelevant. You call functions pretty much in the same way regardless > > of language: functionname, optionalOpenPar, parameters, > > optionalClosePar. > > then... > > > Functional programming is all about defining functions and applying > > functions. Core ML, Haskell and Scheme are all like that, > > Yet all three use a different syntax to call functions, none of them > the "pretty much the same way" you listed above. It's still functionName arguments AFAIK. Some using parentheses around the arguments, some around all, some not using parentheses at all. > Haskell and Python have syntax for list operations, that matters. > > Haskell nexts using indentation, the others nest using tokens(**), > that matters. In Haskell, Lisp and other functional programming languages, any extra syntax gets converted into the core lambda constructs. In Lisp languages, that syntax is merely user-defined macros, but in Haskell it's builtin the compiler for convenience. > I can go on, but you get the idea. Point is: functional programmint > isn't "nothing but calling functions". Oh yes, functional programming is all about function definition and function calling. You have a point about higher order functions, but that's really only useful as far as your lambda expressions are useful -- that is, conveniently defining anonymous functions on-the-fly and immediately applying them. -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm intrigued that Python has some functional constructions in the language.
On May 8, 7:22 pm, Carl Banks wrote: > On May 8, 1:56 pm, namekuseijin wrote: > > Carl Banks escreveu: > > > 2. However, functional programming is cryptic at some level no matter > > > how nice you make the syntax. > > > When your program is nothing but function definition and function > > application, syntax is meaningless. > > For mere function application you could maybe argue that (and it'd be > a stretch), but there is no reasonable way to claim that syntax is > meaningless for defining functions. Unless you meant "function > declaration", and I think you did because you don't seem to know what > functional programming is. > > > you're just calling functions provided by > > the host, > > That's not what functional programming means, nor is it remotely > comparable to functional programming. My point is that when all you do is call functions, syntax is irrelevant. You call functions pretty much in the same way regardless of language: functionname, optionalOpenPar, parameters, optionalClosePar. Office automation is all about calling predefined functions in the host application, that's all my example was about. Functional programming is all about defining functions and applying functions. Core ML, Haskell and Scheme are all like that, pretty much an extended lambda calculus. Haskell provides a bunch of syntatic sugar, more so than Scheme for instance, but in the end, it all gets converted into lambda expressions and application of arguments to lambda expressions. Python has a bunch of handy predefined syntax, because not everything can be defined out of functions alone. Syntax is much more important here than in true functional programming languages, where pretty much everything besides basic "if" branching is a "userland" function -- including looping constructs. I have written my own list comprehensions and generators in Scheme! When you read a Haskell or Scheme program, it's truly hard to spot predefined syntax: most of it is composable function application. Once in a while you spot an "if". > > barely using any syntax or intrinsic language feature anyway. > > Any language will do just fine. > > Well, that's not true since I found it to be quite a different > experience to invoke Microsoft library functions in JScript than in > Visual Basic. (Mostly because it's a PITA even to "barely use any > syntax or intrinsic language feature" of Visual Basic.) Not quite Word, but here's in OpenOffice scripted either in BeanShell, JScript and Java: http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Scripting/Writing_Macros oDoc = context.getDocument(); xTextDoc = (XTextDocument) UnoRuntime.queryInterface (XTextDocument.class,oDoc); xText = xTextDoc.getText(); xTextRange = xText.getEnd(); xTextRange.setString( "Hello World (in BeanShell)" ); oDoc = XSCRIPTCONTEXT.getDocument(); xTextDoc = UnoRuntime.queryInterface(XTextDocument,oDoc); xText = xTextDoc.getText(); xTextRange = xText.getEnd(); xTextRange.setString( "Hello World (in JavaScript)" ); XTextDocument xtextdocument = (XTextDocument) UnoRuntime.queryInterface ( XTextDocument.class, xDocModel); XText xText = xtextdocument.getText(); XTextRange xTextRange = xText.getEnd(); xTextRange.setString( "Hello World (in Java)" ); Although this is a bad example because of the closeness of syntax between the languages, it would not be much different in a completely alien language. It would still make a call to get the data model of the current document, another to get the text, another to get the end and another to set the string. It's all function calls, really. No, it's not functional programming, but it illustrates what I said: when all you do is call functions, syntax is irrelevant. -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm intrigued that Python has some functional constructions in the language.
On May 8, 6:48 pm, Lawrence D'Oliveiro wrote: > In message , namekuseijin wrote: > > > Carl Banks escreveu: > > >> 2. However, functional programming is cryptic at some level no matter > >> how nice you make the syntax. > > > When your program is nothing but function definition and function > > application, syntax is meaningless. > > On the contrary, syntax is vital to the correct interpretation of functional > constructs. See, for example, > <http://mail.python.org/pipermail/python-list/2008-October/683816.html>. Yeah, it's important in an imperative language to have predefined syntax to allow you to do things. Point taken. -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm intrigued that Python has some functional constructions in the language.
Carl Banks escreveu: 2. However, functional programming is cryptic at some level no matter how nice you make the syntax. When your program is nothing but function definition and function application, syntax is meaningless. It's kinda like scripting, say, Microsoft Word in either Visual Basic, Python, Haskell or whatever: you're just calling functions provided by the host, barely using any syntax or intrinsic language feature anyway. Any language will do just fine. -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/listinfo/python-list
Re: I'm intrigued that Python has some functional constructions in the language.
prueba...@latinmail.com escreveu: Don't forget that the Python interpreter is simple. It makes maintenance easier and allows embedding it into other programs. Good optimizing compilers for functional languages are not simple. Good optimizing compilers are not simple, period. The python interpreter is not all that simple either. Have you ever taken a look at it? It's a good bytecode interpreter, not some dumb toy interpreter. -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/listinfo/python-list
Re: yet another list comprehension question
2009/5/5 Ricardo Aráoz : > This seems to work for any length tuples : > a = [(1,2), (3,4, 'goes'), (5,None), (6,7, 8, 'as', None), (8, None), (9, 0)] [tup for tup in a if not [e for e in tup if e == None]] > [(1, 2), (3, 4, 'goes'), (9, 0)] Why that extra "for"? KISS >>> a = [(1,2), (3,4, 'goes'), (5,None), (6,7, 8, 'as', None), (8, None), (9, >>> 0)] [(1, 2), (3, 4, 'goes'), (5, None), (6, 7, 8, 'as', None), (8, None), (9, 0)] >>> [t for t in a if None not in t] [(1, 2), (3, 4, 'goes'), (9, 0)] "in" works perfectly well for any sequence, including strings. -- http://mail.python.org/mailman/listinfo/python-list
Re: yet another list comprehension question
On May 4, 9:15 am, David Robinow wrote: > On Mon, May 4, 2009 at 2:33 AM, namekuseijin > > wrote: > >>>> ls = [(1,2), (3,4), (5, None), (6,7), (8, None)] > >>>> [(x,y) for (x,y) in ls if y] > > [(1, 2), (3, 4), (6, 7)] > > Nope. That filters out 0 as well as None. Not what the OP asked for. True. I'm still a C programmer at heart I guess. ah, the flexibility of 0... ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: yet another list comprehension question
>>> ls = [(1,2), (3,4), (5, None), (6,7), (8, None)] >>> [(x,y) for (x,y) in ls if y] [(1, 2), (3, 4), (6, 7)] -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange interaction between timeit and recursion
Recursion is unpythonic. Do not use it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Using Help inside Python
I'm from the time when I inspected python objects themselves, say: print obj.__doc__ or dir( obj ) to know the goodies... -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp mentality vs. Python mentality
Dan Sommers escreveu: Yes, I agree: Python and Lisp are extremely dynamic languages. I *can* redefine map, reduce, +, and other operators and functions, but I know better. When is the last time you examined someone else's code, and asked them what their "map" function did (in Lisp or in Python)? Interface and behaviour should be the same, of course. -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp mentality vs. Python mentality
Dan Sommers wrote: On Mon, 27 Apr 2009 07:57:00 +0300, Ciprian Dorin, Craciun wrote: I agree with your opinion about keeping the abstraction layers shallow, but in my view high-order and helper functions do not comprise a new abstraction layer. For example in Lisp, using map, reduce (fold), or any other high-order function is just like using for, or while in a normal imperative language. If I hit a call to map or to reduce, I've hit the bottom: map and reduce are defined by Lisp and not by the programmer. You truly don't know Lisp. *Everything* in Lisp can be _redefined_ and if you can't do something conveniently that way, you can use a _macro_ to implement convenient new syntax for it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp mentality vs. Python mentality
Travis wrote: I've noticed that every one of you is wrong about programming. Since I can't say it effectively, here's someone who can: http://www.youtube.com/watch?v=XHosLhPEN3k That's the answer. Hmm, perhaps it was the answer by the time that song was written? ;) cool anyway... :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp mentality vs. Python mentality
Paul Rubin wrote: namekuseijin writes: return (len(a) == len(b)) and not any(not comp(*t) for t in (zip(a, b))) plus the zip call enclosed in parentheses got turned into an iterator. zip in python 2.x always makes a list. You want itertools.izip. You could also use itertools.starmap. hmm, somehow I thought putting any sequence into parenthesis would always yield a generator... -- http://mail.python.org/mailman/listinfo/python-list
Re: python list handling and Lisp list handling
On Apr 26, 1:31 am, Steven D'Aprano wrote: > On Fri, 24 Apr 2009 21:01:10 -0700, Carl Banks wrote: > > That's because Python lists aren't lists. > > Surely you meant to say that Lisp lists aren't lists? > > It-all-depends-on-how-you-define-lists-ly y'rs, Yeah, the List Processing language got it all wrong by not going with arrays like Python... -- http://mail.python.org/mailman/listinfo/python-list
Re: python list handling and Lisp list handling
On Apr 25, 4:34 am, Michele Simionato wrote: > which has some feature you may like. For instance, > there is a weak form of pattern matching built-in: > > >>> head, *tail = [1,2,3] # Python 3.0 only! > >>> head > 1 > >>> tail > > [2, 3] Good seeing yet another long time Perl feature finally brought in. ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp mentality vs. Python mentality
Ciprian Dorin, Craciun wrote: On Sun, Apr 26, 2009 at 7:54 AM, Steven D'Aprano wrote: I liked very much your implementation for the compare function, it is very short and at the same time readable: def compare(a, b, comp=operator.eq): return (len(a) == len(b)) and all(comp(*t) for t in zip(a, b)) But I have only one problem, it is suboptimal, in the sense that: * it constructs two intermediary lists (the list comprehension and the zip call); * it evaluates all the elements, even if one is false at the beginning; This evaluates just until finding one that is false: return (len(a) == len(b)) and not any(not comp(*t) for t in (zip(a, b))) plus the zip call enclosed in parentheses got turned into an iterator. >>> def compare(a, b, comp=operator.eq): ... return (len(a) == len(b)) and not any(not comp(a,b) for (a,b) in (zip(a, b))) ... >>> compare( [1,2,3], [1,3,3] ) False >>> compare( [1,2,3], [1,2,3] ) True -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp mentality vs. Python mentality
Paul Rubin wrote: Python tries to be simple and pragmatic while not aiming for as heavy-duty applications as Common Lisp. Scheme is more of a research language that's way past its prime. If you like Scheme, you should try Haskell. Python has the motto "practicality beats purity". With Haskell, it's exactly the opposite ;-). Going from Scheme to Haskell is about the same as going from Python to Ruby: you get far more concise and obfuscated syntax and get boggled down in tons of different ways to do the same thing. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp mentality vs. Python mentality
That was amusing, but that's not a question of Lisp vs Python programmers, just one of fun vs practicality. Mark Tarver is the implementor of Qi, a higher order Lisp of sorts. He's writing a compiler from Qi to Python and was learning Python along the way. He's having fun with it, not writing it to meet a deadline. Who never reimplemented things for the sheer fun of it? The fun of writing it to top the current implementation, to learn how it works or merely as example to fellow programmers? Oh, I know who never did it: programmers who are into programming only for the paycheck and who otherwise think it's a bore. -- http://mail.python.org/mailman/listinfo/python-list
Re: Lisp mentality vs. Python mentality
Paul Rubin wrote: Carl Banks writes: Python programmer: a == b. Next question. in lisp you'd use (equal a b) I see you walk both sides. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Weird lambda behavior (bad for)
The real issue here has nothing to do with closures, lexical capture or anything like that. It's a long known issue called side-effects. Trying to program in a functional style in the presence of side-effects is bad. *for* is the main perpetrator of side-effects here, because it updates its iterating variables rather than create a new lexical environment for them. Say: >>> x Traceback (most recent call last): File "", line 1, in NameError: name 'x' is not defined >>> ps=[] >>> for x in range(3): ps.append( lambda y: x+y ) ... >>> ps [ at 0x8389a04>, at 0x8389a74>, at 0x8389c34>] >>> ps[0](1) 3 >>> ps[1](1) 3 >>> ps[2](1) 3 It also polutes the namespace by letting x live on: >>> x 2 Even list comprehensions still suffer from the updating: >>> xs=[lambda y:x+y for x in range(3)] >>> xs[0](1) 3 >>> xs[1](1) 3 >>> xs[2](1) 3 No such issue with map, which truly does it the proper functional way: >>> ys=map(lambda x: lambda y: x+y, range(3)) >>> ys[0](1) 1 >>> ys[1](1) 2 >>> ys[2](1) 3 I don't like *for* at all. It both makes it tough to get true closures and also unnecessarily pollutes the namespace with non-local variables. So, beware of the lack of true lexical bindings associated with the evil imperative *for*! :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there any way to find out the definition of a function in a file of C language?
Jebel escreveu: Hi ,everyone. I have the name of a function of C language, and have the source file which the function is defined in. And I want to find out the type and name of the parameters. If I need to analyze the file by myself, or have some way to do it more easily? ever heard of grep? ctags for vim or emacs? -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/listinfo/python-list
Re: Best way to start
Google's automatic chat logging is nice too. My first online python tutorial for someone who never saw it before (sorry for not being in english): 14/09/08 00:50 KALEL: I'm on Phyton Shell 00:52 me: cool let's go type it: 2 just to get rid of your fears... :) KALEL: Hah hah hah hah me: really 1+2 00:53 KALEL: Stupendous AND??? me: type( 1 ) type( "foobar" ) 00:54 KALEL: Good me: Python is dinamically typed, you don't declare types: a = 2 a+3 KALEL: Ok... how do I refer to the values 00:55 me: a ? KALEL: I mean, define some constant??? me: no constants, all variable. of course, there are scope rules 00:56 modules, classes and functions let's go by steps KALEL: Ok Morpheus me: type there: dir() to know what it is in the current scope KALEL: ['__builtins__', '__doc__', '__name__', 'a'] me: exact it's a list: [] 00:57 KALEL: I see me: type dir( [] ) to know the methods of a list object KALEL: Cool me: show 00:58 KALEL: Waitaminute: dir is a list, right? me: it's a function returning a list ls = dir() KALEL: OK. me: ls.sort 00:59 KALEL: Traceback (most recent call last): File "", line 1, in ls.sort NameError: name 'ls' is not defined me: you did not define it? ls = dir() 01:00 KALEL: me: yes ls.sort() forgot the parentheses to call ;) ls.index('a') 01:01 for i in dir(): print i 01:02 KALEL: stopped 01:03 me: one more ENTER BTW: blocks in python are idented by tabs KALEL: ok me: no {} or begin end wait 01:04 KALEL: wonderful 01:05 Ok, but when you have a single command, you don't need {} nor begin end 01:06 me: true, for that same reason I put print in the same line for and if end in : KALEL: 0x0 me: if foo: this else: 01:07 that not forgetting tab indenting KALEL: good me: if you get another nested if, more indenting KALEL: This is very good 01:08 The guy does not get lost me: let's define a function KALEL: And you don't need to worry about non-practical details me: def fact( n ): if n < 2: return 1 else: return n+fact(n-1) 01:10 you can, of course, write a program in a text file and import it 01:11 KALEL: good Guess I can already solve an Euler 01:12 me: say type def fact( n ): """Factorial of n""" if n < 2: return 1 else: return n*fact(n-1) into a text file and save as euler.py 01:13 notice documentation as part of a function 01:14 KALEL: Just did it. Opened a python instance 01:15 me: still open? KALEL: Yes me: so, type this euler.fact( 5 ) 01:16 KALEL: FAIL me: what? KALEL: typed on the shell and didnt recongnize me: import euler now should go euler.fact(5) 01:22 KALEL: Now it works! me: I forgot the import, no? :P hahahaha KALEL: yep me: sorry KALEL: Will get more coffee me: huhauhua, javaman 01:24 KALEL: Got coke me: good KALEL: while is in the same vein??? 01:26 me: i = 1 while i<10: ... print i ... i += 1 without the dots, sure 01:30 KALEL: any mod function?? 01:32 me: % 3%2 KALEL: Yes, thanks... I looked up on help 01:33 Any easy way to sum var to itself + new result??? say: sp = sp + p1 01:34 me: sp += 3 KALEL: sp +=p1 That? me: yep KALEL: Awesome. 01:35 me: converting a previous problem to Python? :) KALEL: No... Solving the second one me: ok 01:39 KALEL: how to end while??? indenting??? I mean, how do I close the block? 01:40 Forget me: ident all commands inside while ok ending it is newline, plainly 01:43 KALEL: finally Very good Phyton GOT IT!! me: way to go very easy, ain't it? 01:44 nothing like removing away everything non-essential KALEL: while sp<=400: p1=p1+p2 if p1%2 == 0: sp += p1 p2=p2+p1 if p2%2 == 0: sp += p2 me: hehe KALEL: of course, defining p1 = 2 p1 = 1 and p2 = 2 me: I was worried you would use = to compare KALEL: sp = 2 me: exactly KALEL: a bug 01:45 me: you don't even need a fib function KALEL: Then I remembered = was used for attribution me: hehe common mistake among Pascal programmers KALEL: COOL me: not even in need for OO too! :O haha 01:46 KALEL: too much... Used OOPS!! me: OOPS? KALEL: OOPS 01:47 you try, if it fails: OOPS! 01:50 KALEL: Thank you. I'll continue studying... you wait for me... now the force if with me too. me: we're right here huhauhuha 01:51 nice, young Padawan 01:52 KALEL: Thanks, Jedi Master 01:55 me: BTW, my solution will make you go nuts: def p2(): print "Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed 4 million." sum = 0 fib = 2 pfib = 1 while (fib<400): if fib%2==0: sum+=fib fib, pfib = fib+pfib,fib return sum 01:56 check out the excellent variables swap near the last line... :) 01:57 KALEL: AWESOME! me: yeah, no need for intermediary temp variables 01:58 I see you have a strange gleaming in the eyes, young disciple :) 01:59 KALEL: huah huah huah 02:01 me: you may also reload a module after each change reload( euler ) -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/list
Re: Best way to start
Avi escreveu: A BIG Thanks to Chris and Andrew for suggestions. This is an awesome place. namekuseijin: haha...got a friend hooked to Python on chat? hilarious! True story. But he was already a programmer. Only Pascal Delphi though. -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/listinfo/python-list
Re: Best way to start
I was able to get a friend into Python over a Google Chat. I pointed him to the downloads page, waited for him to install, then covered the basics in quite a few steps (syntax, conditionals, loops, function definition and application, classes and methods, lists, dicts and comprehensions). He loved the language and used it to solve some problems in the Euler Project. :) -- a game sig: http://tinyurl.com/d3rxz9 -- http://mail.python.org/mailman/listinfo/python-list
Re: Commercial Products in Python
On 21 out, 15:59, "Sebastian Bassi" <[EMAIL PROTECTED]> wrote: > On Tue, Oct 21, 2008 at 2:50 PM, Paulo J. Matos <[EMAIL PROTECTED]> wrote: > > > I was just wondering, if you wish to commercialize an application > > developed in Python, what's the way to go? > > You choose the conditions. Nothing in Python license prevents you of > selling your work. > > > I guess the only way is to sell the source, right? > > No > > > This is because (and tell me if I am wrong): > > 1) You can't sell an executable because Python doesn't compile to native > > code (the usual approach, afaik); > > There are py2exe utilities to compile Python applications. I believe those actually just package the bytecode together with a specific interpreter in a single executable. -- http://mail.python.org/mailman/listinfo/python-list
Re: What is not objects in Python?
On 28 set, 15:29, process <[EMAIL PROTECTED]> wrote: > I have heard some criticism about Python, that it is not fully object- > oriented. So what? > Why isn't len implemented as a str.len and list.len method instead of > a len(list) function? Because postfix notation sucks. The natural way of spelling is adjective+noun and verb+predicate. That's one of the reasons I like Lisp better than Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: PYTHON WORKING WITH PERL ??
On 29 set, 14:16, "Blubaugh, David A." <[EMAIL PROTECTED]> wrote: > To All, > > I was wondering if it was possible to have a situation where a > programming project would utilized BOTH python and perl? Such as > utilizing python for internet programming and then utilize perl for text > processing and systems programming? Is this even feasible??? Python + Perl is called Ruby. ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: python syntax for conditional is unfortunate
On 23 set, 22:50, Neal Becker <[EMAIL PROTECTED]> wrote: > I find I'm often tripped up by: > > x = Y (lots of constructor arguments) if something ... > > on first glance, I don't notice the if. Nobody does. This peculiar syntax has much better usage in short expressions. dothis if this else dothat -- http://mail.python.org/mailman/listinfo/python-list
Re: python syntax for conditional is unfortunate
On 23 set, 20:52, Neal Becker <[EMAIL PROTECTED]> wrote: > In hindsight, I am disappointed with the choice of conditional syntax. I > know it's too late to change. The problem is > > y = some thing or other if x else something_else > > When scanning this my eye tends to see the first phrase and only later notice > that it's conditioned on x (or maybe not notice at all!). Particularly if > 'some thing or other' is long or complicated. Yes, infix syntax sucks. No ambiguities in prefixed Lisp: (if x (or something other) something_else) Anyway, pretty amusing seeing Guido nodding to Larry... ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
On Sep 23, 10:57 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > AFAICT, _everybody_ is bad at programming C++. Thankfully, at least Numpy developers are not bad at C programming. -- http://mail.python.org/mailman/listinfo/python-list
Re: Linq to Python
On Sep 23, 2:07 pm, Jason Scheirer <[EMAIL PROTECTED]> wrote: > On Sep 23, 7:48 am, hrishy <[EMAIL PROTECTED]> wrote: > > > Hi > > > Will LINQ be ported to Python ? > > > regards > > Hrishy > > I think this question is more appropriate to ask on an IronPython > development list -- LINQ is pretty solidly intertwined with .Net, and > so you'll likely want to look at the .Net implementation of Python. But surely the idea behind it will eventually spread. It's really just comprehensions generalized over XML and relational datasets, a noble goal. Besides, it's main purpose for .NET was to bring functional programming to it. Python already has that, somewhat... -- http://mail.python.org/mailman/listinfo/python-list