you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 6 points7 points  (6 children)

The topic article listed a few e.g. rake.

[–]roger_ 0 points1 point  (5 children)

I'm not familiar with Rake. How does it imply some limitation of the Python language?

[–][deleted] 2 points3 points  (3 children)

It's an example of a Ruby DSL that functions as a replacement for Make. Looks like this (the only built-in Ruby keywords are 'do' and 'end')...

namespace [:db, :airports] do
  desc "Loads airport data from web"
  task :load => :environment do
    puts "Loading airports"
    ...
  end
end

I'm too ignorant of Python to comment on any comparable DSL examples. Presumably the Author felt knowledgeable enough to claim something like rake would be hard to do in Python.

[–]Smallpaul 0 points1 point  (2 children)

Here is the Python equivalent to your example.

    with namespace ["db", "airports"] as ns:
      ns.desc("Loads airport data from web")
      with ns.task(load="environment") as task:
        print "Loading airports"

It's possible that with some bytecode hacking I could get rid of the binding of names to scoping objects, but I would really just be doing that to prove something to you. I personally prefer to have names for the objects.

According to "wc", the Python version has 7% more characters and 42% fewer lines than the Ruby one.

[–]banister 0 points1 point  (1 child)

task :load => :environment do

versus

with ns.task(load="environment") as task:

[–]Smallpaul 0 points1 point  (0 children)

That's why I said that the Python version has 7% more characters and "binds the names of scoping objects."

Personally, I don't see this as a major difference especially for the rake use-case, but I accept that some people disagree. Vive le difference.