On Sun, 14 Oct 2012 05:33:40 +1100, Chris Angelico wrote:
Have you actually programmed before?
> Forcing programmers to work in one particular style is usually not the
> job of the language/framework/library.
I've never come across a language/framework/library that DOESN'T force
programmers to work in a particular style, at least to some degree.
Every language encourages certain styles, discourages others, and makes
some impossible. Remember using PEEK and POKE commands with BASIC back in
1978? Pretty much impossible in Python. Perl probably has a way to do it
*wink* but few others do, and thank goodness we've moved on.
The sort of code you'll write in Fortran77 will be significantly
different from that you'll write in Lisp or Java or Forth or Ocaml.
Languages don't just differ in syntax, they differ in what they consider
good idioms, or even *possible* idioms. Hence:
Can you write "Java in Python"? Well, to some degree you can. Any Turing
complete language can be written in any other Turing complete language,
with sufficient layers of indirection, modulo things which are completely
impossible. You simply cannot do C-style pointer manipulations in Python,
not without breaking out of Python (e.g. with ctypes).
Libraries and frameworks are in a similar boat. Can you write CherryPy in
Django? Not easily. Generally the way to ignore a framework or library
and write in a different style is to, well, ignore the framework or
library and write in a different style :)
You can always step outside the bounds of the framework or library and
write something in the programming language level. Just because numpy
doesn't have some function I want, doesn't mean that I can't write it in
Python -- and just because numpy wants to work with arrays doesn't mean I
can't insist in using XML for my data, provided I convert it into an
array each time I pass it to a numpy function and back to XML when it
(For my next trick, watch as I eat three pounds of high-level radioactive
Now clearly some frameworks are lighter than others, some impose their
style on your code like a big heavy weight on a rubber sheet, distorting
everything for miles around. Others not so much. But I really don't see
the problem here: if you don't like the "Twisted style" that it imposes,
don't use Twisted, use another framework, or no framework at all.
I think it is a *good* thing that different languages/frameworks/
libraries have their own styles. The alternative isn't "many styles" but
"one style": an unstylish mess.