Advertisement

You're blocking ads, which pay for BlenderNation. Read about other ways to support us.

Python performance tips

6

python.jpgAnyone who's programmed in Python will tell you that it's often easy to write a script, but it's always hard to write an efficient script. This resource from the main Python wiki will teach you how to program for speed and performance.

The article covers many traps which people fall prey to when programming Python, such as repeating tasks too often, fetching too much data, and treating Python as if it were C. It shows how to recognize these mistakes when they occur, and how to fix them when they do. If you do any Python scripting, you should give this article a look.

6 Comments

  1. I have been using python for a while and wondered if there is better ways to do certain tasks, in several of the cases listed on that page I was doing it the slower way.

  2. What I would reeeaaaally like is a relatively easy way of adding python scripts to the Mac Blender distro. The current process [which involves hacking Finder and hunting blind for the right folder, then hoping that Blender accepts its existance] is an utter pig, which mostly doesn't even work.

    this makes using many funky new powers utterly frustrating at the very best of times. I mostly just give up.

  3. Ideasman42 (Campbell Barton) on

    @undeadbydawn, Iv heard of this, odd that the finder dosnt have it as a UI pref like linux/windows, otherwise why dont you set a user scripts directory in your prefs?

  4. I've been programming in Python since 2007 and I still feel like I'm struggling to overcome bad habits that I picked up when I learned PHP. Making too many unnecessary variable assignments is one of the things I do the most and should really avoid. Great tips in the wiki entry.

Leave A Reply

To add a profile picture to your message, register your email address with Gravatar.com. To protect your email address, create an account on BlenderNation and log in when posting a message.

Advertisement

×