On 2019-02-16, Barry wrote:
> On 11 Feb 2019, at 20:00, Felix Lazaro Carbonell wrote:
>
>>> The most pythonic way is to do this:
>>>
>>> def find_monthly_expenses(month=datetime.date.today().month,
>> year=datetime.date.today().year):
>>>...
>
> This has subtle bugs.
> The default is calcul
On 11 Feb 2019, at 20:00, Felix Lazaro Carbonell wrote:
>> The most pythonic way is to do this:
>>
>> def find_monthly_expenses(month=datetime.date.today().month,
> year=datetime.date.today().year):
>>...
This has subtle bugs.
The default is calculated at import time and not at function
The first one is used very often. Less verbose
Le 11 févr. 2019 à 20:41, à 20:41, Felix Lazaro Carbonell
a écrit:
>
>
>Hello to everyone:
>
>Could you please tell me wich way of writing this method is more
>pythonic:
>
>
>
>..
>
>def find_monthly_expenses(month=None, year=None):
>
>
Felix Lazaro Carbonell wrote:
> Hello to everyone:
> Could you please tell me wich way of writing this method is more pythonic:
> def find_monthly_expenses(month=None, year=None):
>
> month = month or datetime.date.today()
> Or it should better be:
> if not month:
>
Grant Edwards wrote:
> On 2019-02-11, Felix Lazaro Carbonell wrote:
>
>> Could you please tell me wich way of writing this method is more
>> pythonic:
>>
>> def find_monthly_expenses(month=None, year=None):
>> month = month or datetime.date.today()
>>
>> Or it should better be:
>>
>>
tations or overrides, etc.
>
>
> -Original Message-
> From: Python-list [mailto:python-list-bounces+david.raymond=
> tomtom@python.org] On Behalf Of Felix Lazaro Carbonell
> Sent: Monday, February 11, 2019 2:30 PM
> To: python-list@python.org
> Subject: more py
On 2/11/2019 2:46 PM, Felix Lazaro Carbonell wrote:
def find_monthly_expenses(month=None, year=None):
month = month or datetime.date.today().month
Or it should better be:
if not month:
month = datetime.date.today().month
As a 20+ year veteran, I would be
lementations or overrides, etc.
-Original Message-
From: Python-list
[mailto:python-list-bounces+david.raymond=tomtom@python.org] On Behalf Of
Felix Lazaro Carbonell
Sent: Monday, February 11, 2019 2:30 PM
To: python-list@python.org
Subject: more pythonic way
Hello to everyone:
Could you
-Mensaje original-
De: Python-list [mailto:python-list-bounces+felix=epepm.cupet...@python.org]
En nombre de Grant Edwards
Enviado el: lunes, 11 de febrero de 2019 02:46 p.m.
Para: python-list@python.org
Asunto: Re: more pythonic way
On 2019-02-11, Felix Lazaro Carbonell wrote
Sorry I meant
..
def find_monthly_expenses(month=None, year=None):
month = month or datetime.date.today().month
..
Or it should better be:
...
if not month:
month = datetime.date.today().month
..
Cheers,
Felix.
--
https://mail.python.org/mailman
On 2019-02-11, Felix Lazaro Carbonell wrote:
> Could you please tell me wich way of writing this method is more pythonic:
>
> def find_monthly_expenses(month=None, year=None):
> month = month or datetime.date.today()
>
> Or it should better be:
>
> if not month:
>
Hello to everyone:
Could you please tell me wich way of writing this method is more pythonic:
..
def find_monthly_expenses(month=None, year=None):
month = month or datetime.date.today()
..
Or it should better be:
...
if not month:
month = datetime.d
On Dec 6, 12:19 am, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Fri, 05 Dec 2008 07:44:21 -0800, eric wrote:
> > I like to believe that the less the 'debug pointer' stands in the python
> > code, the fastest the code is (or is potentially)
>
> What's a debug pointer?
>
> Pre-
On Fri, 05 Dec 2008 07:44:21 -0800, eric wrote:
> I like to believe that the less the 'debug pointer' stands in the python
> code, the fastest the code is (or is potentially)
What's a debug pointer?
Pre-mature optimization is the root of evil in programming. Unless you
have actually *measured*
On Dec 5, 3:44 pm, "Mark Tolonen" <[EMAIL PROTECTED]> wrote:
> "eric" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
>
> > def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False,
> > DOTALL=False, UNICODE=False, VERBOSE=False):
> > vals = [IGNORECASE, LOCALE, MULTILINE, DOTALL
eric wrote:
Hi,
I've got this two pieces of code that works together, and fine
def testit():
for vals in [[i&mask==mask for mask in [1<', flag(*vals)
def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False,
DOTALL=False, UNICODE=False, VERBOSE=False):
vals = [IGNORECASE, LOCALE, MULT
"eric" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False,
DOTALL=False, UNICODE=False, VERBOSE=False):
vals = [IGNORECASE, LOCALE, MULTILINE, DOTALL, UNICODE, VERBOSE]
filtered = map( lambda m:m[1],filter( lambda m: m[0]
Hi,
I've got this two pieces of code that works together, and fine
def testit():
for vals in [[i&mask==mask for mask in [1<', flag(*vals)
def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False,
DOTALL=False, UNICODE=False, VERBOSE=False):
vals = [IGNORECASE, LOCALE, MULTILINE, DOTALL,
18 matches
Mail list logo