Python – What is the __future__ module?

I was asked an interesting Python question recently: what is the __future__ module?

If the __future__ (PEP that introduced __future__) module seems vaguely familiar to you, it is because I use it in most of my Python tutorial scripts and have briefly talked about __future__ in a few of my tutorials, but I have never really explained what it is.

You know how you must import sys in order to access the functions located in the sys module? The same goes for accessing the special items located in __future__. However, you cannot simply import the __future__ module like any other module. That is because __future__ backports standard functionality in future Python versions. Because making them standard at in a typical patch release may create breaking change (and breaking changes should never be made in a patch release), the Python developers instead a reference to the new feature in __future__ and waited to introduce the new standard behavior in a minor- or if it is a highly volatile change, major- release.

Continue reading “Python – What is the __future__ module?”

Advertisements

Filter Out Unwanted Files – Blender 2.6 API

Many of you are familiar with my work on the LDR Importer for Blender, how I adopted it am now the maintainer of the script, and how there are now two other developers working on it, not counting contributors.

In v1.1, the script receive some notable updates by me, rioforce, and the other developers. One of the changes made is the ability to filter out any non-LDraw models from the file browser. This has been on my wish list for a while, but I have not been able to find a simple implementation or documentation on how to do this.
Continue reading “Filter Out Unwanted Files – Blender 2.6 API”

LDR Importer Version 1.1.5 – Standards

LDR Importer v1.1.5 was released today. Thanks to MinnieTheMoocher‘s sharp eye, this intermediate release’s change log is only artificially small. The patches that went into the changes were actually quite large. Thanks to MinnieTheMoocher, the entire library layout should be supported, including unofficial, p/48, and the new p/8 folders. In addition, support for high-res and low-res primitives are supported, again thanks to MinnieTheMoocher. It was these patches that brought LDR Importer in better compliance with the LDraw Parts Library that gained this release the codename Standards.

This is an intermediate release because the development team is planning on performing major refactoring on the script in v1.2, and MinnieTheMoocher’s reports pushed back those plans (for the better, mind you). As it stands right now, we should begin the process in February. The plan of action is still under development.

You can get the newest release from GitHub!

-le717

LDR Importer Version 1.1 – The Working Quartet

LDR Importer v1.1 has been released! 😀

If you are thinking to yourself

What is this LDR Importer project le717 is announcing?

I can completely explain (naturally :P). This project was previously known as Blender 2.6 LDraw Importer. However, with the recent release of Blender 2.69, the incoming Blender 2.7 series, and in order to comply with the LDraw System of Tools bylaws, it has been renamed to LDR Importer. 🙂

So what is new aside from the name?

CTRC v1.3.0 + New Companion Website

Readers may recall me publishing a tool called Cycles Render Time Calculator (or CRTC for short) a while back. It was but a small little thing I wrote with the help of Rioforce to help us figure out approximately how long it would take to render his animations. Since then I have made minor updates to it but never really did anything with it (too many variables to create an accurate time, yada yada yada).

Continue reading “CTRC v1.3.0 + New Companion Website”

New Python Tutorial: with

It is Python tutorial time again! I have titled this one after the star of the tutorial:

with

“That’s a pretty odd name for a tutorial. What is that even supposed to mean?”

Seasoned Python programmers will immediately know what I am talking about, but beginners should be scratching their heads right now. This tutorial talks about a better way to open files for reading and writing and why you should always use this method. I will not rehash the entire thing here. You will have to read it for yourself.

If you are wondering what the inspiration was for this tutorial, it was the first-hand view of two brand new programs that used the older method. Fortunately, I was able to advise these new programmers on this matter, but it showed me that the most popular beginner Python tutorials do not teach this method. In that light, I have written this tutorial to shed some light on this awesome feature of the Python programming language. 🙂
-le717