Asyncio project code review

2021-01-08 Thread James
Good day for everyone. I have new asyncio project which use aiohttp connector and asyncio protocols/transports for tunneling packets through Tor Network cleanly. Project called aiotor: https://github.com/torpyorg/aiotor If someone with experience in asyncio field can make code review I will

asyncio project code review

2021-01-08 Thread James
Good day everyone. I have new asyncio project which use aiohttp connector and asyncio protocols/transports for tunneling packets through Tor Network cleanly. Project called aiotor: https://github.com/torpyorg/aiotor If someone with experience in asyncio field can make code review I will be

Re: Flask test generator code review?

2018-04-30 Thread George Fischhof
2018-04-18 12:41 GMT+02:00 Albert-Jan Roskam : > Hi, > > I am writing my first unittests for a Flask app. First modest goal is to > test whether a selected subset of the templates return the expected status > 200. > I am using a nose test generator in a class for this. Is the code below > the corr

Flask test generator code review?

2018-04-18 Thread Albert-Jan Roskam
Hi, I am writing my first unittests for a Flask app. First modest goal is to test whether a selected subset of the templates return the expected status 200. I am using a nose test generator in a class for this. Is the code below the correct way to do this? And is there a way to dynamically set

Re: Brief Code Review Please - Learning Python

2015-12-07 Thread Thomas 'PointedEars' Lahn
>> 15 >> multiline=is_multi_lines) >> > > No need to set multiline = ... when is_multiline is already defined Watch for word wrap. He sets the argument for the “multiline” parameter in the measure.get_font_metrics() method call from the “is_multi_lines” para

Brief Code Review Please - Learning Python

2015-12-06 Thread Jason Alan Smith
Hello List Members, I am beginning to learn Python, and I've adapted some code from Google into the function below. I'm also looking at the PEP 8 style guide. I'd appreciate a brief code review so I can start this journey off on a solid foundation. :) * I've alrea

Brief Code Review Please - Learning Python

2015-12-06 Thread Jason Alan Smith
Hello List Members, I am beginning to learn Python, and I've adapted some code from Google into the function below. I'm also looking at the PEP 8 style guide. I'd appreciate a brief code review so I can start this journey off on a solid foundation. :) * I've alrea

Re: Brief Code Review Please - Learning Python

2015-12-06 Thread Peter Otten
n below. I'm also looking at the PEP 8 style guide. > I'd appreciate a brief code review so I can start this journey off on > a solid foundation. :) > > * I've already changed my editor from tabs to 4 spaces. > * I've also set my editor to a

Re: Brief Code Review Please - Learning Python

2015-12-06 Thread Chris Angelico
On Mon, Dec 7, 2015 at 4:34 AM, Joel Goldstick wrote: >> 5 if (desired_text != '') and \ >> 6 (desired_font_family != '') and \ >> 7 (desired_font_size != '') and \ >> 8 ((is_multi_lines == "True") or (is_multi_lines == "False")): >> > > The above test will always

Re: Brief Code Review Please - Learning Python

2015-12-06 Thread Joel Goldstick
n below. I'm also looking at the PEP 8 style guide. I'd > appreciate a brief code review so I can start this journey off on a solid > foundation. :) > > * I've already changed my editor from tabs to 4 spaces. > * I've also set my editor to alert me at

Brief Code Review Please - Learning Python

2015-12-06 Thread qualityaddictorg
eciate a brief code review so I can start this journey off on a solid foundation. :) * I've already changed my editor from tabs to 4 spaces. * I've also set my editor to alert me at 72 characters and don't exceed 79 characters. * I've named the function and va

Re: Atomic file save -- code review and comments requested

2015-09-02 Thread Oscar Benjamin
On Wed, 2 Sep 2015 19:06 Steven D'Aprano wrote: Howdy, I have a utility function for performing atomic file saves, and I'd like to ask for a code review and comments. I have published this on ActiveState: https://code.activestate.com/recipes/579097-safely-and-atomically-write

Atomic file save -- code review and comments requested

2015-09-02 Thread Steven D'Aprano
Howdy, I have a utility function for performing atomic file saves, and I'd like to ask for a code review and comments. I have published this on ActiveState: https://code.activestate.com/recipes/579097-safely-and-atomically-write-to-a-file/ under an MIT licence. You should read the ve

Re: Code review

2014-11-05 Thread Jean-Michel Pichavant
- Original Message - > From: "C Smith" > I read that with 2.7 that I had to initialize class variables to > immutable types. I think because I was working with the lists before > they had been altered and were still empty lists. I will mess around > tomorrow with the classes you suggested

Re: Code review

2014-11-04 Thread C Smith
>Jean-Michel wrote: >replace > if left_to_act is None: >left_to_act = [] > self.left_to_act = left_to_act >by > self.left_to_act = left_to_act or [] I read that with 2.7 that I had to initialize class variables to immutable types. I think because I was working with the lists before they had

Re: Code review

2014-11-04 Thread sohcahtoa82
On Tuesday, November 4, 2014 12:35:32 PM UTC-8, John Gordon wrote: > C Smith writes: > > > I was wondering if I could get some feedback on the biggest thing I > > have done as an amateur Python coder. > > Comments. > > You need a *lot* more comments. > > Like, every line or two of code should

Re: Code review

2014-11-04 Thread John Gordon
C Smith writes: > I was wondering if I could get some feedback on the biggest thing I > have done as an amateur Python coder. Comments. You need a *lot* more comments. Like, every line or two of code should have a comment explaining what is being accomplished. Seriously. Every line or two.

Re: Code review

2014-11-04 Thread Jean-Michel Pichavant
- Original Message - > From: "C Smith" > To: python-list@python.org > Sent: Tuesday, 4 November, 2014 4:28:33 PM > Subject: Code review > > I was wondering if I could get some feedback on the biggest thing I > have done as an amateur Python coder. The sid

Code review

2014-11-04 Thread C Smith
I was wondering if I could get some feedback on the biggest thing I have done as an amateur Python coder. The sidepots algorithm isn't correct yet, but I haven't worked on it in a while and thought I would get some advice before diving back in. import random, os ###

Re: Code Review for Paper, Rock, Scissors

2014-10-15 Thread Larry Hudson
On 10/14/2014 01:04 AM, Revenant wrote: Hi all! I'm new to Python and programming in general, and am trying to learn as much as I can about it. Anyway, for a basic first program I made a simple game of Paper, Rock, Scissors. For this program, I incorporated a main menu that presented three d

Re: Code Review for Paper, Rock, Scissors

2014-10-14 Thread Chris Angelico
= draws = 0 def instructions(): def about(): def score(): def again(): # which will return True or False, as per Dave's suggestion def play(): def menu(): print("Welcome") menu() When someone comes looking at a program like this, s/he can see exactly what depends on what. There can be exceptions, of course (sometimes mutual recursion really is the right thing to do, especially with tree-walking routines), but those can then be noted with comments ("Mutually recursive with xyz()."), or in some cases may be obvious from the names. In any case, the bulk of most programs can be written in this style, and it does improve clarity. Hope that's of value. Like all advice, it's just one person's opinion, and you're most welcome to reject it; but you did ask for code review, so I'm hoping you'll at least know *why* you're rejecting any piece of advice :) All the best! ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Code Review for Paper, Rock, Scissors

2014-10-14 Thread Glenn Hutchings
Hi there! Welcome to Python. On Tuesday, 14 October 2014 09:04:51 UTC+1, Revenant wrote: > I am new to Python and would also like to see if any of you programming > gurus have some suggestions about how I can simplify code, and also if > there are any other good starter programs to work on to i

Code Review for Paper, Rock, Scissors

2014-10-14 Thread Revenant
Hi all! I'm new to Python and programming in general, and am trying to learn as much as I can about it. Anyway, for a basic first program I made a simple game of Paper, Rock, Scissors. For this program, I incorporated a main menu that presented three different options, allowed the user to pla

Re: Code review?

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 6:22 PM, Bob Martin wrote: > Does any Linux distro ship with Python 3? I haven't seen one. On most Debian-based distros, you can simply 'apt-get install python3', and you'll get some 3.x version (in Debian Squeeze, that's 3.1, Debian Wheezy packages 3.2; Ubuntu since Rari

Re: Code review?

2014-01-13 Thread Bayram Güçlü
On 14-01-2014 11:22, Bob Martin wrote: in 714500 20140113 233415 Chris Angelico wrote: On Tue, Jan 14, 2014 at 7:43 AM, Steven D'Aprano wrote: On Tue, 14 Jan 2014 03:40:25 +1100, Chris Angelico wrote: Incidentally, is there a reason you're using Python 2.6? You should be able to upgrade at

Re: Code review?

2014-01-13 Thread Bob Martin
in 714500 20140113 233415 Chris Angelico wrote: >On Tue, Jan 14, 2014 at 7:43 AM, Steven D'Aprano wrote: >> On Tue, 14 Jan 2014 03:40:25 +1100, Chris Angelico wrote: >> >>> Incidentally, is there a reason you're using Python 2.6? You should be >>> able to upgrade at least to 2.7, and Flask ought

Re: Code review?

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 7:43 AM, Steven D'Aprano wrote: > On Tue, 14 Jan 2014 03:40:25 +1100, Chris Angelico wrote: > >> Incidentally, is there a reason you're using Python 2.6? You should be >> able to upgrade at least to 2.7, and Flask ought to work fine on 3.3 >> (the current stable Python). If

Re: Code review?

2014-01-13 Thread Steven D'Aprano
On Tue, 14 Jan 2014 03:40:25 +1100, Chris Angelico wrote: > Incidentally, is there a reason you're using Python 2.6? You should be > able to upgrade at least to 2.7, and Flask ought to work fine on 3.3 > (the current stable Python). If it's the beginning of your project, and > you have nothing bin

Re: Code review?

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 3:29 AM, Adam wrote: > Hey all. New to the list. I’m working on a web app with 2.6 and Flask. I’m > still relatively new to python. Is there a chance to get a code review from > anyone? I really want someone to just tear up my code and tell me how to >

Code review?

2014-01-13 Thread Adam
Hey all. New to the list. I’m working on a web app with 2.6 and Flask. I’m still relatively new to python. Is there a chance to get a code review from anyone? I really want someone to just tear up my code and tell me how to increase my efficiency and what I’m doing wrong (and how to upload

Re: request for another code review

2012-09-24 Thread Littlefield, Tyler
On 9/23/2012 9:48 PM, alex23 wrote: On Sep 23, 6:14 am, "Littlefield, Tyler" wrote: I've gotten a bit farther into my python mud, and wanted to request another code review for style and the like. Are you familiar with codereview.stackexchange.com ? I actually wasn't, th

Re: request for another code review

2012-09-24 Thread Littlefield, Tyler
On 9/23/2012 9:48 PM, alex23 wrote: On Sep 23, 6:14 am, "Littlefield, Tyler" wrote: I've gotten a bit farther into my python mud, and wanted to request another code review for style and the like. Are you familiar with codereview.stackexchange.com ? I actually wasn't, th

Re: request for another code review

2012-09-23 Thread alex23
On Sep 23, 6:14 am, "Littlefield, Tyler" wrote: > I've gotten a bit farther into my python mud, and wanted to request > another code review for style and the like. Are you familiar with codereview.stackexchange.com ? (This isn't to dissuade you from posting such r

request for another code review

2012-09-22 Thread Littlefield, Tyler
Hello all: I've gotten a bit farther into my python mud, and wanted to request another code review for style and the like. Mainly I'm concerned about player.py, world.py and components and other ways to handle what I'm trying to do. I didn't run pychecker just yet, so ther

Re: code review

2012-07-17 Thread Albert van der Horst
In article , Duncan Booth wrote: >Steven D'Aprano wrote: > >> On Fri, 13 Jul 2012 12:30:47 +, Albert van der Horst wrote: >>> The worst of is, of course, = for assignment instead of := . This is >>> a convention that Python follows, to my dismay. >> >> *shrug* >> >> The worst is to use = for

Re: code review

2012-07-16 Thread Ben Finney
Duncan Booth writes: > Technically of course Python doesn't have assignment, it just binds > names. Names, or other references. I'd argue that Python has assignment, and assignment in Python is identical with binding references to objects. But then, the Python documentation refers to “variable

Re: code review

2012-07-16 Thread Duncan Booth
Steven D'Aprano wrote: > On Fri, 13 Jul 2012 12:30:47 +, Albert van der Horst wrote: >> The worst of is, of course, = for assignment instead of := . This is >> a convention that Python follows, to my dismay. > > *shrug* > > The worst is to use = for both equality and assignment, like some >

Re: code review

2012-07-14 Thread Terry Reedy
On 7/14/2012 5:26 AM, Ian Kelly wrote: On Fri, Jul 13, 2012 at 5:09 PM, Terry Reedy wrote: I believe the following rule is true: if a op b is True or False raises, Sorry, left out 'or' in 'or raises' I don't follow. Raises what? an Exception. then op is a potentially chained comparis

Re: code review

2012-07-14 Thread Ian Kelly
On Fri, Jul 13, 2012 at 5:09 PM, Terry Reedy wrote: > >> From now on, for each operator I would have to remember wether it >> is a supposedly comparison operator or not. > > > I believe the following rule is true: if a op b is True or False raises, I don't follow. Raises what? > then op is a po

Re: code review

2012-07-13 Thread Terry Reedy
From now on, for each operator I would have to remember wether it is a supposedly comparison operator or not. I believe the following rule is true: if a op b is True or False raises, then op is a potentially chained comparison operation. They are (not) equal (and (not) is), the 4 order compa

Re: code review

2012-07-13 Thread rusi
On Jul 13, 8:36 pm, Chris Angelico wrote: > On Sat, Jul 14, 2012 at 1:04 AM, Steven D'Aprano > > wrote: > > Actually, no. Is True less than False, or is it greater? In boolean > > algebra, the question has no answer. It is only an implementation detail > > of Python that chooses False < True. > >

Re: code review

2012-07-13 Thread Roy Smith
On Friday, July 6, 2012 9:58:10 AM UTC-4, Steven D'Aprano wrote: > (Sadly, when I say "we" I mean > collectively. Many language designers, and programmers, don't have the > foggiest clue as to what makes a good clean design. Hence C++ and PHP.) I'm not going to defend C++, but to be fair, a majo

Re: code review

2012-07-13 Thread Chris Angelico
On Sat, Jul 14, 2012 at 1:04 AM, Steven D'Aprano wrote: > Actually, no. Is True less than False, or is it greater? In boolean > algebra, the question has no answer. It is only an implementation detail > of Python that chooses False < True. Maybe in boolean algebra, but in code, it's handy to have

Re: code review

2012-07-13 Thread Steven D'Aprano
On Fri, 13 Jul 2012 12:30:47 +, Albert van der Horst wrote: >>Apart from Python, Mathematica, Perl 6, CoffeeScript, Cobra and Clay >>give chained comparisons the standard meaning. It is, or was, a feature >>request for Boo, but I can't tell whether it has been implemented or >>not. > > Algol

Re: code review

2012-07-13 Thread Albert van der Horst
In article <4ff0f8e0$0$29988$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: >On Sun, 01 Jul 2012 05:55:24 -0400, Terry Reedy wrote: > >> On 7/1/2012 2:54 AM, Steven D'Aprano wrote: >> >>> So no, Python has always included chained comparisons, and yes, it is >>> shameful that a langua

Re: Re: code review

2012-07-06 Thread lars van gemerden
On Sunday, July 1, 2012 5:48:40 PM UTC+2, Evan Driscoll wrote: > On 7/1/2012 4:54, Alister wrote: > > On Sat, 30 Jun 2012 23:45:25 -0500, Evan Driscoll wrote: > >> If I had seen that in a program, I'd have assumed it was a bug. > > > > You would? > > I have only been using python for 6 - 12 months

Apology for OT posts (was: code review)

2012-07-05 Thread John O'Hagan
On Tue, 03 Jul 2012 23:39:20 -0600 "Littlefield, Tyler" wrote: > On 7/3/2012 10:55 PM, Simon Cropper wrote: > > Some questions to Tyler Littlefield, who started this thread. > > > > Q1 -- Did you get any constructive feedback on your code? > > I did get some, which I appreciated. someone mention

Re: code review

2012-07-04 Thread Mark Lawrence
On 04/07/2012 10:29, Paul Rudin wrote: Mark Lawrence writes: On 03/07/2012 03:25, John O'Hagan wrote: On Tue, 3 Jul 2012 11:22:55 +1000 I agree to some extent, but as a counter-example, when I was a child there a subject called "Weights and Measures" which is now redundant because of the Met

Re: code review

2012-07-04 Thread levi nie
2012/7/4 Paul Rudin > Mark Lawrence writes: > > > On 03/07/2012 03:25, John O'Hagan wrote: > >> On Tue, 3 Jul 2012 11:22:55 +1000 > >> > >> I agree to some extent, but as a counter-example, when I was a child > there > >> a subject called "Weights and Measures" which is now redundant because > o

Re: code review

2012-07-04 Thread Paul Rudin
Mark Lawrence writes: > On 03/07/2012 03:25, John O'Hagan wrote: >> On Tue, 3 Jul 2012 11:22:55 +1000 >> >> I agree to some extent, but as a counter-example, when I was a child there >> a subject called "Weights and Measures" which is now redundant because of the >> Metric system. I don't miss ho

Re: code review

2012-07-04 Thread Mark Lawrence
On 03/07/2012 22:54, Chris Angelico wrote: On Wed, Jul 4, 2012 at 6:13 AM, Dave Angel wrote: On 07/03/2012 12:05 PM, Mark Lawrence wrote: If I go to the moon I will weigh 2st 10lb (if my sums are correct :) but the equivalent Frenchman will still be 86kg. I hereby put this forward as proof tha

Re: code review

2012-07-04 Thread rusi
> > It did get me wondering, though, if there's much in the way of support > for code review in repository sites like github? Being able to > aggregate comments around the actual code itself could be really > handy. -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-07-04 Thread alex23
:) But yes, it should've been forked into a separate thread ages okay. It did get me wondering, though, if there's much in the way of support for code review in repository sites like github? Being able to aggregate comments around the actual code itself could be really handy. -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-07-03 Thread Littlefield, Tyler
On 7/3/2012 10:55 PM, Simon Cropper wrote: Some questions to Tyler Littlefield, who started this thread. Q1 -- Did you get any constructive feedback on your code? I did get some, which I appreciated. someone mentioned using PyLint. From reading, I found it was really really pedantic, so I use

Re: code review

2012-07-03 Thread Simon Cropper
On 04/07/12 13:53, Chris Angelico wrote: On Wed, Jul 4, 2012 at 12:57 PM, wrote: Well, if you waited until you had the password (however long) in a variable before you applied your maximum limits, the DoS ship has probably sailed already. Only because data transfer is usually more expensiv

Re: code review

2012-07-03 Thread Chris Angelico
On Wed, Jul 4, 2012 at 12:57 PM, wrote: > Well, if you waited until you had the password (however long) in a variable > before you applied your maximum limits, the DoS ship has probably sailed > already. Only because data transfer is usually more expensive than hashing. But I'd say that'll alw

Re: code review

2012-07-03 Thread kushal . kumaran+python
Ian Kelly wrote: >On Tue, Jul 3, 2012 at 11:53 AM, Kushal Kumaran > wrote: >> On Sat, Jun 30, 2012 at 3:34 PM, Alister >wrote: >>> On Fri, 29 Jun 2012 09:03:22 -0600, Littlefield, Tyler wrote: >>> On 6/29/2012 1:31 AM, Steven D'Aprano wrote: > On Thu, 28 Jun 2012 20:58:15 -0700, alex23

Re: code review

2012-07-03 Thread Chris Angelico
On Wed, Jul 4, 2012 at 6:13 AM, Dave Angel wrote: > On 07/03/2012 12:05 PM, Mark Lawrence wrote: >> If I go to the moon I will weigh 2st 10lb (if my sums are correct :) >> but the equivalent Frenchman will still be 86kg. I hereby put this >> forward as proof that the metric system is rubbish and w

Re: code review

2012-07-03 Thread Chris Angelico
On Wed, Jul 4, 2012 at 4:27 AM, Ian Kelly wrote: > On Tue, Jul 3, 2012 at 12:18 PM, John Gordon wrote: >> As a practical matter, doesn't there have to be *some* sort of limit? >> For example if the (encrypted) password is stored in a database, you can't >> exceed the table column width. > > Hopef

Re: code review

2012-07-03 Thread Dave Angel
On 07/03/2012 12:05 PM, Mark Lawrence wrote: > On 03/07/2012 16:53, Chris Angelico wrote: >> On Wed, Jul 4, 2012 at 1:50 AM, Mark Lawrence >> wrote: >>> On 03/07/2012 03:25, John O'Hagan wrote: On Tue, 3 Jul 2012 11:22:55 +1000 I agree to some extent, but as a counter-example,

Re: code review

2012-07-03 Thread Ian Kelly
On Tue, Jul 3, 2012 at 12:18 PM, John Gordon wrote: > In Kushal Kumaran > writes: > >> I haven't actually seen the rest of the code, but I would like to >> point out that applications placing maximum length limits on passwords >> are extremely annoying. > > As a practical matter, doesn't there

Re: code review

2012-07-03 Thread John Gordon
In Kushal Kumaran writes: > I haven't actually seen the rest of the code, but I would like to > point out that applications placing maximum length limits on passwords > are extremely annoying. As a practical matter, doesn't there have to be *some* sort of limit? For example if the (encrypted)

Re: code review

2012-07-03 Thread Ian Kelly
On Tue, Jul 3, 2012 at 11:53 AM, Kushal Kumaran wrote: > On Sat, Jun 30, 2012 at 3:34 PM, Alister wrote: >> On Fri, 29 Jun 2012 09:03:22 -0600, Littlefield, Tyler wrote: >> >>> On 6/29/2012 1:31 AM, Steven D'Aprano wrote: On Thu, 28 Jun 2012 20:58:15 -0700, alex23 wrote: > On Jun 29

Re: code review

2012-07-03 Thread Kushal Kumaran
On Sat, Jun 30, 2012 at 3:34 PM, Alister wrote: > On Fri, 29 Jun 2012 09:03:22 -0600, Littlefield, Tyler wrote: > >> On 6/29/2012 1:31 AM, Steven D'Aprano wrote: >>> On Thu, 28 Jun 2012 20:58:15 -0700, alex23 wrote: >>> On Jun 29, 12:57 pm, "Littlefield, Tyler" wrote: > I was curious if

Re: code review

2012-07-03 Thread Mark Lawrence
On 03/07/2012 16:53, Chris Angelico wrote: On Wed, Jul 4, 2012 at 1:50 AM, Mark Lawrence wrote: On 03/07/2012 03:25, John O'Hagan wrote: On Tue, 3 Jul 2012 11:22:55 +1000 I agree to some extent, but as a counter-example, when I was a child there a subject called "Weights and Measures" which

Re: code review

2012-07-03 Thread Mark Lawrence
On 03/07/2012 07:09, Dennis Lee Bieber wrote: On 03 Jul 2012 04:11:22 GMT, Steven D'Aprano declaimed the following in gmane.comp.python.general: One of my favourites is the league, which in the Middle Ages was actually defined as the distance that a man, or a horse, could walk in an hour.

Re: code review

2012-07-03 Thread Chris Angelico
On Wed, Jul 4, 2012 at 1:50 AM, Mark Lawrence wrote: > On 03/07/2012 03:25, John O'Hagan wrote: >> >> On Tue, 3 Jul 2012 11:22:55 +1000 >> >> I agree to some extent, but as a counter-example, when I was a child there >> a subject called "Weights and Measures" which is now redundant because of >> t

Re: code review

2012-07-03 Thread Mark Lawrence
On 03/07/2012 03:25, John O'Hagan wrote: On Tue, 3 Jul 2012 11:22:55 +1000 I agree to some extent, but as a counter-example, when I was a child there a subject called "Weights and Measures" which is now redundant because of the Metric system. I don't miss hogsheads and fathoms at all. John I

Re: code review

2012-07-03 Thread John O'Hagan
On Mon, 2 Jul 2012 22:10:00 -0700 (PDT) rusi wrote: > On Jul 3, 7:25 am, John O'Hagan wrote: > > > > I agree to some extent, but as a counter-example, when I was a child there > > a subject called "Weights and Measures" which is now redundant because of > > the Metric system. I don't miss hogshe

Re: code review

2012-07-03 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > On 03 Jul 2012 04:11:22 GMT, Steven D'Aprano > declaimed the following in > gmane.comp.python.general: > > > > One of my favourites is the league, which in the Middle Ages was actually > > defined as the distance that a man, or a horse, could walk in a

Re: code review

2012-07-03 Thread Neil Cerutti
On 2012-07-02, Chris Angelico wrote: > On Tue, Jul 3, 2012 at 1:57 AM, Rick Johnson > wrote: >> Poor Chris. That's because you've been brainwashed into believing you >> must spoon feed your interpreter to get your code working correctly. >> Stop applying these naive assumptions to Python code. Pyt

Evolution (was: code review)

2012-07-03 Thread Ian Kelly
On Mon, Jul 2, 2012 at 1:35 PM, Rick Johnson wrote: > I am reminded of a story: A few years back a very nice old woman > offered to give me her typewriter. She said: "i might need to type a > letter one day and it would good to have around". It was a nice > typewriter for 1956, but she had no idea

Re: code review

2012-07-02 Thread Ben Finney
rusi writes: > Similar for standardized languages: Python's indentation is nice -- > except when you have to embed it into say, html If you can't write a ‘pre’ element for pre-formatted text, you don't have HTML http://www.w3.org/TR/html401/struct/text.html#h-9.3.4>. -- \ “Pinky, are you

Re: code review

2012-07-02 Thread rusi
On Jul 3, 7:25 am, John O'Hagan wrote: > > I agree to some extent, but as a counter-example, when I was a child there > a subject called "Weights and Measures" which is now redundant because of the > Metric system. I don't miss hogsheads and fathoms at all. > > Music is another field which could d

Re: code review

2012-07-02 Thread Steven D'Aprano
On Tue, 03 Jul 2012 12:25:59 +1000, John O'Hagan wrote: > On Tue, 3 Jul 2012 11:22:55 +1000 > Chris Angelico wrote: > >> On Tue, Jul 3, 2012 at 10:57 AM, Steven D'Aprano >> wrote: >> >> > Perhaps the world would be better off if mathematicians threw out the >> > existing precedence rules and r

Re: code review

2012-07-02 Thread John O'Hagan
On Tue, 3 Jul 2012 11:22:55 +1000 Chris Angelico wrote: > On Tue, Jul 3, 2012 at 10:57 AM, Steven D'Aprano > wrote: > > > Perhaps the world would be better off if mathematicians threw out the > > existing precedence rules and replaced them with a strict left-to-right > > precedence. (Personally

Re: code review

2012-07-02 Thread Chris Angelico
On Tue, Jul 3, 2012 at 10:57 AM, Steven D'Aprano wrote: > On Tue, 03 Jul 2012 02:55:48 +1000, Chris Angelico wrote: >> Oh yes, absolutely consistent. Consistency. It's a CR 1/2 monster found >> on page 153 of the 3.5th Edition Monster Manual. > > GvR is fond of quoting Ralph Waldo Emerson: > > "A

Re: code review

2012-07-02 Thread Steven D'Aprano
On Tue, 03 Jul 2012 02:55:48 +1000, Chris Angelico wrote: > On Tue, Jul 3, 2012 at 1:16 AM, Rick Johnson > wrote: >> py> 1 + 3 * 4 >> should ALWAYS equal 16! >> >> With parenthesis only used for grouping: py> a + (b*c) + d >> >> Which seems like the most consistent approach to me. > > Oh yes, ab

Re: code review

2012-07-02 Thread Chris Angelico
On Tue, Jul 3, 2012 at 5:06 AM, Thomas Jollans wrote: > On 07/02/2012 08:22 PM, Rick Johnson wrote: >> Agreed. I wish we had one language. One which had syntactical >> directives for scoping, blocks, assignments, etc, etc... >> >> BLOCK_INDENT_MARKER -> \t >> BLOCK_DEDENT_MARKER -> \n >> STATEMENT

Re: code review

2012-07-02 Thread Rick Johnson
On Jul 2, 2:06 pm, Thomas Jollans wrote: > On 07/02/2012 08:22 PM, Rick Johnson wrote: > > > Agreed. I wish we had one language. One which had syntactical > > directives for scoping, blocks, assignments, etc, etc... > > > BLOCK_INDENT_MARKER -> \t > > BLOCK_DEDENT_MARKER -> \n > > STATEMENT_TERMIN

Re: code review

2012-07-02 Thread Ian Kelly
On Sat, Jun 30, 2012 at 2:50 PM, Thomas Jollans wrote: > Which of the two comparisons is done first anyway? > "In the face of ambiguity, refuse the temptation to guess." I would consider that a pro, not a con, because the C-like way is much worse in this regard. Using operator chaining, is "1 <

Re: code review

2012-07-02 Thread Thomas Jollans
On 07/02/2012 08:22 PM, Rick Johnson wrote: > Agreed. I wish we had one language. One which had syntactical > directives for scoping, blocks, assignments, etc, etc... > > BLOCK_INDENT_MARKER -> \t > BLOCK_DEDENT_MARKER -> \n > STATEMENT_TERMINATOR -> \n > ASSIGNMENT_OPERATOR -> := > CONDITIONAL_IF

Re: code review

2012-07-02 Thread Rick Johnson
On Jul 2, 11:42 am, Chris Angelico wrote: > Rick, do you realize that you have > to spoon-feed the interpreter with spaces/tabs when other interpreters > just KNOW to drop back an indentation level when you close a brace? Yes. And significant white space is my favorite attribute of Python source

Re: code review

2012-07-02 Thread Chris Angelico
On Tue, Jul 3, 2012 at 1:16 AM, Rick Johnson wrote: > py> 1 + 3 * 4 > should ALWAYS equal 16! > > With parenthesis only used for grouping: > py> a + (b*c) + d > > Which seems like the most consistent approach to me. Oh yes, absolutely consistent. Consistency. It's a CR 1/2 monster found on page 1

Re: code review

2012-07-02 Thread Rick Johnson
On Jun 30, 9:06 pm, Steven D'Aprano wrote: > On Sun, 01 Jul 2012 00:05:26 +0200, Thomas Jollans wrote: > > Yes. My sole point, really, is that "normally", one would expect these > > two expressions to be equivalent: > > > a < b < c > > (a < b) < c > > Good grief. Why would you expect that? > > You

Re: code review

2012-07-02 Thread Chris Angelico
On Tue, Jul 3, 2012 at 1:57 AM, Rick Johnson wrote: > Poor Chris. That's because you've been brainwashed into believing you > must spoon feed your interpreter to get your code working correctly. > Stop applying these naive assumptions to Python code. Python knows > when you reach the end of a stat

Re: code review

2012-07-02 Thread Rick Johnson
On Jul 2, 3:20 am, Chris Angelico wrote: > On Mon, Jul 2, 2012 at 6:11 PM, Steven D'Aprano > > wrote: > > "c" < first_word < second_word == third_word < "x" > > > I'm sure I don't have to explain what that means -- that standard chained > > notation for comparisons is obvious and simple. > > > In

Re: code review

2012-07-02 Thread Terry Reedy
On 7/2/2012 1:20 AM, Dennis Lee Bieber wrote: Obviously, someone coming over from VB or R or any other single language x who hasn't read the Python reference is going to be surprised as something or other. So what. The manuals, including the tutorial, are there for a reason. The main poin

Re: code review

2012-07-02 Thread Thomas Jollans
On 07/02/2012 03:28 AM, Steven D'Aprano wrote: > We *really did have* somebody arguing that chained comparisons are Bad > because you can't stick parentheses around bits of it without changing > the semantics. That was an actual argument, not a straw-man. Ahem. It may have been sub-optimally phr

Re: code review

2012-07-02 Thread Thomas Jollans
On 07/02/2012 02:43 AM, Steven D'Aprano wrote: > On Sun, 01 Jul 2012 09:35:40 +0200, Thomas Jollans wrote: >> This is simply wrong. The comparisons are not acting as binary >> operators. > > Of course they are. Take this chained comparison: Technically, yes - two-input operations are happening. S

Re: code review

2012-07-02 Thread Chris Angelico
On Mon, Jul 2, 2012 at 6:11 PM, Steven D'Aprano wrote: > "c" < first_word < second_word == third_word < "x" > > I'm sure I don't have to explain what that means -- that standard chained > notation for comparisons is obvious and simple. > > In Python, you write it the normal way, as above. But some

Re: code review

2012-07-02 Thread Steven D'Aprano
On Mon, 02 Jul 2012 12:04:29 +1000, Chris Angelico wrote: >> Chained comparisons in the Python sense may be rare in computer >> languages, but it is the standard in mathematics and hardly needs to be >> explained to anyone over the age of twelve. That is a terrible >> indictment on the state of pr

Re: code review

2012-07-02 Thread Steven D'Aprano
On Sun, 01 Jul 2012 21:50:29 -0400, Devin Jeanpierre wrote: > On Sun, Jul 1, 2012 at 9:28 PM, Steven D'Aprano > wrote: >> Technically, < in Python is left-associative: a < b < c first evaluates >> a, not b or c. But it is left-associative under the rules of comparison >> operator chaining, not ar

Re: code review

2012-07-01 Thread John O'Hagan
On Sun, 01 Jul 2012 13:41:20 -0400 Dennis Lee Bieber wrote: > I'd think a true newcomer (to programming) would have NO > expectations... And if they'd had any complex math classes may actually > consider > if 1 < x < 10: > to be the norm [...] +1 I've only ever known Pyth

Re: code review

2012-07-01 Thread Chris Angelico
On Mon, Jul 2, 2012 at 11:28 AM, Steven D'Aprano wrote: > On Sun, 01 Jul 2012 16:33:15 +1000, Chris Angelico wrote: > >> On Sun, Jul 1, 2012 at 4:27 PM, Steven D'Aprano >> wrote: >>> Yes, you can find specially crafted examples where adding parentheses >>> in certain places, but not others, doesn

Re: code review

2012-07-01 Thread Devin Jeanpierre
On Sun, Jul 1, 2012 at 9:28 PM, Steven D'Aprano wrote: > Technically, < in Python is left-associative: a < b < c first evaluates > a, not b or c. But it is left-associative under the rules of comparison > operator chaining, not arithmetic operator chaining. Left-associativity is when a < b < c is

Re: code review

2012-07-01 Thread Devin Jeanpierre
On Sun, Jul 1, 2012 at 8:41 PM, Steven D'Aprano wrote: > On Sun, 01 Jul 2012 05:18:09 -0400, Devin Jeanpierre wrote: > Sheesh guys. Don't go hunting through the most obscure corners of > mathematics for examples of computer scientists who have invented their > own maths notation. (Which, by your o

Re: code review

2012-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2012 16:33:15 +1000, Chris Angelico wrote: > On Sun, Jul 1, 2012 at 4:27 PM, Steven D'Aprano > wrote: >> Yes, you can find specially crafted examples where adding parentheses >> in certain places, but not others, doesn't change the overall >> evaluation of the expression. > > My p

Re: code review

2012-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2012 05:55:24 -0400, Terry Reedy wrote: > On 7/1/2012 2:54 AM, Steven D'Aprano wrote: > >> So no, Python has always included chained comparisons, and yes, it is >> shameful that a language would force you to unlearn standard notation >> in favour of a foolish consistency with other

Re: code review

2012-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2012 09:35:40 +0200, Thomas Jollans wrote: > On 07/01/2012 04:06 AM, Steven D'Aprano wrote: >> On Sun, 01 Jul 2012 00:05:26 +0200, Thomas Jollans wrote: >> >>> As soon as you read it as a ternary operator, >> >> Well that's your problem. Why are you reading it as a ternary operato

  1   2   3   >