[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Feb 12, 2014 9:16 PM, "Steven D'Aprano" <steve at 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 <steve at 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 > >> reason for using one -- for example, random.random -- then the > >> difference between referring to the object and calling the object > >> should be clear. > > > > Interesting. Can you clarify or provide some links to the > > "parameter-less functions are a code-smell" bit? > > > Functions map a value to another value. They can be one-to-one, or many- > to-one. (Mathematically, they cannot be one-to-many or many-to-many, > that's called a relation.) What about zero-to-one? > > If the function always returns the same result, e.g.: > > def spam(): > return "spam spam spam" That's still one-to-one. There is no such thing as a zero-to-one mapping. Mathematical functions map a single value to a single value. To represent multi-argument functions then, the single input takes on the value of an ordered sequence. The input value of a 0-argument function then is the empty sequence. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-list/attachments/20140213/4ae5b109/attachment.html>

- Prev by Date:
**A curious bit of code...** - Next by Date:
**Working with the set of real numbers** - Previous by thread:
**PyWart: More surpises via "implict conversion to boolean" (and other steaming piles!)** - Next by thread:
**[RELEASED] Python 3.3.4** - Index(es):