On 2014-02-13 04:11, Steven D'Aprano wrote:
give_me_an_even_number()
= returns 42
give_me_an_even_number()
= returns 23
Hmmm. There's a bug in give_me_an_even_number(). How do I reproduce
that bug? What arguments do I pass? Oh, the same no-arguments as
for the working call.
Clearly,
On 2014-02-13 05:39, Tim Chase wrote:
def age(self, as_of=None):
if as_of is None:
as_of = datetime.date.today()
return as_of = self.dob
and of course I mean
return as_of - self.dob
which is what I get for typing in the dark and the - and =
keys are adjacent. :-/
-tkc
In article mailman.6824.1392265865.18130.python-l...@python.org,
Chris Angelico ros...@gmail.com wrote:
Whether it's a module-level function, a bound method, a closure, or a
callable object, a zero-arg function in Python always has some kind of
implicit state.
Sometimes, it has a *lot* of
On Fri, Feb 14, 2014 at 1:58 AM, Roy Smith r...@panix.com wrote:
In article mailman.6824.1392265865.18130.python-l...@python.org,
Chris Angelico ros...@gmail.com wrote:
Whether it's a module-level function, a bound method, a closure, or a
callable object, a zero-arg function in Python always
On Feb 12, 2014 9:16 PM, Steven D'Aprano st...@pearwood.info wrote:
On Tue, 11 Feb 2014 07:36:34 -0800, Travis Griggs wrote:
On Feb 10, 2014, at 10:30 PM, Steven D'Aprano st...@pearwood.info
wrote:
1. Parenthesis should not be required for parameter- less
functions.
Of
On Tue, 11 Feb 2014 07:36:34 -0800, Travis Griggs wrote:
On Feb 10, 2014, at 10:30 PM, Steven D'Aprano st...@pearwood.info
wrote:
1. Parenthesis should not be required for parameter- less
functions.
Of course they should. Firstly, parameter-less functions are a code-
smell, and
On Thu, Feb 13, 2014 at 3:11 PM, Steven D'Aprano st...@pearwood.info wrote:
Think about the difference in difficulty in confirming that
math.sin() of some value x returns the value 0.5, and confirming that
random.random() of some hidden state returns a specific value:
py assert
On 2014-02-11 06:30, Steven D'Aprano wrote:
You need to understand the difference between syntax and semantics.
This is invalid English syntax:
Cat mat on sat the.
This is valid syntax, but semantically wrong:
The mat sat on the cat.
This is both syntactically and semantically
On Feb 10, 2014, at 10:30 PM, Steven D'Aprano st...@pearwood.info wrote:
1. Parenthesis should not be required for parameter- less functions.
Of course they should. Firstly, parameter-less functions are a code-
smell, and ought to be discouraged. Secondly, even if you have a good
On Wed, Feb 12, 2014 at 2:36 AM, Travis Griggs travisgri...@gmail.com wrote:
OTOH, I’m not sure I’ve heard the parameters-less functions are a code one?
Is it just loose functions that you’re referring to? As opposed to methods
(which are just bound functions)? I could maybe accept that. But
Travis Griggs writes:
in fact, methods with long parameter lists are generally seen as
If you have a predicate with ten arguments, you probably forgot some
(heard long time ago over in the Prolog world).
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Feb 12, 2014 at 3:07 AM, Jussi Piitulainen
jpiit...@ling.helsinki.fi wrote:
Travis Griggs writes:
in fact, methods with long parameter lists are generally seen as
If you have a predicate with ten arguments, you probably forgot some
(heard long time ago over in the Prolog world).
On Feb 11, 2014, at 7:52 AM, Chris Angelico ros...@gmail.com wrote:
On Wed, Feb 12, 2014 at 2:36 AM, Travis Griggs travisgri...@gmail.com wrote:
OTOH, I’m not sure I’ve heard the parameters-less functions are a code one?
Is it just loose functions that you’re referring to? As opposed to
On 2/11/2014 11:19 AM, Travis Griggs wrote:
On Feb 11, 2014, at 7:52 AM, Chris Angelico ros...@gmail.com wrote:
So in that situation, the no-args call does make sense. Of course,
this is a call to a function that does take args, but it's accepting
all the defaults and providing no additional
On 10/02/2014 18:45, Rick Johnson wrote:
## START CODE ###
def foo():
# foo represents a patternless function
# or method that returns a Boolean value
# based on some internal test.
#
if 1==1:
return True
return False
On 2/10/14 1:45 PM, Rick Johnson wrote:
## START CODE ###
def foo():
# foo represents a patternless function
# or method that returns a Boolean value
# based on some internal test.
#
if 1==1:
return True
return False
On 10/02/2014 18:45, Rick Johnson wrote:
[...]
3. Implicit introspection is evil, i prefer all
references to a callable's names to result in a CALL
to that callable, not an introspection!
So, for example, none of
isinstance(x, myclass)
map(myfunc, range(10))
x =
On 2/10/14 4:12 PM, Rotwang wrote:
On 10/02/2014 18:45, Rick Johnson wrote:
[...]
3. Implicit introspection is evil, i prefer all
references to a callable's names to result in a CALL
to that callable, not an introspection!
So, for example, none of
isinstance(x, myclass)
On Tue, Feb 11, 2014 at 5:45 AM, Rick Johnson
rantingrickjohn...@gmail.com wrote:
if foo: # - forgot parenthesis!
print 'implicit conversion to bool bites!'
You also forgot the parentheses on the second line, and that's nothing
to do with boolification :)
ChrisA
--
On 2/10/2014 4:12 PM, Rotwang wrote:
On 10/02/2014 18:45, Rick Johnson wrote:
[...]
3. Implicit introspection is evil, i prefer all
references to a callable's names to result in a CALL
to that callable, not an introspection!
So, for example, none of
isinstance(x, myclass)
On Mon, 10 Feb 2014 10:45:40 -0800, Rick Johnson wrote:
## START CODE ###
def foo():
# foo represents a patternless function
Patternless? I have never heard that term before in this context. Do you
mean a parameter-less or argument-less function?
21 matches
Mail list logo