Function to take the minimum of 3 numbers
Chris Angelico
rosuav at gmail.com
Sun Oct 9 21:36:16 EDT 2016
More information about the Python-list mailing list
Sun Oct 9 21:36:16 EDT 2016
- Previous message (by thread): Function to take the minimum of 3 numbers
- Next message (by thread): Function to take the minimum of 3 numbers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Oct 10, 2016 at 11:38 AM, Matt Wheeler <funkyhat at gmail.com> wrote: > On Mon, 10 Oct 2016, 00:56 Ian Kelly, <ian.g.kelly at gmail.com> wrote: > >> On Oct 9, 2016 2:57 PM, <breamoreboy at gmail.com> wrote: >> The Pythonic way >> >> if b >= a <= c: >> ... >> >> >> Better: >> >> if a <= b <= c: >> ... >> > > That's not equivalent. Consider `a, b, c = 1, 7, 4` > > >> Using consistent operators is not required but is easier to read and less >> confusing. >> > > Unfortunately in this case it's also less correct Proof that it's confusing: Someone tried to tidy up the code, and unwittingly changed its semantics. ChrisA
- Previous message (by thread): Function to take the minimum of 3 numbers
- Next message (by thread): Function to take the minimum of 3 numbers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list