Jump to content

bascule

Senior Members
  • Joined

  • Last visited

Posts posted by bascule

  1. I'm curious about Python, but I've been skeptical so far - what does it do that is difficult in other languages?

     

    Python has a real, full-featured object model, which includes metaclasses which not only provide a nice API for singletons but are also excellent for reflection. You can define methods in the metaclass which can be invoked in the body of subclasses, allowing you to generate code on-the-fly declaratively.

     

    What do you use that for? The same sort of thing you might use the factory pattern for in languages like Java. Rather than creating a FooFactory you can just call a method of the Foo metaclass which builds an appropriate object. Compare this Python pseudocode:

     

    obj = Foo.create_from_bar(bar)

     

    as opposed to some Java pseudocode:

     

    FooFromBarFactory factory = new FooFromBarFactory(bar);

    Foo obj = factory.newInstance();

     

    The code is both clearer and more concise.

     

    From what I can tell, it appears to have a lot of keywords and built in functions to handle various complex data types and has short hand syntax to perform tasks you would use functions for otherwise - but nothing you couldn't do with a library if so inclined.

     

    Again, having first class syntax for types like maps/dicts makes code dramatically clearer.

     

    So far it sort of reminds me of Perl, which is great for writing short crypto-code but for the most part is just an idiosyncratic way of doing with syntax what function patterns would do generally.

     

    Shorter code should improve clarity, not diminish it. Perl was a particularly egregious case of overly terse and confusing syntax. However in a discussion about Python it's a red herring.

     

    Using more code typically makes programs harder to read and more difficult to maintain. Java programs are typically ridden with tons of boilerplate code because the language lacks the features to abstract it away.

     

    Personally, I have been drawn to languages with the fewest possible keywords and syntactic rules and puts most of the functionality in well designed libraries written in the language.

     

    Sounds like you would love Lisp. Personally I prefer languages with rich, expressive grammars. I feel they make code both easier to write and read.

     

    I am genuinely curious because I've heard it recommended many times. On the surface it looks like an obscure syntax structure with a lot of top-level datatypes that would be suited to an STL implementation.

     

    Aieeeeeeeee! The STL is TERRIBLE! C++ is the only popular language which has to embed a Turing complete functional templating language, because without it the amount of boilerplate code you would have to write would boggle the mind. Templates make the language terribly confusing, and bely an inability to perform real metaprogramming like you can in a language like Python (or Ruby, Lisp, Smalltalk, Haskell, and many others)

     

    "Throw more code at the problem" is a terrible attitude. Every line of code I write for work is a line I have to maintain. More lines of code means more work for myself. I would rather create as little work for myself as possible. This doesn't have to come at the price of clarity, on the contrary, fewer lines of code should improve clarity in most cases.

     

    Your typical program in C++ or Java is going to be full of far more lines of code which don't express a solution to the problem but rather are just thunking around deficiencies of the language. This makes programs harder to read as you have to mentally skip over this code to read the actual solution to the problem.

     

    Python gets rid of all the boilerplate. It also has a dynamic type system which further reduces boilerplate needed for type thunking. Dynamic type systems make interfaces less brittle and allow you to preserve backwards compatibility in cases which simply aren't possible with static type systems.

  2. ·

    Edited by bascule

    I should explain that I don't have any modeling project in mind, per se.

     

    Learn Python. It provides a much more powerful model for describing most types of problems than C does. C requires you restate your problem in terms the CPU can understand, and "what the CPU can do" is typically an overcomplicated and error-prone model for describing most problems.

     

    If you feel Python is too slow, there are still lots of alternatives to C while still affording you high level, declarative descriptions of problems. OCaml is a fast, compiled mixed-paradigm language which is used for all sorts of performance critical modeling.

     

    I would recommend learning C after learning a higher level language. I think too many people start out with a language like C and end up with a "C shaped brain" that tries to model every program directly around the Von Neumann architecture. Learning a higher level language (particularly a functional one) will essentially require you relearn everything you know. I started out with a very heavy C background and it took me many years to move on. Nowadays I never write "for" loops (although they have their place in Python) and can't believe I wasted so much time writing them over and over again in C. There are better ways!

  3. I've been using this site for the past several months to track the polls:

     

    http://fivethirtyeight.com

     

    (538 is the number of electoral votes, btw)

     

    It was developed by a guy named Nate Silver who originally wrote a model for predicting baseball games called PECOTA. The model predicted the Rays would turn it around, going from losing 96 games to winning 90. They ended up winning 97. Who'da thunk it? PECOTA did.

     

    Now he's turned to predicting elections. His model runs 10,000 times a day, and analyzes the history of polls vs election results with a data set going back to the '50s.

     

    He predicts Obama has a 94.7% chance of winning... on election day.

  4. In other words, the DNA defines the proteins, while the protein, during cells cycle, postures the DNA, so the chromosomes can be differentiated to parallel the daughter cell proteins. The protein is the link to the environment and to the DNA. If the environment alters the protein grid, the new protein distribution will mold its DNA to reflect the change, during the next cell cycle.

     

    Oh for the love of god...

     

    READ:

     

    http://en.wikipedia.org/wiki/DNA_replication

     

    If you're going to bother posting on a science forum, could you actually take 5 minutes to research what you're about to post before instead posting your own completely warped view of reality?

     

    I mean, this is why we have science, so we can understand the workings of the world empirically and not have to venture thoroughly unempirical, retarded guesses which will undoubtably be wrong.

  5. This has been mentioned before, but with the debate over climate change raging, I'm really surprised there's not a forum dedicated to Climate/Atmospheric Science.

     

    Maybe I say that because I work for a climate modelling group...

     

    Anyway, I'd really like to talk about:

     

    - What climate forcings are truly anthropogenic in origin?

    - Is "global warming" a result of these forcings?

    - What climate change metrics should we truly be considering, especially when assessing a "global warming" trend?

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.