On 29Jul2019 10:15, Chris Angelico wrote:
On Mon, Jul 29, 2019 at 10:06 AM Richard Damon wrote:
When talking of empty strings, we need to look a bit at context. "The
empty string" implies that there is only one of them, and if we are
talking about values, then there is only one empty string v
On 28Jul2019 20:11, Richard Damon wrote:
On 7/28/19 11:13 AM, MRAB wrote:
On 2019-07-28 13:30, Cameron Simpson wrote:
The collection is "the things". "all" qualifies it, versus, say,
"some of the things" or "the first of the things" etc.
[snip]
It's strange that "all the things" (meaning "a
On 7/28/2019 7:55 AM, Jonathan Moules wrote:
Lets say I want to know if the value of `x` is bool(True).
My preferred way to do it is:
if x is True:
pass
If you know that expression x is boolean, and one usually knows or
should know whether is it or is not, '= True' and 'is True' and
si
On 7/28/19 6:04 PM, Chris Angelico wrote:
> This is a fairly unusual case, though. More commonly, the default
> would be None, not False, and "if bar is None:" is extremely well
> known and idiomatic.
Ahh yes, true.
> This analysis is correct, but the situations where you *actually* want
> to kno
On 7/28/19 8:46 PM, Chris Angelico wrote:
> On Mon, Jul 29, 2019 at 10:43 AM Richard Damon
> wrote:
>> On 7/28/19 8:25 PM, Chris Angelico wrote:
>>> Of course, if the third value can be simplified away (eg None means
>>> "use the global default"), then you can still just use "if verbose is
>>> No
On 2019-07-29, Richard Damon wrote:
> On 7/28/19 7:46 PM, Michael Torrie wrote:
>> Yet the recommended solution to the problem of wanting a default
>> argument of an empty list is something like this:
>>
>> def foo(bar=False);
>> if bar is False:
>> bar = []
>>
>>
>
> I thoug
On Mon, Jul 29, 2019 at 10:43 AM Richard Damon wrote:
>
> On 7/28/19 8:25 PM, Chris Angelico wrote:
> > Of course, if the third value can be simplified away (eg None means
> > "use the global default"), then you can still just use "if verbose is
> > None:" and then reassign it. But this is a legit
On 7/28/19 8:25 PM, Chris Angelico wrote:
> On Mon, Jul 29, 2019 at 10:15 AM Richard Damon
> wrote:
>> On 7/28/19 7:46 PM, Michael Torrie wrote:
>>> On 7/28/19 5:55 AM, Jonathan Moules wrote:
But this appears to be explicitly called out as being "Worse" in PEP8:
"""
Don't comp
On Mon, Jul 29, 2019 at 10:15 AM Richard Damon wrote:
>
> On 7/28/19 7:46 PM, Michael Torrie wrote:
> > On 7/28/19 5:55 AM, Jonathan Moules wrote:
> >> But this appears to be explicitly called out as being "Worse" in PEP8:
> >>
> >> """
> >> Don't compare boolean values to True or False using ==.
On Mon, Jul 29, 2019 at 10:06 AM Richard Damon wrote:
> When talking of empty strings, we need to look a bit at context. "The
> empty string" implies that there is only one of them, and if we are
> talking about values, then there is only one empty string values, so
> "The empty string value" wou
On 7/28/19 7:46 PM, Michael Torrie wrote:
> On 7/28/19 5:55 AM, Jonathan Moules wrote:
>> But this appears to be explicitly called out as being "Worse" in PEP8:
>>
>> """
>> Don't compare boolean values to True or False using ==.
>>
>> Yes: if greeting:
>> No: if greeting == True:
>> Worse: if
On 7/28/19 11:13 AM, MRAB wrote:
> On 2019-07-28 13:30, Cameron Simpson wrote:
>>
>> The collection is "the things". "all" qualifies it, versus, say, "some
>> of the things" or "the first of the things" etc.
>>
> [snip]
>
> It's strange that "all the things" (meaning "all of the things") is
> OK, b
On Mon, Jul 29, 2019 at 9:48 AM Michael Torrie wrote:
>
> On 7/28/19 5:55 AM, Jonathan Moules wrote:
> > But this appears to be explicitly called out as being "Worse" in PEP8:
> >
> > """
> > Don't compare boolean values to True or False using ==.
> >
> > Yes: if greeting:
> > No:if greeting
On 7/28/19 7:04 PM, Chris Angelico wrote:
> On Sun, Jul 28, 2019 at 5:36 PM Marko Rauhamaa wrote:
>> So it depends on the context if the relevant equivalence is "is" or
>> "==". Maybe the rule of thumb is that if we are talking about strings,
>> integers and similar things, we should think about i
On 2019-07-29 00:04, Chris Angelico wrote:
On Sun, Jul 28, 2019 at 5:36 PM Marko Rauhamaa wrote:
So it depends on the context if the relevant equivalence is "is" or
"==". Maybe the rule of thumb is that if we are talking about strings,
integers and similar things, we should think about it from
On 7/28/19 5:55 AM, Jonathan Moules wrote:
> But this appears to be explicitly called out as being "Worse" in PEP8:
>
> """
> Don't compare boolean values to True or False using ==.
>
> Yes: if greeting:
> No: if greeting == True:
> Worse: if greeting is True:
> """
Yet the recommended solu
On Sun, Jul 28, 2019 at 5:36 PM Marko Rauhamaa wrote:
> So it depends on the context if the relevant equivalence is "is" or
> "==". Maybe the rule of thumb is that if we are talking about strings,
> integers and similar things, we should think about it from the point of
> view of Python's data mod
On 28/07/2019 17:13, MRAB wrote:
> [snip]
>
> It's strange that "all the things" (meaning "all of the things") is OK,
> but otherwise it's "one of the things", "some of the things", etc.
Is it?
It's the same in French, Dutch and German. Can't tell if it just makes
sense or if it's Common Average
On 07/28/2019 01:46 PM, Erik Aronesty wrote:
One possibility
---
class Status:
valid = 1
invalid = 2
unknown = 3
if status is Status.valid:
# good status, do something
elif status is Status.unknown:
figure_out_status()
elif status is Status.invalid:
class Status:
valid = 1
invalid = 2
unknown = 3
On Fri, Jul 26, 2019, 3:37 PM Chris Angelico wrote:
> On Sat, Jul 27, 2019 at 5:16 AM Erik Aronesty wrote:
> >
> > I just spend a while tracking down and killing all "if Enum" and "if not
> > Enum" bugs in my code. I was frankly shocked
Jonathan Moules :
> Lets say I want to know if the value of `x` is bool(True).
> My preferred way to do it is:
>
> if x is True:
> [...]
>
> But this appears to be explicitly called out as being "Worse" in PEP8:
>
> [...]
>
> Why?
It has primarily to do with the naturalness of expression. In Engl
On 2019-07-28 18:45, Steven via Python-list wrote:
Good afternoon,
I originally started with the latest version of python (3.7), but I was unable
to figure out how to get to script mode. There weren't any tabs at the top of
the interactive mode window.
What is "script mode"? Are you using I
Good afternoon,
I originally started with the latest version of python (3.7), but I was unable
to figure out how to get to script mode. There weren't any tabs at the top of
the interactive mode window.
So I decided to uninstall 3.7, and try 3.5.2 (since that is the version my
online instructo
Hi List,
Lets say I want to know if the value of `x` is bool(True).
My preferred way to do it is:
if x is True:
pass
Because this tests both the value and the type.
But this appears to be explicitly called out as being "Worse" in PEP8:
"""
Don't compare boolean values to True or False usin
On 2019-07-28 13:30, Cameron Simpson wrote:
On 28Jul2019 10:32, Peter Otten <__pete...@web.de> wrote:
Chris Angelico wrote:
When talking about indistinguishable objects, is it correct to talk
about "the " or "an "?
Example:
def f(s):
"""Frob a thing.
If s is an empty string, frobs a
On 27/07/2019 17.43, Stefan Ram wrote:
> Terry Reedy writes:
>> In mathematics, *every* set is 'the'.
This is correct, at least in ZF, where the Axiom of Extensionality says
that (in English) if A and B have exactly the same elements, they are
the same set.
> |Example 2 Let T be an non-empty s
On 28Jul2019 10:32, Peter Otten <__pete...@web.de> wrote:
Chris Angelico wrote:
When talking about indistinguishable objects, is it correct to talk
about "the " or "an "?
Example:
def f(s):
"""Frob a thing.
If s is an empty string, frobs all the things.
OR
If s is the empty s
Chris Angelico wrote:
> When talking about indistinguishable objects, is it correct to talk
> about "the " or "an "?
>
> Example:
>
> def f(s):
> """Frob a thing.
>
> If s is an empty string, frobs all the things.
> OR
> If s is the empty string, frobs all the things.
> """
Ethan Furman :
> On 07/27/2019 02:10 PM, Chris Angelico wrote:
>> When talking about indistinguishable objects, is it correct to talk
>> about "the " or "an "?
>
> Multiple indistinguishable objects are still multiple, so "an".
>
> Implementation details should only enter the conversation when
> s
29 matches
Mail list logo