Re: Diving into python, some questions...

Date : Thu, 24 Aug 2006 10:55:49 -0700
To : XSI(at)Softimage.COM
From : "Steven Caron" <carons(at)gmail.com>
Subject : Re: Diving into python, some questions...
right on guys, thanks for you support...

I hope to write down all my python/XSI hurdles so others can adapt faster

steven

On 8/24/06, Bradley Gabe <withanar(at)stanwinston.com> wrote:
Python will definite become fun, especially once you get into more
Object Oriented Programming (OOP). For example, see Bernard's OOP
approach to data handling on the XSI Wiki.

Because Python Objects also come with a nice set of predefined functions
and structure, and because the language requires you to format your code
in a consistent manner, more things to look forward to:

-Auto documentation: If you use triple quote commenting in your Python
functions, there is a Python command that auto generates html-linked
documentation of your stuff. No extra work or commenting markups
required!

-Dynamic Objects: Objects that look at current conditions and change
their available methods and properties accordingly.

-Object Factories: Objects that generate variations of new objects.

Anyone else care to help finish this list?

My main problem with Python is that I keep discovering cool new tricks,
and it's hard to resist the temptation to keep updating older code.

-Brad

> > i thought getting into python would be easier or at least more fun... I am
> > not having much fun at the moment, maybe someone can share some insight.
>
> That will change. In Python it can only be fun.
>
>
>
> > I have read about the collection types in python. lists, dictionaries,
> > tuples great stuff. but in XSI i have noticed that sometimes i can use [ ]
> > brackets when indexing an XSICollection and I can also use ( ) as normal. i
> > shouldn't do that right?
>
> As Aloys, I'd stick with the XSI SDK convention. I remember someone (I
> think it's Guy) had to modify a whole bunch of scripts not so long ago
> for this very reason. A new version was released and somehow the []
> trick wasn't working anymore in place of collection lookup calls.
>
>
>
> > Does the extra collection types in python interfere with XSICollections?
>
> Not that I'm aware of.
> I have never tried to put a list-dictionary-tuple into an
> XSICollection, but the other way around works perfectly. That is, you
> can put XSICollections into a list-dictionary-tuple (although you
> can't use them as dictionary keys). I do that a lot for my XML
> read-write tools. Oh and btw, you can put any COM object (see below)
> in the Python native sequence types.
>
>
>
> > When a method returns an XSICollection is python interpreting that some
> > other way, maybe into its native collection types?
>
> It's interpreting it as a COM object of "XSICollection" type. With VB
> and JS the "COM object" part is irrelevant, but with Python it is
> exposed at all times. Anyone correct me if i'm wrong, but any *object*
> (ie class instance) provided by the XSI scripting API is a COM object.
>
>
>
> Btw, here is a summary of how to setup Python for XSI. I don't know
> how much useful it will be for you though, as you are already up and
> running:
> http://www.bernardlebel.com/wiki/index.php/3D:XSI_scripts/plugins:Bernard%27s_Tools_Installation_Guide#Python
> The relevant part are "How do I hack the pywin32 module?" and "How do
> I make "import" work?"
> This is intended for people who want to use my larger tools, but it's
> useful for those new to Python as well.
> Also check the Programming FAQ on XSI Base, lots of tips with Python.
> And don't forget xsi-blog.com!
>
>
> Cheers
> Bernard
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
> unsubscribe xsi

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.