On May 7, 3:18 pm, Marcel Hellkamp <
m...@gsites.de> wrote:
> Am Donnerstag, den 06.05.2010, 12:48 -0700 schrieb Roman:
>
> > May I ask to add ability to specify default value for MultiDict.getall
> > method?
>
> Perhaps, but do you really need this? MultiDict.getall() returns an
> empty list on a missing key. Empty lists have a negative boolean value,
> so you can do the following:
>
> default = ['Default','Values']
> for value in request.POST.getall(key) or default:
> print value
>
> I find this more natural and explicit than an additional getall()
> argument. And there is another benefit: The right part of an 'or'
> statement is not evaluated if the left part is true. You can use an
> expensive function call on the right side and don't have to worry about
> wasted time if the default value is not needed.
:-). I am still not comfortable with such construct. The proposed
containers. They have a different "get item" interfaces.