quick newbie syntax question

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Mon Oct 20 18:21:41 EDT 2008


On Mon, 20 Oct 2008 12:24:14 -0700, Robocop wrote:

> oops!   Sorry about that, i should have just copied my code directly. I
> actually did specify an int in range:
>> > year = '2008'
>> > month = '09'
>> > limit = '31'
>> > for i in range(1,int(limit)):
> 
> The code is currently failing due to the syntax in the filter,
> particularly the section "date = year'-'month'-'i"

Name binding ("date = something") is not an expression and must be on a 
line of its own. So you can't do something like:

function(y=x+1, 2, 3)

(Except of course for function default values, which is not quite the 
same thing.)


-- 
Steven



More information about the Python-list mailing list