On Wed, Jul 13, 2011 at 2:00 PM, Thomas Perl <[email protected]> wrote:
> Hi,
>
> 2011/7/12 Renato Araujo Oliveira Filho <[email protected]>:
>> My idea is in early stage then I would like to discuss with you is,
>> which is the best way to describe scenes in python?. I'm not a heavy
>> python user, then I'm not familiar with all python features, because
>> of that I want your opinions.
>>
>> My first try is something like that:
>>
>> class Rectangle1(Rectangle):
>>    anchors = Anchor(centerIn = parent)
>>    width = 800
>>    height = 480
>>    color = 'red'
>>    class Rectangle2(Rectangle):
>>        anchors = Anchor(fill = parent)
>> [...]
>
> I'm not sure if this a good idea. It kind of reminds me of gtkaml
> (something like QML for Gtk), which has two kinds of syntax (XML-based
> and "Gtkon"). There's not really an advantage to describing the
> structure in Python syntax (in reality, it seems like a disadvantage -
> see "Rectangle1" and "Rectangle2"; or are these supposed to be the
> object IDs?). On the other hand, a way that I see could be an
> advantage for Python developers using QML is to use Python code in
> code blocks, i.e.:
>
> Rectangle {
>  width: 100
>  height: 100
>  MouseArea {
>    onClick: {
>      import sys
>      print sys.argv
>    }
>  }
> }
>
> It would be great if one could write the code like this (maybe with
> all PySide types imported already for convenience) and then have some
> type of "compiler" which extracts the Python blocks, puts it into a
> class as member functions and replaces the code blocks in the QML with
> JavaScript code that calls the slots on the Python object (which has
> been exposed as context property).
>
> Just my 2 cents ;)
>
> HTH.
> Thomas


One of the big advantages of python in my eyes is we can finally get
rid of those annoying braces for statements.  I think a solution that
brings back the braces would go against using python in the first
place.

Can the language even handle braces in statements properly?  Braces in
statements are ignored, and in common usage braces are only used for
making dictionaries.  In fact the syntax you show is pretty much
identical to the syntax for making dictionaries, which I think would
be confusing to users familiar with python and would make reading code
much harder.

-Todd
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to