On Fri, Jun 11, 2010 at 05:29:50PM -0400, tedd wrote:


> As for the Python "print" problem, I don't do Python -- so, it can
> win the lottery, or die, I don't care.

The issue, as I recall, is that for Python 3, they are changing print
(without parentheses) to require parentheses. This change alone (and
there are others like this in Python 3) will necessitate a *lot* of code
rewrites. Sometimes I wonder about Guido van Rossum.

> As for "don't embed a variable into a literal string and use
> preprocessing", as I said above, I often do this:
> <?php echo("The answer is $answer");?>
> and find no problems whatsoever in doing so.
> However, I wouldn't do this:
> <?php echo 'The answer is '.$answer; ?>
> OR, I would place a space before/after the . (i.e., 'The answer is '
> . $answer). However, I don't like doing that because I also program
> in other languages, which use the dot operator differently.

I tend to do it the way Tedd does, but I'm rethinking this. I recently
had occasion to do a lot of programming in C and Python, and one thing
stood out at me: I can't recall another language which allows
interpolation of variables within strings (without significant diddling,
if at all). It caused me great difficulty because I'm so used to doing
this in PHP. I can convert from '.' to '+' (as in most languages) in my
mind, but embedding variables in strings was a harder habit to break. My
opinion is that the dot operator used this way was a mistake for
PHP. Not using the dot operator to mean "concatenate" would mean we
could use it to replace the accursed '->' for class/method selection.
And the plus operator is obviously a more natural fit for string

And yes, if you're going to use the dot operator, surround it with
spaces for readability.


Paul M. Foster

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to