On 30May2017 12:06, Peter Otten <__pete...@web.de> wrote:
Cameron Simpson wrote:
As written it should be a bit slower: to construct a set each member get
tested for presence. The cost is in making the set, not in searching it.
No, CPython is a bit smarter than that:
dis.dis('if m in {"1", "J
Cameron Simpson wrote:
> On 29May2017 01:17, Alan Gauld wrote:
>>On 29/05/17 00:12, Alex Kleider wrote:
>>> Would
>> if Month in {'January', '1'}:
>>>
>>> be even better? (regarding efficiency perhaps? Trivial point, I know,
>>> but just wondering.)
>>
>>If in doubt try it out and profile/ti
On 2017-05-29 16:08, Cameron Simpson wrote:
snip
BTW, in Python we tend to use named like "Fred" for classes (or
factories), and "fred" for regular variables. And "FRED" for things
that would be constants in other languages. Eg:
MAX_THINGS = 16
class Foo:
def FooBah(x):
return
On 29May2017 01:17, Alan Gauld wrote:
On 29/05/17 00:12, Alex Kleider wrote:
Would
if Month in {'January', '1'}:
be even better? (regarding efficiency perhaps? Trivial point, I know,
but just wondering.)
If in doubt try it out and profile/time it.
But I don't think it will make much diff
Alex Kleider wrote:
> On 2017-05-28 13:13, Mats Wichmann wrote:
>
>> FWIW, if checking for multiples, you could also write:
>>
>> if Month in ['January', '1']:
>
> Would
>
if Month in {'January', '1'}:
>
> be even better? (regarding efficiency perhaps? Trivial point, I know,
> but just
On 29/05/17 00:12, Alex Kleider wrote:
> On 2017-05-28 13:13, Mats Wichmann wrote:
>
>> FWIW, if checking for multiples, you could also write:
>>
>> if Month in ['January', '1']:
>
> Would
>
if Month in {'January', '1'}:
>
> be even better? (regarding efficiency perhaps? Trivial point, I
On 2017-05-28 13:13, Mats Wichmann wrote:
FWIW, if checking for multiples, you could also write:
if Month in ['January', '1']:
Would
if Month in {'January', '1'}:
be even better? (regarding efficiency perhaps? Trivial point, I know,
but just wondering.)
On 05/27/2017 06:14 PM, boB Stepp wrote:
> Hello Jalen!
>
> On Sat, May 27, 2017 at 4:19 PM, Jalen Barr wrote:
>>
>> In this code it always changes the PlaceHolder to 0 no matter what Month is
>> set to
>>
>> Month ="September"
>>
>> if Month == "January" or "1":
>> PlaceHolder = 0
>
> This
Hello Jalen!
On Sat, May 27, 2017 at 4:19 PM, Jalen Barr wrote:
>
> In this code it always changes the PlaceHolder to 0 no matter what Month is
> set to
>
> Month ="September"
>
> if Month == "January" or "1":
> PlaceHolder = 0
This must be written as:
if Month == "January" or Month == "1":
I am in Python version 3.6.1
On Sat, May 27, 2017 at 4:19 PM, Jalen Barr wrote:
> In this code it always changes the PlaceHolder to 0 no matter what Month
> is set to
>
> Month ="September"
>
> if Month == "January" or "1":
> PlaceHolder = 0
> else:
> print("Information Error")
> print(P
In this code it always changes the PlaceHolder to 0 no matter what Month is
set to
Month ="September"
if Month == "January" or "1":
PlaceHolder = 0
else:
print("Information Error")
print(PlaceHolder)
___
Tutor maillist - Tutor@python.org
To un
11 matches
Mail list logo