Re: Python is readable

2012-03-14 Thread Arnaud Delobelle
On 14 March 2012 23:34, Kiuhnm wrote: > I've just started to read >  The Quick Python Book (2nd ed.) > The author claims that Python code is more readable than Perl code and > provides this example: > > --- Perl --- > sub pairwise_sum { >    my($arg1, $arg2) = @_; >    my(@result) = (); >    @list

Re: Python is readable

2012-03-14 Thread Chris Angelico
On Thu, Mar 15, 2012 at 10:54 AM, Arnaud Delobelle wrote: > I don't know this book and there may be a pedagogical reason for the > implementation you quote, but pairwise_sum is probably better > implemented in Python 3.X as: > > def pairwise_sum(list1, list2): >    return [x1 + x2 for x1, x2 in zi

Re: Python is readable

2012-03-14 Thread Rick Johnson
On Mar 14, 7:27 pm, Chris Angelico wrote: > Okay, here's something for debate. > > Should the readability of a language be gauged on the basis of its > standard library, or should you be comparing actual code? I think the library matters greatly. Yes, one could argue that the same functionality "

Re: Python is readable

2012-03-14 Thread alex23
Rick Johnson wrote: > However, when we are talking about the Python > programming language "readable" simply means: "neophyte readable". > That is, "readable to someone with little or no experience with the > language". Nonsense. List comprehensions are not immediately obvious to new Python users

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 7:23, alex23 wrote: Rick Johnson wrote: However, when we are talking about the Python programming language "readable" simply means: "neophyte readable". That is, "readable to someone with little or no experience with the language". Nonsense. List comprehensions are not immediatel

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Thu, Mar 15, 2012 at 9:44 PM, Kiuhnm wrote: > Let's try that. > Show me an example of "list comprehensions" and "with" (whatever they are). I'll do a list comp, because they lend themselves well to one-liners. what_am_i = '\n'.join(["%X\t%c"%(i,i) for i in range(128)]) Okay, that one also use

Re: Python is readable

2012-03-15 Thread Thomas Rachel
Am 15.03.2012 11:44 schrieb Kiuhnm: Let's try that. Show me an example of "list comprehensions" and "with" (whatever they are). with open("filename", "w") as f: f.write(stuff) with lock: do_something_exclusively() Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 11:50, Chris Angelico wrote: On Thu, Mar 15, 2012 at 9:44 PM, Kiuhnm wrote: Let's try that. Show me an example of "list comprehensions" and "with" (whatever they are). I'll do a list comp, because they lend themselves well to one-liners. what_am_i = '\n'.join(["%X\t%c"%(i,i) for

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Thu, Mar 15, 2012 at 10:27 PM, Kiuhnm wrote: > On 3/15/2012 11:50, Chris Angelico wrote: >> I'll do a list comp, because they lend themselves well to one-liners. >> what_am_i = '\n'.join(["%X\t%c"%(i,i) for i in range(128)]) > > > A few conjectures: > 1) '\n' is an object and join one of its me

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 12:14, Thomas Rachel wrote: Am 15.03.2012 11:44 schrieb Kiuhnm: Let's try that. Show me an example of "list comprehensions" and "with" (whatever they are). with open("filename", "w") as f: f.write(stuff) Here f is created before executing the block and destroyed right after

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 12:47, Chris Angelico wrote: On Thu, Mar 15, 2012 at 10:27 PM, Kiuhnm Your first example suggests that range(n) is a sequence iterator which returns, if queried n times, 0,...,n-1 (which is a bit counterintuitive, IMHO). It's a little odd, perhaps, if seen in a vacuum. But every

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Thu, Mar 15, 2012 at 10:59 PM, Kiuhnm wrote: > On 3/15/2012 12:47, Chris Angelico wrote: >> It's a little odd, perhaps, if seen in a vacuum. But everything counts >> from zero - list indices, etc - so it makes sense for range(len(lst)) >> to return indices valid for lst. > > Maybe range uses [.

Re: Python is readable

2012-03-15 Thread Ben Finney
Chris Angelico writes: > Yup. It's amazing how accurate your conjectures are - it's almost like > you've been reading the docs! :D But yeah, that's pretty logical IMHO; > and having gotten used to [) intervals in many areas of computing, > I've come to find [] intervals disconcerting. Bible passa

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Thu, Mar 15, 2012 at 11:31 PM, Ben Finney wrote: > Another good reason to advocate for proper typography. "John 14:5-7" > indicates a range (because it uses U+2013 EN DASH), whereas "7-5" > indicates subtraction (because it uses U+2212 MINUS SIGN). A hyphen ('-' > U+002D) is inappropriate in ei

Re: Python is readable

2012-03-15 Thread Ben Finney
Chris Angelico writes: > On Thu, Mar 15, 2012 at 11:31 PM, Ben Finney > wrote: > > Another good reason to advocate for proper typography. "John 14:5-7" > > indicates a range (because it uses U+2013 EN DASH), whereas "7-5" > > indicates subtraction (because it uses U+2212 MINUS SIGN). A hyphen >

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Fri, Mar 16, 2012 at 12:16 AM, Ben Finney wrote: > Chris Angelico writes: > >> On Thu, Mar 15, 2012 at 11:31 PM, Ben Finney >> wrote: >> > Another good reason to advocate for proper typography. "John 14:5-7" >> > indicates a range (because it uses U+2013 EN DASH), whereas "7-5" >> > indicate

Re: Python is readable

2012-03-15 Thread Ben Finney
Chris Angelico writes: > On Fri, Mar 16, 2012 at 12:16 AM, Ben Finney > wrote: > > Hopefully, the fact that your quoting of my text munged the > > characters down to ASCII is also pure coincidence, and is soon to be > > corrected at your end? Or has your client program not joined the > > rest o

Re: Python is readable

2012-03-15 Thread Mark Lawrence
On 15/03/2012 11:48, Kiuhnm wrote: On 3/15/2012 12:14, Thomas Rachel wrote: Am 15.03.2012 11:44 schrieb Kiuhnm: Let's try that. Show me an example of "list comprehensions" and "with" (whatever they are). with open("filename", "w") as f: f.write(stuff) Here f is created before executing the

Re: Python is readable

2012-03-15 Thread Alec Taylor
On Fri, Mar 16, 2012 at 1:06 AM, Mark Lawrence wrote: > Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > with open("filename", "w") as f >  File "", line 1 > >    with open("filename

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 13:21, Chris Angelico wrote: On Thu, Mar 15, 2012 at 10:59 PM, Kiuhnm wrote: On 3/15/2012 12:47, Chris Angelico wrote: It's a little odd, perhaps, if seen in a vacuum. But everything counts from zero - list indices, etc - so it makes sense for range(len(lst)) to return indices va

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 15:06, Mark Lawrence wrote: On 15/03/2012 11:48, Kiuhnm wrote: On 3/15/2012 12:14, Thomas Rachel wrote: Am 15.03.2012 11:44 schrieb Kiuhnm: Let's try that. Show me an example of "list comprehensions" and "with" (whatever they are). with open("filename", "w") as f: f.write(stuff

Re: Python is readable

2012-03-15 Thread Tim Golden
On 15/03/2012 14:19, Kiuhnm wrote: On 3/15/2012 15:06, Mark Lawrence wrote: On 15/03/2012 11:48, Kiuhnm wrote: BTW, aren't those ':' redundant? Kiuhnm Nope. Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" fo

Re: Python is readable

2012-03-15 Thread Duncan Booth
Kiuhnm wrote: > BTW, aren't those ':' redundant? > They are required by the grammar, but in a sense you are correct. You could modify Python's grammar to make the colons optional and still keep it unambiguous but that would make it harder for other tools (such as text editors or indeed human

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Fri, Mar 16, 2012 at 1:16 AM, Kiuhnm wrote: > Don't worry. Soon you'll be using C++0x :))) I use gcc/g++ with most of the new features enabled. There's some pretty handy features in it. Frankly, though, if I'd known about Cython when I started the current project, I would have argued to write

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 15:23, Duncan Booth wrote: Kiuhnm wrote: BTW, aren't those ':' redundant? They are required by the grammar, but in a sense you are correct. You could modify Python's grammar to make the colons optional and still keep it unambiguous but that would make it harder for other tools

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 15:29, Chris Angelico wrote: On Fri, Mar 16, 2012 at 1:16 AM, Kiuhnm wrote: Don't worry. Soon you'll be using C++0x :))) I use gcc/g++ with most of the new features enabled. There's some pretty handy features in it. Frankly, though, if I'd known about Cython when I started the c

Re: Python is readable

2012-03-15 Thread Robert Kern
On 3/15/12 2:30 PM, Kiuhnm wrote: On 3/15/2012 15:23, Duncan Booth wrote: Kiuhnm wrote: BTW, aren't those ':' redundant? They are required by the grammar, but in a sense you are correct. You could modify Python's grammar to make the colons optional and still keep it unambiguous but that wou

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Fri, Mar 16, 2012 at 1:30 AM, Kiuhnm wrote: > Sorry, but I can't see how it would make it harder for humans to understand. > Are there particular situations you're referring to? In a trivial example, it's mostly just noise: if a == b# who needs the colon? print(c) But when your condi

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 15:28, Tim Golden wrote: On 15/03/2012 14:19, Kiuhnm wrote: On 3/15/2012 15:06, Mark Lawrence wrote: On 15/03/2012 11:48, Kiuhnm wrote: BTW, aren't those ':' redundant? Kiuhnm Nope. Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 Type "help",

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Fri, Mar 16, 2012 at 1:55 AM, Kiuhnm wrote: > By the way, the more elaborate parsing consists of looking for an > END_OF_LINE followed by one or more spaces. It doesn't sound that > complicated. Only in the trivial case. What if you want to break your condition over multiple lines? (Although y

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 15:48, Chris Angelico wrote: On Fri, Mar 16, 2012 at 1:30 AM, Kiuhnm wrote: Sorry, but I can't see how it would make it harder for humans to understand. Are there particular situations you're referring to? In a trivial example, it's mostly just noise: if a == b# who needs t

Re: Python is readable

2012-03-15 Thread Robert Kern
On 3/15/12 2:55 PM, Kiuhnm wrote: On 3/15/2012 15:28, Tim Golden wrote: http://docs.python.org/faq/design.html#why-are-colons-required-for-the-if-while-def-class-statements The second one is slightly easier to read because it's syntax-highlighted. Was that on purpose? No, it's an unintende

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Fri, Mar 16, 2012 at 2:05 AM, Kiuhnm wrote: > I had thought about the single-line case. What I hadn't thought about is > that Python strives to be as regular as possible, so having different cases > just for saving one keystroke isn't worth it. Yep. Have you read the Zen of Python? >>> import

Re: Python is readable

2012-03-15 Thread Roy Smith
In article , Chris Angelico wrote: > I use gcc/g++ with most of the new features enabled. There's some > pretty handy features in it. Frankly, though, if I'd known about > Cython when I started the current project, I would have argued to > write it all in Python and Cify (is that a word?) the mo

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 15:43, Robert Kern wrote: On 3/15/12 2:30 PM, Kiuhnm wrote: On 3/15/2012 15:23, Duncan Booth wrote: Kiuhnm wrote: BTW, aren't those ':' redundant? They are required by the grammar, but in a sense you are correct. You could modify Python's grammar to make the colons optional an

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Fri, Mar 16, 2012 at 2:14 AM, Roy Smith wrote: > While it's nice to know that we've got the ability to write extensions > in C, not once have we ever felt the need.  I suppose if you're running > a CPU-bound application, that might not be the case, but surprisingly > few applications really are

Re: Python is readable

2012-03-15 Thread Roy Smith
In article , Chris Angelico wrote: > "We're talking about a file that someone's uploaded to us, so it > won't matter". Whatever processing we do is massively dwarfed by > network time, and both scale linearly with the size of the file. That last part (both scaling linearly) may not be true.

Re: Python is readable

2012-03-15 Thread Thomas Rachel
Am 15.03.2012 12:48 schrieb Kiuhnm: On 3/15/2012 12:14, Thomas Rachel wrote: Am 15.03.2012 11:44 schrieb Kiuhnm: Let's try that. Show me an example of "list comprehensions" and "with" (whatever they are). with open("filename", "w") as f: f.write(stuff) Here f is created before executing th

Re: Python is readable

2012-03-15 Thread Alec Taylor
On Fri, Mar 16, 2012 at 1:16 AM, Kiuhnm wrote: > On 3/15/2012 13:21, Chris Angelico wrote: >> >> On Thu, Mar 15, 2012 at 10:59 PM, Kiuhnm >>  wrote: >>> >>> On 3/15/2012 12:47, Chris Angelico wrote: It's a little odd, perhaps, if seen in a vacuum. But everything counts from zero -

Re: Python is readable

2012-03-15 Thread Mark Lawrence
On 15/03/2012 16:01, Alec Taylor wrote: C++0x? You mean C++11? :P On that note, is Python upgrading to use C11? :V Not for Windows given http://mail.python.org/pipermail/python-dev/2012-February/116258.html. I've no idea regarding *nix, os x or whatever. -- Cheers. Mark Lawrence. -- htt

Re: Python is readable

2012-03-15 Thread Devin Jeanpierre
On Wed, Mar 14, 2012 at 8:27 PM, Chris Angelico wrote: > On Thu, Mar 15, 2012 at 10:54 AM, Arnaud Delobelle wrote: >> I don't know this book and there may be a pedagogical reason for the >> implementation you quote, but pairwise_sum is probably better >> implemented in Python 3.X as: >> >> def pa

RE: Python is readable

2012-03-15 Thread Prasad, Ramit
> > > Hopefully, the fact that your quoting of my text munged the > > > characters down to ASCII is also pure coincidence, and is soon to be > > > corrected at your end? Or has your client program not joined the > > > rest of us in the third millennium with Unicode? Outlook showed the EN DASH but

Re: Python is readable

2012-03-15 Thread Serhiy Storchaka
15.03.12 16:19, Kiuhnm написав(ла): > Ok, so they're mandatory, but I was mainly talking of design. Why are they > needed? http://python-history.blogspot.com/2011/07/karin-dewar-indentation-and-colon.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 16:08, Chris Angelico wrote: On Fri, Mar 16, 2012 at 1:55 AM, Kiuhnm wrote: By the way, the more elaborate parsing consists of looking for an END_OF_LINE followed by one or more spaces. It doesn't sound that complicated. Only in the trivial case. What if you want to break your c

Re: Python is readable

2012-03-15 Thread Arnaud Delobelle
On 15 March 2012 00:27, Chris Angelico wrote: > On Thu, Mar 15, 2012 at 10:54 AM, Arnaud Delobelle wrote: >> I don't know this book and there may be a pedagogical reason for the >> implementation you quote, but pairwise_sum is probably better >> implemented in Python 3.X as: >> >> def pairwise_su

Re: Python is readable

2012-03-15 Thread Michael Torrie
On 03/15/2012 01:40 PM, Kiuhnm wrote: > Moreover, I think that >if ( > >): > > > > is not very readable anyway. Sure but neither is if ( \ \

Re: Python is readable

2012-03-15 Thread Michael Torrie
On 03/15/2012 09:18 AM, Kiuhnm wrote: > > After early user testing without the colon, it was discovered that > the meaning of the indentation was unclear to beginners being taught the > first steps of programming. < > > The addition of the colon clarified it significantly: the colon some

Re: Python is readable

2012-03-15 Thread Ben Finney
Kiuhnm writes: > Moreover, I think that > if ( > > ): > > > > is not very readable anyway. I agree, and am glad PEP 8 has been updated to recommend an extra level of indentation for contin

Re: Python is readable

2012-03-15 Thread Arnaud Delobelle
On 15 March 2012 22:35, Ben Finney wrote: > Kiuhnm writes: > >> Moreover, I think that >>   if ( >>       >>       ): >>       >>       >>       >> is not very readable anyway. > > I agree, and am glad PEP 8 has been upda

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/15/2012 23:17, Michael Torrie wrote: On 03/15/2012 09:18 AM, Kiuhnm wrote: > After early user testing without the colon, it was discovered that the meaning of the indentation was unclear to beginners being taught the first steps of programming.< The addition of the colon clarified

Re: Python is readable

2012-03-15 Thread Kiuhnm
On 3/16/2012 0:00, Arnaud Delobelle wrote: On 15 March 2012 22:35, Ben Finney wrote: Kiuhnm writes: Moreover, I think that if ( ): is not very readable anyway. I agree, and am

Re: Python is readable

2012-03-15 Thread Steven D'Aprano
On Fri, 16 Mar 2012 01:48:09 +1100, Chris Angelico wrote: > On Fri, Mar 16, 2012 at 1:30 AM, Kiuhnm > wrote: >> Sorry, but I can't see how it would make it harder for humans to >> understand. Are there particular situations you're referring to? > > In a trivial example, it's mostly just noise: >

Re: Python is readable

2012-03-15 Thread Ben Finney
Arnaud Delobelle writes: > On 15 March 2012 22:35, Ben Finney wrote: > > I agree, and am glad PEP 8 has been updated to recommend an extra > > level of indentation for continuation, to distinguish from the new > > block that follows > > http://www.python.org/dev/peps/pep-0008/#indentation>. > >

Re: Python is readable

2012-03-15 Thread Mark Lawrence
On 15/03/2012 23:46, Kiuhnm wrote: On 3/16/2012 0:00, Arnaud Delobelle wrote: On 15 March 2012 22:35, Ben Finney wrote: Kiuhnm writes: Moreover, I think that if ( ): is not very readable anyway. I agree, and am glad

Re: Python is readable

2012-03-15 Thread Steven D'Aprano
On Fri, 16 Mar 2012 00:46:35 +0100, Kiuhnm wrote: > On 3/16/2012 0:00, Arnaud Delobelle wrote: >> On 15 March 2012 22:35, Ben Finney wrote: >>> Kiuhnm writes: >>> Moreover, I think that if ( ): >>>

Re: Python is readable

2012-03-15 Thread Steven D'Aprano
On Thu, 15 Mar 2012 00:34:47 +0100, Kiuhnm wrote: > I've just started to read >The Quick Python Book (2nd ed.) Is this the one? http://manning.com/ceder/ > The author claims that Python code is more readable than Perl code and > provides this example: > > --- Perl --- > sub pairwise_sum {

Re: Python is readable

2012-03-15 Thread Steven D'Aprano
On Thu, 15 Mar 2012 20:54:30 +, Arnaud Delobelle wrote: > On 15 March 2012 00:27, Chris Angelico wrote: >> On Thu, Mar 15, 2012 at 10:54 AM, Arnaud Delobelle >> wrote: >>> I don't know this book and there may be a pedagogical reason for the >>> implementation you quote, but pairwise_sum is p

Re: Python is readable

2012-03-15 Thread Mark Lawrence
On 16/03/2012 01:53, Steven D'Aprano wrote: On Thu, 15 Mar 2012 00:34:47 +0100, Kiuhnm wrote: I've just started to read The Quick Python Book (2nd ed.) Is this the one? http://manning.com/ceder/ The author claims that Python code is more readable than Perl code and provides this examp

Re: Python is readable

2012-03-15 Thread Chris Angelico
On Fri, Mar 16, 2012 at 10:52 AM, Steven D'Aprano wrote: > On Fri, 16 Mar 2012 01:48:09 +1100, Chris Angelico wrote: > >> In a trivial example, it's mostly just noise: >> >> if a == b    # who needs the colon? >>     print(c) > > The reader, for the same reason that above you wrote: > > "In a triv

Re: Python is readable

2012-03-15 Thread Steven D'Aprano
On Fri, 16 Mar 2012 00:32:52 +0100, Kiuhnm wrote: > Pick up two math books about the same topic but on two different levels > (e.g. under-graduated and graduated). If you compare the proofs you'll > see that those in the higher-level book are almost always sketched. Why > is that? Because they're

Re: Python is readable

2012-03-16 Thread Duncan Booth
Thomas Rachel wrote: >> Or, more likely, lock creates an object which keeps the lock "acquired". >> The lock is released when we leave the block. >> So we could inspect the lock with >> with lock as l: >> inspect l... >> do_some. > > Or just inspect l - I don't know if a lock's __enter__ met

Re: Python is readable

2012-03-16 Thread Kiuhnm
On 3/16/2012 0:58, Mark Lawrence wrote: On 15/03/2012 23:46, Kiuhnm wrote: On 3/16/2012 0:00, Arnaud Delobelle wrote: On 15 March 2012 22:35, Ben Finney wrote: Kiuhnm writes: Moreover, I think that if ( ): is not ver

Re: Python is readable

2012-03-16 Thread Kiuhnm
On 3/16/2012 4:55, Steven D'Aprano wrote: On Fri, 16 Mar 2012 00:32:52 +0100, Kiuhnm wrote: Pick up two math books about the same topic but on two different levels (e.g. under-graduated and graduated). If you compare the proofs you'll see that those in the higher-level book are almost always sk

Re: Python is readable

2012-03-16 Thread Kiuhnm
On 3/16/2012 0:52, Steven D'Aprano wrote: On Fri, Mar 16, 2012 at 1:30 AM, Kiuhnm wrote: Sorry, but I can't see how it would make it harder for humans to understand. Are there particular situations you're referring to? In a trivial example, it's mostly just noise: if a == b# who needs t

Re: Python is readable

2012-03-16 Thread Neil Cerutti
On 2012-03-16, Kiuhnm wrote: > As you can see, I'm not an English native speaker, but I think > I know a few things about punctuation. We second language > learners remember all the wrong things :( English's punctuation rules have to be a lot easier to remember than the seemingly random way in wh

Re: Python is readable

2012-03-16 Thread Kiuhnm
On 3/16/2012 2:53, Steven D'Aprano wrote: On Thu, 15 Mar 2012 00:34:47 +0100, Kiuhnm wrote: I've just started to read The Quick Python Book (2nd ed.) Is this the one? http://manning.com/ceder/ The author claims that Python code is more readable than Perl code and provides this example

Re: Python is readable

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 13:36:25 +0100, Kiuhnm wrote: > On 3/16/2012 0:52, Steven D'Aprano wrote: >> It is *remarkable* how people take the colon for granted. It is so >> simple and so obvious that they use it in their own writing often >> without thinking about it, but because it is not strictly nec

Re: Python is readable

2012-03-16 Thread Neil Cerutti
On 2012-03-16, Steven D'Aprano wrote: > A grammarian might very well write: > > Your assignment, if you choose to accept it, is to: > > 1. Take the bus to Swansea. > ... > > In English, one typical use for colons is to introduce a list > or sequence of items, including instructions. A sequence of

Re: Python is readable

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 13:55:06 +0100, Kiuhnm wrote: >> I don't understand the reason for $arg1 and $arg2. Is there some reason >> why the code couldn't do this instead? >> >> my(@list1, @list2) = @_; > > @_ contains references to arrays. You can't pass two arrays to a > function. Why eve

Re: Python is readable

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 13:08:49 +, Neil Cerutti wrote: > On 2012-03-16, Steven D'Aprano > wrote: >> A grammarian might very well write: >> >> Your assignment, if you choose to accept it, is to: >> >> 1. Take the bus to Swansea. >> ... >> >> In English, one typical use for colons is to introduce

Re: Python is readable

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 13:10:12 +0100, Kiuhnm wrote: > Maybe we should define *exactly* what readability is (in less then 500 > lines, if possible). If you can't be bothered to read my post before replying, save yourself some more time and don't bother to reply at all. I quote from the part of the

Re: Python is readable

2012-03-16 Thread Kiuhnm
On 3/16/2012 17:25, Steven D'Aprano wrote: On Fri, 16 Mar 2012 13:55:06 +0100, Kiuhnm wrote: I don't understand the reason for $arg1 and $arg2. Is there some reason why the code couldn't do this instead? my(@list1, @list2) = @_; @_ contains references to arrays. You can't pass two

RE: Python is readable

2012-03-16 Thread Prasad, Ramit
> >> I don't understand the reason for $arg1 and $arg2. Is there some reason > >> why the code couldn't do this instead? > >> > >> my(@list1, @list2) = @_; > > > > @_ contains references to arrays. You can't pass two arrays to a > > function. > > > Why ever not? That seems like basic func

Re: Python is readable

2012-03-16 Thread Neil Cerutti
On 2012-03-16, Steven D'Aprano wrote: > Ah, perhaps you're talking about *prescriptivist* grammarians, > who insist on applying grammatical rules that exist only in > their own fevered imagination. Sorry, I was talking about the > other sort, the ones who apply the grammatical rules used by > peop

Re: Python is readable

2012-03-16 Thread Steven D'Aprano
On Fri, 16 Mar 2012 17:53:24 +, Neil Cerutti wrote: > On 2012-03-16, Steven D'Aprano > wrote: >> Ah, perhaps you're talking about *prescriptivist* grammarians, who >> insist on applying grammatical rules that exist only in their own >> fevered imagination. Sorry, I was talking about the other

Re: Python is readable

2012-03-16 Thread Neil Cerutti
On 2012-03-16, Steven D'Aprano wrote: > On Fri, 16 Mar 2012 17:53:24 +, Neil Cerutti wrote: > >> On 2012-03-16, Steven D'Aprano >> wrote: >>> Ah, perhaps you're talking about *prescriptivist* grammarians, who >>> insist on applying grammatical rules that exist only in their own >>> fevered im

Re: Python is readable

2012-03-16 Thread Mel Wilson
Steven D'Aprano wrote: > On Fri, 16 Mar 2012 17:53:24 +, Neil Cerutti wrote: > >> On 2012-03-16, Steven D'Aprano >> wrote: >>> Ah, perhaps you're talking about *prescriptivist* grammarians, who >>> insist on applying grammatical rules that exist only in their own >>> fevered imagination. Sor

RE: Python is readable

2012-03-16 Thread Prasad, Ramit
> People spell your name Stephen, sometimes too. Thinking of changing it? > Gore Vidal's quote has panache, a valid compensation for breaking the usual rule. How many other uses on that page are similar? He provided common examples and reference links. Seems like a pretty reasonable way of tryin

Re: Python is readable

2012-03-16 Thread Ethan Furman
Neil Cerutti wrote: On 2012-03-16, Steven D'Aprano wrote: Ah, perhaps you're talking about *prescriptivist* grammarians, who insist on applying grammatical rules that exist only in their own fevered imagination. Sorry, I was talking about the other sort, the ones who apply the grammatical rules

Re: Python is readable

2012-03-16 Thread Chris Angelico
On Sat, Mar 17, 2012 at 7:30 AM, Ethan Furman wrote: > Neil Cerutti wrote: >> >> I am not pedantic. You are wrong. >> > > When saying somebody is wrong, you really should back it up with references > (wiki, dictionary, etc.). I interpret this simply as a witty statement, one that can be thrown in

Re: Python is readable

2012-03-16 Thread Michael Torrie
On 03/16/2012 10:48 AM, Steven D'Aprano wrote: > On Fri, 16 Mar 2012 13:10:12 +0100, Kiuhnm wrote: > >> Maybe we should define *exactly* what readability is (in less then 500 >> lines, if possible). > > If you can't be bothered to read my post before replying, save yourself > some more time and

Re: Python is readable

2012-03-16 Thread Terry Reedy
On 3/16/2012 9:08 AM, Neil Cerutti wrote: A grammarian always uses complete sentence before a colon, even when introducing a list. The Chicago Manual of Style*, 13th edition, says "The colon is used to mark a discontinuity of grammatical construction greater than that indicated by the semico

Re: Python is readable

2012-03-17 Thread Kiuhnm
On 3/16/2012 17:48, Steven D'Aprano wrote: On Fri, 16 Mar 2012 13:10:12 +0100, Kiuhnm wrote: Maybe we should define *exactly* what readability is (in less then 500 lines, if possible). If you can't be bothered to read my post before replying, save yourself some more time and don't bother to r

Re: Python is readable

2012-03-17 Thread Kiuhnm
On 3/16/2012 14:03, Steven D'Aprano wrote: A one line routine is still a routine. There is nothing ungrammatical about "If you can: take the bus.", although it is non-idiomatic English. In another post you wrote "Sorry, I was talking about the other sort, the ones who apply the grammatical rule

Re: Python is readable

2012-03-17 Thread Kiuhnm
On 3/16/2012 21:04, Prasad, Ramit wrote: People spell your name Stephen, sometimes too. Thinking of changing it? Gore Vidal's quote has panache, a valid compensation for breaking the usual rule. How many other uses on that page are similar? He provided common examples and reference links. Seem

Re: Python is readable

2012-03-17 Thread Chris Angelico
On Sun, Mar 18, 2012 at 6:59 AM, Kiuhnm wrote: > Could you please explain to me in which way >    mov eax, 3 > should be less readable than >    for i in x: print(i) > ? They are equally readable. The first one sets EAX to 3; the second displays all elements of x on the console. Assembly is reada

Re: Python is readable

2012-03-17 Thread Kiuhnm
On 3/17/2012 0:39, Michael Torrie wrote: For someone who claims he's merely examining the language and seeking to learn about it, Kiuhnm is jumping awfully quickly into the realm of trolling. I'm speechless... thanks, man! Kiuhnm -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-17 Thread Kiuhnm
On 3/17/2012 22:20, Chris Angelico wrote: On Sun, Mar 18, 2012 at 6:59 AM, Kiuhnm wrote: Could you please explain to me in which way mov eax, 3 should be less readable than for i in x: print(i) ? They are equally readable. The first one sets EAX to 3; the second displays all elements

Re: Python is readable

2012-03-17 Thread Michael Torrie
On 03/17/2012 03:28 PM, Kiuhnm wrote: >> They are equally readable. The first one sets EAX to 3; the second >> displays all elements of x on the console. Assembly is readable on a >> very low level, but it's by nature verbose at a high level, and thus >> less readable (you can't eyeball a function

Re: Python is readable

2012-03-17 Thread Ben Finney
Kiuhnm writes: > Welcome in the realm of trolling. Thank you for stating clearly what you're doing. Welcome to yet another kill-file. *plonk* -- \ “I am too firm in my consciousness of the marvelous to be ever | `\ fascinated by the mere supernatural …” —Joseph Conrad, _The | _o

Re: Python is readable

2012-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2012 21:54:40 +0100, Kiuhnm wrote: > On 3/16/2012 21:04, Prasad, Ramit wrote: >>> People spell your name Stephen, sometimes too. Thinking of changing >>> it? Gore Vidal's quote has panache, a valid compensation for breaking >> the usual rule. How many other uses on that page are sim

Re: Python is readable

2012-03-17 Thread Chris Angelico
On Sun, Mar 18, 2012 at 11:57 AM, Steven D'Aprano wrote: > The vast majority of English speakers write things like: > >    TO DO: And the vast majority of programmers leave out the space, even in non-code. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is readable

2012-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2012 20:59:34 +0100, Kiuhnm wrote: > Ok, so length and readability are orthogonal properties. Could you > please explain to me in which way > mov eax, 3 > should be less readable than > for i in x: print(i) > ? "mov eax, 3" requires more domain-specific knowledge. It oper

Re: Python is readable

2012-03-17 Thread Steven D'Aprano
On Sat, 17 Mar 2012 21:23:45 +0100, Kiuhnm wrote: > On 3/16/2012 14:03, Steven D'Aprano wrote: >> A one line routine is still a routine. There is nothing ungrammatical >> about "If you can: take the bus.", although it is non-idiomatic >> English. > > In another post you wrote > "Sorry, I was talk

Re: Python is readable

2012-03-17 Thread Steven D'Aprano
On Sun, 18 Mar 2012 12:07:36 +1100, Chris Angelico wrote: > On Sun, Mar 18, 2012 at 11:57 AM, Steven D'Aprano > wrote: >> The vast majority of English speakers write things like: >> >>    TO DO: > > And the vast majority of programmers leave out the space, even in > non-code. I'm not sure if yo

Re: Python is readable

2012-03-17 Thread Chris Angelico
On Sun, Mar 18, 2012 at 1:05 PM, Steven D'Aprano wrote: > I'm not sure if you're making a point there, or just a witty observation, > but for the record I would accept dictionaries adding "todo" as a jargon > entry. I don't think it is widespread enough to count as a regular word, > but if we can

Re: Python is readable

2012-03-18 Thread alister
On Thu, 15 Mar 2012 00:34:47 +0100, Kiuhnm wrote: > I've just started to read >The Quick Python Book (2nd ed.) > The author claims that Python code is more readable than Perl code and > provides this example: > > --- Perl --- > sub pairwise_sum { > my($arg1, $arg2) = @_; > my(@resul

Re: Python is readable

2012-03-18 Thread John Ladasky
On Mar 14, 11:23 pm, alex23 wrote: > The idea that Python code has to be obvious to non-programmers is an > incorrect and dangerous one. Incorrect? Probably. Dangerous? You'll have to explain what you mean. What I would say is that, when PROGRAMMERS look at Python code for the first time, th

Re: Python is readable

2012-03-18 Thread Chris Angelico
On Mon, Mar 19, 2012 at 8:30 AM, John Ladasky wrote: > What I would say is that, when PROGRAMMERS look at Python code for the > first time, they will understand what it does more readily than they > would understand other unfamiliar programming languages.  That has > value. This is something that

Re: Python is readable

2012-03-18 Thread Steven D'Aprano
On Mon, 19 Mar 2012 09:02:06 +1100, Chris Angelico wrote: > On Mon, Mar 19, 2012 at 8:30 AM, John Ladasky > wrote: >> What I would say is that, when PROGRAMMERS look at Python code for the >> first time, they will understand what it does more readily than they >> would understand other unfamiliar

  1   2   3   >