Got bitten by Python’s default parameters?

Python’s default parameters are very convenient to use. Python programmers usually get bitten (once) with the fact that in Python functions are first-class objects and default parameters are kind of “member data”. So this would happen:


def foo(a=[]):
    a.append(5)
    return a
>>> foo()
[5]
>>> foo()
[5, 5]
>>> foo()
[5, 5, 5]
>>> foo()
[5, 5, 5, 5]

The detailed explanation of why this is happening could be found here and here.

But just keep in mind that the best way to not fall in to it, would be:

def myfunc(value=None):
    if value is None:
        value = []
Advertisements

Deploying digital cross-connected systems

This is an old article which my colleagues(@jmarchadier and Stephen Watson) and I wrote for Ubi’s Engine Room Blog.

Here is video on what the service is all about.

p.s.: My silhouette is in the video as well.

My 2 Cents on HTML5 vs Flash web Games

I totally agree that HTML5 is a strong choice for web-based gaming in the future, but I believe that’s not the case for the present.

I attended a talk in GDC-Online where the title was:
“Creatively Bypassing the Limitations of HTML5 as a Gaming Platform”. [Available at GDCVault]

HTML5 offers variety of tools for the game development, but as you can guess from the title they are not easily achievable, you have to do some tricks to get them working, could it be for 3D, Shading, WebGL, Audio Streaming and so on and so forth.
In HTML5 era, consistency across browsers is a big concern. When it comes to the details, each browser has different implementation and yet they are doing some experiments; adding and dropping some features and APIs.

Even if we take IE out of the question, there are still some solutions working only with WebKit, or only with Firefox…

Adobe is taking a right choice and pushing both worlds, Flash and HTML5. I think they both will exist for a long time.

Adobe using Adobe AIR is now able to compile native apps for Android and iOS (and windows phone in future). This is amazing.

I have done a test using Three.js for mobile. A simple rotating 3D object, it’s really disappointing. Working on Android for 3-4 FPS and not working on iOS at all.
Instead AIR compiled mobile app of a very similar 3D rotating object, is very smooth on both Android and iOS.

To me HTML5 is very nice, lots of feature and very bright future. But still has to mature (specially as a gaming platform).

Flash is consistent across platforms, and lots of tools for development. Also something else that I wanted to point out is their new Profiling Application “Adobe Scout”, which is an amazing tool to profile your Flash App either on desktop or mobile. Not only frame by frame but also, per movie clip and you can drill down to the point to see what’s taking memory or CPU. This is a big advantage especially for game development. (http://gaming.adobe.com/technologies/scout/)

As a fan of both, I think each has their own advantages and disadvantages. Just don’t be bias and pick the right one for your needs. Don’t go for what the buzz is.

p.s: Adobe has dropped the XC APIs as a Premium Feature, and now they are available to all the developers and there is no loyalty.
“””As of January 2013, Adobe is no longer classifying the XC APIs as a Premium Feature. The XC APIs are now available as a standard feature without requiring a separate license agreement with Adobe, nor royalties.”””