On Apr 20, 6:54 pm, Dan Bishop <[EMAIL PROTECTED]> wrote: > On Apr 20, 11:42 am, Matthew Woodcraft > > > > <[EMAIL PROTECTED]> wrote: > > Christian Heimes <[EMAIL PROTECTED]> wrote: > > > >> I feel that including some optional means to block code would be a big > > >> step in getting wider adoption of the language in web development and > > >> in general. I do understand though, that the current strict indenting > > >> is part of the core of the language, so... thoughts? > > > Why should Python repeat the mistakes other languages did with SSI or > > > <?php ?> inline code? Python favors the MVC separation of code and layout. > > > An alternative scheme for describing the block structure could be > > useful in other cases, though. For example, if you wanted to support > > putting snippets of Python in configuration files, or spreadsheet > > cells. > > > There's no need to support the new scheme in .py files, so it seems to > > me that this doesn't have to be done in the core language. All that's > > needed is a variant of 'eval' which expects the alternate scheme, and > > that could be prototyped just using text manipulation and the normal > > 'eval'. > > We wouldn't even need that. Just a new source encoding. Then we > could write: > > # -*- coding: end-block -*- > > def _itoa(num, base): > """Return the string representation of a number in the given base.""" > if num == 0: > return DIGITS[0] > end if > negative = num < 0 > if negative: > num = -num > end if > digits = [] > while num: > num, last_digit = divmod(num, base) > digits.append(DIGITS[last_digit]) > end while > if negative: > digits.append('-') > end if > return ''.join(reversed(digits)) > end def
A great example of why something like this would never fly in standard Python. -- http://mail.python.org/mailman/listinfo/python-list