Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 Sep 2012
Offline Last Active Yesterday, 04:41 PM

Topics I've Started

Multiple heritage on python

06 July 2015 - 12:27 PM

I am having some trouble to understand python new format class multiple heritage. I have read quite a few documents and tried some codes, yet I can't really get how it works on some cases.


Looking at this code for instance:

class A(object):
    def x(self):
        print "X from A."

    def __init__(self):
        print "A here."

class B(object):
    def x(self):
        print "X from B."

    def __init__(self):
        print "B here."

class C(A, B):
    def __init__(self):
        super(C, self).__init__()
        super(A, self).__init__()
        print "C here."
        super(C, self).x()
        super(A, self).x()

c = C()

The output is:

A here.
B here.
C here.
X from A.
X from B.


So, it seems that calling super with "C" as the class will find the first of the parent class that has the method, and use that method (which is fine, IMO). The problem is if you want to call the init method of B class, you must call super(A, self).__init__(), instead of B. This really doesn't make sense to me.

It gets worse, if you call super(B, self).__init__(), it does nothing! No error, no warning, no function call, no nothing, is like the line is a "pass" statement.

And it gets even worse if you try calling the x method. If you want to call x from B, you use super(A, self).x, that is somewhat aligned with how you can B's __init__ method. But, if you try super(B, self).x(), you get an error:

AttributeError: 'super' object has no attribute 'x'

So my questions would be:


1) Why do you need to pass A to super to call B's methods? Would it be something like "start searching for a method after this point" or something?

2) Why calling __init__ passing B to super does nothing, but calling x raises an exception?


Thanks in advance.




I realised why the stroked text occour, it is looking for the methods on the object class.


Also, calling super with any other class name that is not the class itself makes pylint sad:

"E: 18, 2: Bad first argument 'A' given to super() (bad-super-call)"

I am not really sure why python would allow you to give an argument that can't vary, but pylint does complain about it, pyflakes doesn't say a thing.

Scene editor

18 June 2014 - 01:03 PM

So, I am creating a tile based scene editor (Yep, I hate myself).


I may be overthinking this, but I wanted to know some good features to implement in it, but I have run out of ideas. So far I have:

- Object copy (up, down, left right).

- Align to the grid.

- Movement with drag and drop.

- Increase/Decrease scale.

- Flip (horizontal and vertically).

- Delete object.

- Toggle grid.


The editor supports multiple selection and also implements an undo/redo feature.


I currently gave the scene editor as done and am working on a visual collision editor for the objects. still I am thinking I may be missing something. If you were to use a 2D tile editor, what features would you like to see on it?

Pirate RPG class design

08 April 2014 - 11:15 PM

Hi there, lately I have been thinking a lot of a pirate class design for a RPG system, but haven't really got much success.


Most of pirate classes you find around are designed as a swashbuckler fighting style, mostly using movement with ropes. Most also focus on using light and fast weapons or double guns, also they always focus on using light armor (since falling into the sea in a full plate would kill the wearer). In the end it tends to be mix of a rogue and a warrior, with no focus on stealth and heavy focus on high mobility and balance fighting style.


My problem with it is: assuming the world has magic all around, wouldn't it make sense that they have magic abilities to survive on the sea? Fighting with heavier armor would be a huge advantage (a great example of this are the iron born of the Song of Ice and Fire book series*), specially considering that heavy armored classes wouldn't be able to use it in the sea.


So far my concept would be:

- Medium armor wearing.

- Water and Wind magic (maybe ghost also? ghost ship spell would be nice).

- Ability to find treasures.


But that is it, while I see they using a spell to produce fresh water or change the course of the winds, I couldn't think of an interesting way to bring those spells to combat. So, I would love to hear other people opinion on this. How do you see pirates in a fantasy medieval world?


* In the book they use heavy armor, but they don't use any magic. They are just not afraid to die drowning, as they see it as a glorious death and believe that their afterlife will be in under the sea.

IndieDia competition

28 March 2014 - 07:58 AM

This was published in another community I am part of, so I am spreading the word in case anyone is interested, it is kind of a game jam (but with one month duration):


You can check the details here:




I am not an organizer or involved with it in any way, just posting here in case some indies may be interested, the prizes are quite cool for indie devs.


That is it, good luck and have fun =)


PS: We could have a forum for that kind of competitions, I saw kivy (ui framework) is going to have a contest, last one was a gaming contest, there are probably many more around the web.

Good pratices to publish code on github?

07 March 2014 - 12:37 PM

Hi there guys, I have two projects that I want to share on github and I was wondering what would be a good way to organize the project. Both projects are in C.


In the last days I have:

- Hidden the implementations that should be hidden.

- Improved the Makefile (for instance, it adds the -g flag when compiling).

- Created a .gitignore file.


I am still thinking if that is enough. What do you guys expect when you clone a github repository? Should I add some samples or the tests?