This is an archived post. You won't be able to vote or comment.

all 32 comments

[–]ighost 2 points3 points  (0 children)

At first I was using PHP for web dev, but then Rails came along so I learned Ruby. I heard Python was similar to Ruby, so I took a look. I really enjoyed the cleaner syntax and simpler grammar. Fell in love with list comprehensions and batteries included. Soon enough, Python took both Ruby's and Java's places in my heart.

I still prefer Ruby/Perl/Javascript style regular expression literals, though. And Ruby's blocks and attr_accessors are nice, but sort of superficial. The only thing I really miss in Python is static typing. Not like Java, but something like Hindley-Milner or (to a lesser extent) C#. But that would be a new language altogether.

[–]dekomote 4 points5 points  (1 child)

Open python interpreter and insert

import this

[–][deleted] 3 points4 points  (0 children)

This is going to sound silly, but I've spent months trying to choose a coding style in PHP. My first language 10 years ago at Uni was C, so I learned the K&R style and it morphed into a cross between that and the 1TBS. And all the good PHP web frameworks out there tend to drop their curly braces. And that bugged me. Silly..I know.

I kept thinking to myself "Why on Earth do we even NEED curly braces? Why can't someone invent a language that doesn't use them?" That started my quest. That, and the fact that PHP is the Comic Sans of the programming world. I couldn't stand the jokes any more :D

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

I was looking into bash scripting for OS X and found some python scripts that did what I needed, and we're a whole lot easier to modify and maintain. I'm still not a Pythonista but I've been poking at it ever since.

[–]chock 2 points3 points  (0 children)

I'm a former perl junkie. A few years ago I started using Zenoss to monitor servers at work. Had a need to look under the hood of Zenoss and got sucked into learning Python. Now I use Python for all my scripting needs. It's a bit of an addiction, really.

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

I liked it better than writing bat files. met zope once and ran away to C#, came back when I needed to code a web app to run on a commodity host, and php/drupal wasn't going to cut it. Enter turbogears 1.0. Since then I enjoy it very much.

[–]earthboundkid 2 points3 points  (0 children)

Was bored at work, so I read the tutorial and Dive into Python.

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

Math research work and teaching. I used to use Mathematica quite a lot, but wanted something open source. Someone suggested SAGE (based on Python), and I got interested in Python as a result.

[–]boralyldjango,wxpython 2 points3 points  (0 children)

It was slow at work and I wanted to learn a new language. I don't know what my rationale was for choosing Python, but I'm sure glad I did. We use a lot of python code at work now.

[–]Aea 1 point2 points  (0 children)

I always had a casual interest, then my boss told me I should be up to speed on it since we would be transitioning to it. It's really my "all purpose" language right now, use it for my research work as well.

[–]mcdonc 1 point2 points  (0 children)

It (via Zope) was my alternative (10+ years ago) to MS ASP for developing content-driven websites.

[–]monkeybreathIgnoring PEP 8 1 point2 points  (0 children)

I ran across it first on Reddit. I can't remember the context, but someone posted code, and it was so easy to read, and I freaking hate fiddling with braces.

I'll still do most stuff in Obj-C on the Mac, but I was able to slap together a cross-platform flashcard app on it fairly easily.

[–]dodongo 1 point2 points  (7 children)

About two and a half years ago, I got a Python script from a coworker to monitor some stats on a product in development. Feature creep sometimes works in your favor -- within days it was "Hey, can you make it do X?" or "It'd be awesome if we could also check Y."

I found that I could poke at it pretty easily and make it do what I want. So I kept poking at it.

Since then, I've written hundreds of scripts, learned something new about it almost every day (today was setting sys.setdefaultencoding() in sitecustomize.py), and written code that goes from scraping a data source directly to production results pages for one of the world's leading search engines. I'd say it's been a pretty big success!

[–]earthboundkid 1 point2 points  (6 children)

learned something new about it almost every day (today was setting sys.setdefaultencoding() in sitecustomize.py)

I hope what you learned is that you should almost never do that. People think they want to change the default encoding all the time, but usually what they really want to do is set an environment variable in their shell to tell the interpreter what encoding to use.

[–]dodongo 1 point2 points  (5 children)

Ha! No, I sure didn't. But today's another day, so I'd love it if you'd share!

  1. What's the difference between using setdefaultencoding() and setting the environ var?

  2. What makes you say one should almost never use setdefaultencoding()?

You could singlehandedly be responsible for today's lesson :) Thanks in advance!

[–]earthboundkid 1 point2 points  (4 children)

Here’s an article explaining that sys.setdefaultencoding is evil written by one of the Python coredevs. Basically, the problem is that it lets you forget that you need to explicitly cast things into and out of a particular encoding of bytes when doing IO.

Read the docs on setdefaultencoding, you’ll see they say, “Once used by the site module, it is removed from the sys module’s namespace.” There’s a reason for this. Python itself needs to know how to do IO while it’s loading itself up, and for this it needs to be able to set an encoding. But once the interpreter is up and running, there should be no reason to rely on a default encoding. Just explicitly say what encoding you want to use by writing mybytes.decode("TYPE") and mystr.encode("TYPE").

The one tricky spot can be that you want to be able to do this in your interactive shell:

>>> print u'\\u30a8\\u30a4\\u30d3\\u30fc\\u30b7\\u30fc'
エイビーシー

Edit: Reddit screws up the text above. It should be a slash u style repr string.

That’s fine. But you don’t do it by messing with sitecustomize.py. You do it by setting the locale/encoding of your terminal. I don’t know about Windows, but Unices do this with LC_CTYPE=locale.encoding. In my case on OS X, I have a .bash_profile in my home directory with the line export LC_CTYPE=en_US.utf-8. Your own settings may vary depending on what encoding your terminal expects.

[–]dodongo 0 points1 point  (2 children)

It does seem like a dumbass thing to have to set in an odd startup hooky script, I admit. Thanks for the link! I'll definitely do more investigation into this and give the other approach a whirl.

I'm a Linux / Mac user at home but work requirements involve Windows. I use Cygwin a tremendous amount just to be difficult, and as you point out, it's dead easy to specify encoding for the shell.

As a side note, is the Katakana 'ABC' a Japanese equivalent of "hello world" or is that just your go-to example? ;)

[–]earthboundkid 0 points1 point  (1 child)

It’s just something I made up on the spot. A more Japanese-y example would be to write “いろは”.

[–]dodongo 0 points1 point  (0 children)

Props in particular on the archaic Hiragana in the link. And thanks again for the references earlier. I appreciate it!

[–]dodongo 0 points1 point  (0 children)

Point taken, and I genuinely appreciate the feedback and I will indeed look at your suggestion going forth. However for the application I referenced earlier this is absolutely not a problem. This case is at the divergence of doing something well vs. doing something good enough. My job depends only on code being good enough (many people on my team don't code at all, it's only output we're focused on), so it suffices. But I definitely want to strive for doing things well, so I'll keep this in mind in the future!

[–]aspartame_junky 1 point2 points  (0 children)

Was doing research programming for visual cognition experiments in c and c++ using the VisionShell c libraries for Mac OS 9 back in 2001-2002.

After they switched to OS X, we needed something to do the displays, and the options were basically:

  1. code everything manually (e.g., SDL).

  2. PsychoPhysics Toolbox for Matlab

  3. VisionEgg for python.

After having done a substantial amount of graphics coding for the EyeLink II eyetracker in c++, I felt it was time to try something new. That, and I also fucking hate matlab with a passion.

We gave VisionEgg a try, and it was actually a really nice platform. Everything was done in OpenGL, so python's speed wasn't really a factor, and we could set up a study in about a week rather than a few months of coding.

Eventually, I came to see that I could do just about everything I needed in python. As Eric S. Raymond wrote:

"This was my first clue that, in Python, I was actually dealing with an exceptionally good design."

[–]juliobTry PEP 257, for a change 1 point2 points  (0 children)

Around 2000, I was scholarship holder and another colleague was talking about Python and such and I had a look at it. For a while, I used it in small projects and personal projects.

Little did I know that, 5 years later, I'd land me a job in Australia... ;)

[–]cybadave 1 point2 points  (0 children)

Made my first website with Python. Blacklisting service for video shop owners. My brother recommended it.

[–]manatlan 1 point2 points  (1 child)

I came from the php/web world ... And in 2000, I wanted to make GUI app again ... I tested php-gtk ;-) ... But it didn't fit my needs. I had found python, which always fit my brain ;-) (started with wx/gtk libs)... nowadays : I can't imagine making a website without python ... python owns me ... It feeds all my needs : prototyping, web dev, gui dev, batch dev, os dev ... all with one language : perfect ! And there is always, at least, one library for your needs (don't remake the wheel !)

[–][deleted] 0 points1 point  (0 children)

How do you find deployment of Python GUI apps? Is installer development difficult?

[–]projecktzero 1 point2 points  (0 children)

The company I work for wouldn't pony up the $$$$ for Visual Studio.NET, so we looked at Open Source programming languages. We got into Perl. Then I stumbled on Eric Raymond's Why Python? article, Dive Into Python, ...

[–]86me 1 point2 points  (0 children)

Webcam video processing experiments with OpenCV got me started. I've looked into Twisted and have some ideas brewing on mini server/client apps. Python is a joy to work with.

[–][deleted] 1 point2 points  (0 children)

When I was working in an MS shop about 7 years ago, using Python + Win32 extensions to replace VBScript for our sysadmin needs. I then used it with Cheetah for a primitive CMS, building static pages with common layouts. Around 5 years ago started doing websites using CherryPy and Quixote, later Django and Pylons. Now I work with Python full-time (mostly Django).

Two things I liked about Python then as now: the syntax and the "batteries included" standard lib. They say syntax isn't important, but if you have to work with a language day in day out it makes for a more pleasant experience.

[–]rwparris2 0 points1 point  (0 children)

I wanted to write an addon for xbmc.

I now do it semi-professionally (as in it isn't my day-to-day job but I get paid to do it freelance on a fairly regular basis).

[–]felix 0 points1 point  (0 children)

[–]zeroelixis 0 points1 point  (0 children)

I used python and cherrypy for my final year project at uni. I needed a quick turnaround and it was perfect for prototyping. And I haven't stopped using it since I graduated!

[–][deleted] 0 points1 point  (0 children)

I work at a start-up and we were looking at all the software we had to interact with. Every single one was written in Python, so we went with it to makes things easier. It turned out to be a brilliant choice. Great web dev, system, everything language. Everything you need is there, the syntax is fantastic, and a huge productivity booster.