Re: [Cheetahtemplate-discuss] Proposal: eliminate .addToSearchList and .prependToSearchList
Brought to you by:
rtyler,
tavis_rudd
From: <ja...@la...> - 2002-11-02 10:09:52
|
On Saturday 02 November 2002 02:53 am, Mike Orr wrote: > The problem with .add/prependToSearchList is not that they don't work, > it's that I don't like the idea of the searchList being mutable. > you control the template instantiation, it seems like an unnecessary > complication. If you don't control the instantiation, then it seems > doubly important that you don't add/delete searchList objects, because > then your changes leak into other portions of code you don't control, > and that violates the principle of encapsulation. ok, not sure i entirely follow you, so i'll just do as you say until i kn= ow=20 what you mean. ;-) what do you mean me control, you control? > I'm trying to prevent you from painting yourself in a corner as your > application gets bigger and more complicated with dozens of templates, > and it becomes difficult to keep track of which template instances have > object A added/prepended at which points in the code, and which don't. > That's the beauty of immutability. Like a tuple: > =09(myDict, myInstance) > you cannot add/delete elements from this tuple. But you can modify > myDict and myInstance as much as you like. If we make the searchList > immutable, there is *one* place you can quickly look -- the > instantiation line -- to see exactly what the searchList contains. And > you are guaranteed that it will never change (absent .append/.insert > shenanegans). ok, i think i'm following you there -- makes sense. > Actually, shall we just go all the way and make the searchList a > tuple in .__init__? Does Cheetah need to use list methods on it? are you saying, just to be really sure people don't use append/insert? su= re,=20 why not? I don't know, you guys are the smart ones. ;-) > Thanks. Your questions help us see what needs to be explained better > in the docs and future FAQ. Also, when you describe your real-world > situations and problems you have using Cheetah with them, it helps us > see how Cheetah can be improved. We are always looking to add features > that solve a general class of problem; that is, something a variety of > users will want. You may not even realize it at the time, but it may > turn out later that "your" problem was not just your esoteric > situation, but a fundamental weakness in Cheetah that you were the firs= t > to discover. cool how you kinda switched that around to thanking me for asking dumb=20 questions. sometimes people can be too nice, you know!! :-) > > i wish > > we had a #cheetah channel to get around the latency of the list > I don't do IRC, but if you start a channel on irc.debian.org maybe > you can convince others to participate. I prefer e-mail or the > phone. E-mail because you can collect your thoughts and then have > a message you can save in case it becomes useful later, and the > phone because you can discuss in thirty seconds what it takes > several minutes (and lots of carpal-inducing keystrokes) to type. i used to not do irc, but then i started doing stuff that seemed to have = a big=20 irc presence and a slight lack of adequate docs (ie, installing linux on=20 ipaqs) and i started to get into it. i still pretty much only pop in to a= sk a=20 question, but some people seem to live in irc. i usually hang out -- wel= l,=20 pop into when i need help ;-) -- irc.openprojects.net, in #python, #gen= too,=20 etc... (i kinda switched from debian to gentoo a few months ago, on serve= rs=20 and everything..) |