Re: [myhdl-list] Proposal: SignalType symbol
Brought to you by:
jandecaluwe
From: Tom D. <TD...@Di...> - 2010-06-09 19:26:07
|
Jan, I have lost track of the changes to MyHDL in the last year or so but just happened to get tripped up over this a week or so ago. I had to go into some of my old code and change: if isinstance(x,Signal) : to: if isinstance(x,type(Signal(0))) : I am assuming this is the same issue. My question is, what advantage does a factory function bring? I am much more familiar with classes. Tom On Wed, 2010-06-09 at 21:02 +0200, Jan Decaluwe wrote: > In the development branch 'Signal' has become a factory > function instead of a class. > > I had complaints about this before, in particular from > Chris Felton. To test whether something is a Signal > instance, it currently means you have to check whether > it is a 'myhdl._Signal' (a "hidden" symbol) instead of > a 'Signal' as previously. Not really nice, a user should > never have to refer to hidden symbols. > > In a project, as a user, I now have a need for this myself, > so ... :-) I want to keep the factory function Signal, > but I propose to define a visible symbol 'SignalType' > for the type. This is in line with Python conventions > for type naming. Then you could do: > > from myhdl import * > ... > if isinstance(a, SignalType): > ... > > > Any remarks? > > Jan > > -- > Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com > Python as a HDL: http://www.myhdl.org > VHDL development, the modern way: http://www.sigasi.com > Analog design automation: http://www.mephisto-da.com > World-class digital design: http://www.easics.com > > > ------------------------------------------------------------------------------ > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > myhdl-list mailing list > myh...@li... > https://lists.sourceforge.net/lists/listinfo/myhdl-list > |