[C++-sig] Two Pyste suggestions
nicodemus at globalite.com.br
Tue Sep 30 06:10:16 CEST 2003
Niall Douglas wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Yeah, more ideas!
>The first is a bit radical. I've organised the policies for my
>project into a python package called "Policies". Within it is a .py
>file for every class in my library and within each of those is an
>In the pyste files, each class imports its policy from
>Policies.<classname> and calls Policies.<classname>.apply(). This in
>turn imports the policy .py files for each of the base classes the
>class inherits from and calls their apply() methods first before
>setting its own policies for its own local class. Thus you see a
>change to a base class automatically propagates through the policy
>Now my suggestion is that since pyste knows what classes any class
>inherits, it could spit out the import's and apply()'s for each
>policy for class. It would save some work (I've already done it
>manually, wish I'd thought of it sooner).
Unfortunately, Pyste at that point (while executing the Pyste files)
doesn't know anything about the bases. For that matter, it doesn't know
any details about the class. The header file will be parsed only later,
when the code is about to be generated. To implement something that
would allow you to do what you want, all the class information should be
avaiable as you execute the Pyste file, ie, a Class(...) would return an
object with the methods, bases, etc, of the C++ class, which doesn't
happen right now. But I plan to make a change like that in the future,
so we can think about how to integrate a facility that would make it
easy to do stuff like you want.
>The second suggestion was as I made last time, a --files parameter to
>specify a file from which to read the list of pyste files as Win2k
>has a 2Kb limit. I've attached the pyste.py file for an example.
Sure thing, it's in my TODO list. It should be ready tomorrow, with some
updated documentation (at last!).
Thanks for the feedback!
More information about the Cplusplus-sig