Is my Python better than your Python?

Board Discussion Number 5

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 5992 Views - Last Post: 15 January 2011 - 08:17 AM Rate Topic: -----

#1 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Is my Python better than your Python?

Post icon  Posted 13 January 2011 - 10:11 AM

*
POPULAR

Most people reading this post are familiar with cPython and have at least heard of Jython and/or IronPython. For any of you not famliar with them, Jython is an implementation of Python that will run on the Java Virtual Machine and IronPython is an implementation that runs on the .NET framework. For any of you wondering, the Python that most of us use (and is available from Python.org) is written using C. There are actually other implementations of Python such as:

  • ChinesePython - Yup, Python written in Chinese. Try to pretend that isn't a little sick
  • PyPy - Jumping recursion batman! Python running on Python! That's just madness. (Utilizes JIT compilation)
  • PyS60 - Python for Nokia's S60 software Platform. That's right, PyPhone!


I've used IronPython a little and I have to say I was impressed that I could use my Python scripts in conjuction with C#... easy and powerful GUI's anyone? Who else has used other implentations other than cPython? For what purpose? What did you think? Perhaps you feel like there's no reason to ever use a different implementation, if so, why?

For anyone who hasn't used another implementation, my "Challenge" to you is to try one! I recommend Jython or IronPython if you're not the adventurous type. For those of you willing to work a little outside the box, go for PyPy, it seems like a really fun implementation to play with. Of course maybe you'll want to try ChinesePython or Psycho.

Wikipedia's listing of Python Implementations

This post has been edited by atraub: 13 January 2011 - 10:16 AM


Is This A Good Question/Topic? 5
  • +

Replies To: Is my Python better than your Python?

#2 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4498
  • View blog
  • Posts: 7,850
  • Joined: 08-June 10

Re: Is my Python better than your Python?

Posted 13 January 2011 - 10:23 AM

Quote

Is my Python better than your Python?


<creepy_joke>I'll show you my python if you show me yours.</creepy_joke>

But seriously, I'll be giving IronPython a shot, but for what, I have no idea. That's my problem with abstract challenges: I can't make myself do it without a clear goal.
Was This Post Helpful? 1
  • +
  • -

#3 LinuxFan  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 26
  • View blog
  • Posts: 82
  • Joined: 19-December 10

Re: Is my Python better than your Python?

Posted 13 January 2011 - 10:25 AM

Personally, I've tried Jython and liked it, but it lacked support for cPython libraries (e.g. things like pygame, but I suppose the standard Java libraries make up for that)
Another thing I disliked was that they dropped support for compiling the Jython code into Java bytecode :x
But the benefits, you have the whole Java library at your fingertips, with python syntax!

I originally tried it for portability, and it was pretty good... I personally disliked it because (iirc) the importing was weird for some libraries. Oh well.

Anyway, thanks for the link, I never knew things like Psyco and PyPy existed :) and I definitely am going to try IronPython eventually

This post has been edited by LinuxFan: 13 January 2011 - 10:29 AM

Was This Post Helpful? 0
  • +
  • -

#4 Motoma  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 452
  • View blog
  • Posts: 796
  • Joined: 08-June 10

Re: Is my Python better than your Python?

Posted 13 January 2011 - 10:37 AM

PyPy is a pretty fantastic tool. You can actually use PyPy's toolchain to build custom JIT compiler for the subset of the language you use, or create your own bytecode! Take a look at this interesting example if I've piqued your interest: Creating a toy virtual machine with PyPy
Was This Post Helpful? 0
  • +
  • -

#5 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Is my Python better than your Python?

Posted 13 January 2011 - 11:04 AM

I'll give IronPython a try. I'll try calling my Python google translate script and using it to populate a Console application with information.

We'll see how it goes.
Was This Post Helpful? 0
  • +
  • -

#6 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: Is my Python better than your Python?

Posted 13 January 2011 - 11:19 AM

View PostinsertAlias, on 13 January 2011 - 11:23 AM, said:

<creepy_joke>I'll show you my python if you show me yours.</creepy_joke>


From now on, I'm consulting you whenever I want a better title. Darn I wish I named my post this!!



Motoma, that's really cool! I will definitely try to check it out after work.

This post has been edited by atraub: 13 January 2011 - 11:24 AM

Was This Post Helpful? 0
  • +
  • -

#7 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: Is my Python better than your Python?

Posted 13 January 2011 - 11:29 AM

I personally don't know anything about Python at all. I wouldn't mind learning it sometime soon if I could find the time. Any suggestions on a good place to start?

EDIT: Given my .NET background, I'd have to say that I'd be trying out IronPython.

This post has been edited by Kilorn: 13 January 2011 - 11:30 AM

Was This Post Helpful? 0
  • +
  • -

#8 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: Is my Python better than your Python?

Posted 13 January 2011 - 11:32 AM

I'm sure you can find some helpful Python resources somewhere... but why not play with some IronPython due to your background in .net? :walkman:
Was This Post Helpful? 1
  • +
  • -

#9 Kilorn  Icon User is offline

  • XNArchitect
  • member icon



Reputation: 1356
  • View blog
  • Posts: 3,528
  • Joined: 03-May 10

Re: Is my Python better than your Python?

Posted 13 January 2011 - 11:34 AM

Looks like I added the edit while you were typing that message. Good timing.
Was This Post Helpful? 0
  • +
  • -

#10 Simown  Icon User is offline

  • Blue Sprat
  • member icon

Reputation: 319
  • View blog
  • Posts: 650
  • Joined: 20-May 10

Re: Is my Python better than your Python?

Posted 13 January 2011 - 11:43 AM

I have heard of all of them but I never thought to give any a go really. This year I have learned a lot more Java so, I will be trying out Jython soon.

Surely there is generally more support for 'normal' python?

I am aware you can write C and other extensions to python, but what is the benefit of Cpython over say C extensions with a interface/wrapper? Are they the same?
Was This Post Helpful? 0
  • +
  • -

#11 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: Is my Python better than your Python?

Posted 13 January 2011 - 12:07 PM

I think Motoma or baavgai would be able to answer this one better than I could.

Another edit:
Can't forget or Dogstopper

This post has been edited by atraub: 13 January 2011 - 12:17 PM

Was This Post Helpful? 0
  • +
  • -

#12 fuzzylunkinz  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 8
  • View blog
  • Posts: 185
  • Joined: 11-November 08

Re: Is my Python better than your Python?

Posted 13 January 2011 - 12:13 PM

I have never used anything other than good ol' Python for a couple of reasons, pretty much only for my personal taste.

First, most of the built-in functions written in C, which you pretty much try to use as much as you can to make your program faster, are well suited to go along with the Python syntax. I suppose it's more of a flow thing than anything else. Adding libraries from other languages just seems messy to me. After all, I'm very picky about programming style and one of the reasons I use Python is because of the way you have to use it (tabbed code etc).

The second and definitely much less meaningful is that pretty much every linux system I use there is already a Python implementation on it -- you can't say the same about Mono, .NET, or Java. I might end up trying IronPython for Windows just to see what it's like.

But, again, it's mostly a personal thing.
Was This Post Helpful? 0
  • +
  • -

#13 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5846
  • View blog
  • Posts: 12,705
  • Joined: 16-October 07

Re: Is my Python better than your Python?

Posted 13 January 2011 - 12:53 PM

View PostSimown, on 13 January 2011 - 12:43 PM, said:

I am aware you can write C and other extensions to python, but what is the benefit of Cpython over say C extensions with a interface/wrapper? Are they the same?


Yep, sounds the same. To be clear, when we say "Python" it's cPython we're talking about, unless otherwise stated. The only reason to say cPython is because because JPython ( now Jython, don't ask me why ), enjoys a great deal of popularity.

Python is, among other things, an exceptional C wrapper. An excellent language on it's own, it's the ability to easily integrate existing C libraries that gives Python a tremendous amount of its utility. If I simply want to use a library's functionality and python has a wrapper, I'm probably using python. import DamnNearEverything

I've tried IronPython. I had a quick Python script I needed in Windows world and thought it would be worth a spin. Sadly, all those C libraries that make Python so useful aren't available. Sure, I can write .NET Python code, but I can write .NET code in C# without any barriers, so it hardly seems worth it.

Jython is similar. You get to play with syntax, but you're ultimately in the sandbox of the language you're using.

I've yet to find occasion to reach for the non python pythons. I'm curious if anyone has found a place in their heart for the beasts.
Was This Post Helpful? 3
  • +
  • -

#14 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4498
  • View blog
  • Posts: 7,850
  • Joined: 08-June 10

Re: Is my Python better than your Python?

Posted 13 January 2011 - 01:12 PM

Quote

Sure, I can write .NET Python code, but I can write .NET code in C# without any barriers, so it hardly seems worth it.


It's only worth it if you like Python better than C#, or know Python significantly better.

I guess the measure of a language isn't always the syntax, but often the tools and libraries available to it. Knowing IronPython may not be all that helpful to you when you need to go write a cPython program, because while you know the syntax, you have no experience with any of the libraries at all.

Oh, @atraub, I wish I were able to answer Python questions. It's the language I'd be learning right now if I was going to be learning anything, but I just don't have time for it. I really don't know much, but I like hanging out in the discussion threads :P

This post has been edited by insertAlias: 13 January 2011 - 01:14 PM

Was This Post Helpful? 0
  • +
  • -

#15 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2874
  • View blog
  • Posts: 11,032
  • Joined: 15-July 08

Re: Is my Python better than your Python?

Posted 13 January 2011 - 01:39 PM

atraub, YOU know more than I do on Python. :P It's just a hobby of mine. Most of my money comes from web development.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2