Slashdot Mirror


Python 2.2 Released

742Evergreen writes: "Another Christmas present for the developers: Python 2.2 has been released! A 'What's new' can be found here. Python 2.2 can be found here. Documentation is here."

19 comments

  1. Too late by PurpleBob · · Score: 2

    Normally I'd be excited that Python had a new release with lots of new features... but no longer. Ruby has stolen my heart.

    --
    Win dain a lotica, en vai tu ri silota
  2. nice 1, thanks guys by DrSkwid · · Score: 1

    i'm looking forward to experimenting with generators and yield

    i already love python in functional programming mode

    well do Guido & the guys

    Meryy Chrismarse

    --
    There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    1. Re:nice 1, thanks guys by nosferatu-man · · Score: 1

      > i already love python in functional programming mode

      It'd sure be nice if Python had useful lambdas, though.

      Peace,
      (jfb)

      --
      To spur "enterprise Linux," Big Bang, the distributed two-phase commit.
    2. Re:nice 1, thanks guys by __past__ · · Score: 1

      What's wrong with them? Honest question, never had a too close look at them.

      However, Python + the "functional" module were one of the reasons for
      me to try O'Caml, which makes a very nice complement where speed
      matters more (also, type checking and generally more "strictness" are
      a Good Thing sometimes).

    3. Re:nice 1, thanks guys by crealf · · Score: 1
      It'd sure be nice if Python had useful lambdas, though.

      Python 2.2 has actually useful lambdas, they are created with the Python construct "def".

  3. MMMMM..... by Cheetah86 · · Score: 1

    MMMMM........ Unification of built-in types and classes. You can now inherit ints and lists and dicts etc as classes.

  4. Ruby plug by pong · · Score: 1

    If you like Python you will love ruby. Its syntax is imho much nicer and ruby is true OO. There are many technical reasons to like it, but the really great thing is how it is really easy to express yourself in. Unfortunately Ruby is not really as popular outside Japan as it deserves. Check out the pragmatic programmers book and give it a whirl.

    Pragmatic Ruby

    1. Re:Ruby plug by DrSkwid · · Score: 1

      Rudy's on my "Languages to learn" list

      there comes a point when you have to say "This one is for me, now to spend a long time mastering it" because you never explore all of the corners.

      I learn new techniques with every project in every lamguage I write in.

      I've nailed myself to python and php for my current phase (and I've got no choice but to keep up with javascript).

      Anyway I have a ruby question seeing as I don't want to spend the time to find out.

      can you do something like this :

      %class Foo :
      5 bar = "";
      % def __init__ (self, bar) :
      % self.bar = bar
      % def setbar (self, hoge) :
      % self.bar = hoge
      % return self
      % def getbar(self) :
      % return self.bar
      %
      %f = Foo("fred")
      %print f.setbar("shiela").getbar()
      shiela

      my point being that the . separated parts are evaluated left to right

      javascript has a similar approach

      sadly php doesn't and it's a source of frustration

      is ruby like that?

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    2. Re:Ruby plug by DrSkwid · · Score: 1

      bah, I was hitting preview in my mind

      pretend it looks right plz.

      :)

      .

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    3. Re:Ruby plug by pong · · Score: 1

      yep

    4. Re:Ruby plug by Anonymous Coward · · Score: 0

      Yep, its left two right. The ruby looks very similar. You don't need all of the self references within methods because the
      instance vars are flagged by @'s. Also, while you can explicitly use 'return' to return a value, the
      last statement value in the method becomes the return value for the method.

      class Foo
      def initialize(bar)
      @bar=bar; # @ flags an instance var
      end
      def setbar(hoge)
      @bar = hoge
      self ; # value of last statement is return
      end
      def getbar(self)
      @bar
      end
      end
      f = Foo.new("fred")
      puts f.setbar("shiela").getbar

  5. Python lambda weakness by nosferatu-man · · Score: 1

    > What's wrong with them?

    From the Python documentation:

    "[lambda forms] are syntactically restricted to a single expression."

    At least the language is lexically scoped now, which makes things slightly less difficult.

    Peace,
    (jfb)

    --
    To spur "enterprise Linux," Big Bang, the distributed two-phase commit.
  6. A language with even more class features by Kirruth · · Score: 1
    I'm really pleased to see that they have expanded and tidied up Python's approach to classes and inheritance.

    Although its not C++ or Perl (or perhaps because it's not) Python has always struck me as a very wonderful language, being very compact syntax-wise yet having a core containing some of the most powerful features of other languages e.g. OO and lambda functions. It's also got a very solid set of standard modules.

    The indenting stuff still throws me, sometimes, though ;)

    --
    "Well, put a stake in my heart and drag me into sunlight."
    1. Re:A language with even more class features by Samus · · Score: 1

      You know for me the indenting wasn't that big of a deal. I rather like it. The part I have the hardest time with is that you declare variables by assigning them and they don't have types because they are all just reference variables. I guess I'm just too stuck on int x and class y from more strongly typed languages. It seems to me that its too easy to make a mistake when your projects get large. For smaller stuff its great. I whipped out a script that parsed my apache log and created a few include files to display the number of code red hits I'd received in a matter of minutes. Now would I want to write an entire application in python? Probably not.

      --
      In Republican America phones tap you.
    2. Re:A language with even more class features by Waffle+Iron · · Score: 2
      It seems to me that its too easy to make a mistake when your projects get large.

      Let it go, man. Go ahead and make the mistake. Run your program. It will show you a stack frame dump and you'll have the problem fixed in 15 seconds. Life's too short obsess over parameter types.

      Python, Perl, Ruby, etc. have huge library collections that are easier to use and understand than most of those from strongly typed languages. Lack of strong typing is not holding them back. (You won't find many unchecked buffers, either.)

    3. Re:A language with even more class features by scotty · · Score: 1

      Well, Python is not a dynamic-typed language like PHP, and variables are actually quite strictly typed. However, just as you have mentioned, the references are not typed so that you end up with quite a lot of assert(type(foo) == types.IntType) in the code. That definitely bites when you need to integrate Python with some strong typed language, like passing stuff into CORBA or C extensions.

      But I disagree that Python is not suitable for large projects. In fact, I found it has good package/module structure (like Module-2/Pascal), and IMHO is easier to manage than header files in C/C++. In my current job, I'll say 75% of our financial planning software product is coded in Python.