On 22/12/2013 17:42, Keith Winston wrote:
On Sun, Dec 22, 2013 at 6:00 AM, mailto:tutor-requ...@python.org>> wrote:
But in Python 2, the parentheses aren't part of the function call,
because print isn't a function. So what do the brackets do? They are
used for *grouping* terms toget
On Sun, Dec 22, 2013 at 12:42:30PM -0500, Keith Winston wrote:
> The other part of my question was: how did you find that PEP? I started
> looking, and it seemed like I could have taken hours, even though I sort of
> knew what I was looking for. You must have had a reasonably efficient
> search st
On Sun, Dec 22, 2013 at 12:42 PM, Keith Winston wrote:
> The other part of my question was: how did you find that PEP? I started
> looking, and it seemed like I could have taken hours, even though I sort of
> knew what I was looking for. You must have had a reasonably efficient search
> strategy/t
On Sun, Dec 22, 2013 at 6:00 AM, wrote:
> But in Python 2, the parentheses aren't part of the function call,
> because print isn't a function. So what do the brackets do? They are
> used for *grouping* terms together.
>
> In the first line, the brackets group variable a, comma, myExample[a]
> tog
On Sun, Dec 22, 2013 at 11:14 AM, Steven D'Aprano wrote:
> That's the answer to your question: in Python 2, print is a statement,
> not a function. That has many consequences, but the relevant one is that
> statements don't require brackets (parentheses for Americans reading)
> around the argument
On Sun, Dec 22, 2013 at 12:43:46AM -0500, Keith Winston wrote:
> I've been playing with afterhoursprogramming python tutorial, and I was
> going to write a question about
>
> myExample = {'someItem': 2, 'otherItem': 20}
> for a in myExample:
> print (a, myExample[a])
> print (a)
>
> retur
I've been playing with afterhoursprogramming python tutorial, and I was
going to write a question about
myExample = {'someItem': 2, 'otherItem': 20}
for a in myExample:
print (a, myExample[a])
print (a)
returning
('someItem', 2)
someItem
('otherItem', 20)
otherItem
Which is to say, why