New submission from anatoly techtonik <techto...@gmail.com>:

This is self-explanative. Function definitions are identical. Syntax error 
caused by the absence of empty line after the function definition.

Python 2.7.1 (r271:86832, Apr 12 2011, 16:16:18) 
[GCC 4.6.0 20110331 (Red Hat 4.6.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os

>>> def get_size(start_path = '.'):
...     total_size = 0
...     for dirpath, dirnames, filenames in os.walk(start_path):
...         for f in filenames:
...             fp = os.path.join(dirpath, f)
...             total_size += os.path.getsize(fp)
...     return total_size
... 
>>> print get_size()
1595969238
>>> def get_size(start_path = '.'):
...     total_size = 0
...     for dirpath, dirnames, filenames in os.walk(start_path):
...         for f in filenames:
...             fp = os.path.join(dirpath, f)
...             total_size += os.path.getsize(fp)
...     return total_size
... print get_size()
  File "<stdin>", line 8
    print get_size()
        ^
SyntaxError: invalid syntax

----------
messages: 144278
nosy: techtonik
priority: normal
severity: normal
status: open
title: syntax error when pasting valid snippet into console without empty 
string after the function def
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13008>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to