Quantcast
Channel: Python. Good, bad, evil -1-: Missing brace
Viewing all articles
Browse latest Browse all 20

trond at Sun, 21 Feb 2010 20:40:46 +0100

$
0
0
@php6 I am afraid you are mistaking "can" for "must" in Python's "code organization" (and PHP's for that sake). Your examples are just examples of how you MAY choose to do it. You don't /have/ to organize your Python code in such a way. And: you MAY use the same approach in PHP, if you really want to. Try it for yourself (PHP): function doSomething() { echo 'Inside doSomething() and ' . anotherOne(); } class MyClass { public function doIt() { doSomething(); } } $x = new MyClass; $x->doIt(); // prints "Inside doSomething() and I even got to anotherOne()!". function anotherOne() { return 'I even got to anotherOne()!'; } Perfectly valid PHP5. You can organize your PHP and/or Python code this way. Generally, I wouldn't recommend it, but you can. Nothing special about Python there. So there is no "flaw" in Python's code organization capabilities here. I bet there are tons of horrendous PHP scripts out there, if you want to look into bad PHP code organization. (I'm more of a PHPer than Python'er myself, and have seen my share of crappy PHP code). Of course, you'll observe differences when moving from one language to another. If you only know Lisp or Prolog you might feel that there are strange things going on in PHP as well. Or you may not. In any case, I believe we should listen to Uncle Bob's advice: "Languages are tools not religions. Superior attitudes taken by language zealots ring hollow before the craftsman's toolbox." http://twitter.com/unclebobmartin/statuses/9180866711

Viewing all articles
Browse latest Browse all 20

Trending Articles