Re: text adventure game problem

2008-04-08 Thread Carl Banks
a dictionary of actions and a dictionary of movable objects. > Along with methods that work on objects... Working an action that digs > into other objects may take some doing. [snip] I don't know about you, but I usually start with specific cases like this and then generalize them. This could be a baby step, or merely a first stage of evolution. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a tuple to a list

2008-04-09 Thread Carl Banks
> --Brian > > --- > > Thanks Steve and Brian, > > Brian: that is !! > > However, it's a bit difficult to understand now. I have read it several > times :) A list comp is straightforwardly equivalent to nested for loops. To read, it may be easeier to write it out as loops: l = [] for z in t: for x in z: l.append(x) Which, you'll note, it the same as your working code only with different names. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: I am worried about Python 3

2008-04-10 Thread Carl Banks
appen. > The general consensus is that Python 3.x isn't much of an > improvement over the existing language. I'm going to have to opine that you pulled this out of your ass. > There's just not much demand for it. Well that's a little mode defensible seeing that w

Re: text adventure game problem

2008-04-10 Thread Carl Banks
ve to do something that doesn't fit the framework anticipated by the language designer. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Tremendous slowdown due to garbage collection

2008-04-12 Thread Carl Banks
h disk loading on demand could be a good choice. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: str(bytes) in Python 3.0

2008-04-12 Thread Carl Banks
guess." How do you know if the bytes are utf-8 encoded? I'm not sure if str() returning the repr() of a bytes object (when not passed an encoding) is the right thing, but it's probably better than throwing an exception. The problem is, str can't decide whether it's a

Re: str(bytes) in Python 3.0

2008-04-13 Thread Carl Banks
On Apr 12, 11:51 am, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 12 Apr., 16:29, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > And making an utf-8 encoding default is not possible without writing a > > > new function? > > > I believe the Zen in effe

Re: Java or C++?

2008-04-14 Thread Carl Banks
ansition to Java than to C++ from just about any starting point. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Tremendous slowdown due to garbage collection

2008-04-14 Thread Carl Banks
memory data structure won't be swapped--but a database solution should at least be considered here. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: text adventure game problem

2008-04-15 Thread Carl Banks
On Apr 11, 12:08 pm, "Neil Cerutti" <[EMAIL PROTECTED]> wrote: > On Thu, Apr 10, 2008 at 8:25 PM, Carl Banks <[EMAIL PROTECTED]> wrote: > > On Apr 10, 2:20 pm, Tommy Nordgren <[EMAIL PROTECTED]> wrote: > > > > On 9 apr 2008, at 03.01, [EMAIL PROTE

Re: py3k s***s

2008-04-16 Thread Carl Banks
m in > my opinion. And also a fiendish way to make code > inscrutible -- which I thought was more of a Perl thing > than a Python thing, or should be. > > I must be missing some of the deeper issues here. Please > educate me. The deeper issue is that you're benefiting from

Re: I just killed GIL!!!

2008-04-17 Thread Carl Banks
t it's not, by itself, a good thing. For the record, I am not complaining about that GIL. As I said, I understand and approve of why it's there. I am, however, complaining about attitude that if you want to be free of the GIL you're doing something wrong. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: py3k s***s

2008-04-17 Thread Carl Banks
On Apr 17, 4:41 am, Sverker Nilsson <[EMAIL PROTECTED]> wrote: > On Apr 17, 12:02 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > > On Apr 16, 12:40 pm, Aaron Watters <[EMAIL PROTECTED]> wrote: > > > > On Apr 16, 12:27 pm, Rhamphoryncus <[EM

Re: I just killed GIL!!!

2008-04-17 Thread Carl Banks
On Apr 17, 1:03 pm, Jonathan Gardner <[EMAIL PROTECTED]> wrote: > On Apr 17, 1:18 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > > On Apr 17, 3:37 am, Jonathan Gardner <[EMAIL PROTECTED]> > > wrote: > > > If you can't rewrite > > > your al

Re: py3k concerns. An example

2008-04-19 Thread Carl Banks
string%dict was just left in it wouldn't be an issue. > > Also, if making f(**d) support dict emulation > has any negative performance implications > then I don't want it please. > > sigh. -- Aaron Watters If you don't like Python 3, DON'T USE IT. It's been stated repeatedly that 2.x and 3.x are going to be supported in parallel for years. Refusing to use 3, thus casting your brain-share vote against it, is far more likely to have an effect than you coming here and making everyone's life miserable with your pitiful whining. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.5 adoption

2008-04-19 Thread Carl Banks
.3. (I bring this up to illustrate that if there are people clamoring for a 2.3 updates, there are probably quite a few supporting 2.4 as well.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: I just killed GIL!!!

2008-04-21 Thread Carl Banks
On Apr 20, 10:57 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Carl Banks <[EMAIL PROTECTED]> wrote: > > >On Apr 17, 3:37 am, Jonathan Gardner <[EMAIL PROTECTED]> > >wrote: > > >> Using 100% of the CPU is a bug, not a fe

Re: I just killed GIL!!!

2008-04-21 Thread Carl Banks
On Apr 21, 9:20 am, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > Carl Banks <[EMAIL PROTECTED]> wrote: > > > > >On Apr 20, 10:57 pm, [EMAIL PROTECTED] (Aahz) wrote: > >> In article <[EMAIL PROTECTED]>, > >> Carl

Re: Python Success stories

2008-04-22 Thread Carl Banks
e no end of an ass!" The crowd roared with laughter. The man was humiliated again. But the social winked at him, indicating that he would soon give the clown the perfect retort. The old man couldn't wait to hear what it was. Suddenly the social worker stood up and shouted, "Hey clown!" The crowd hushed, and clown whirled around to look at him. "F**k you!" (It makes even more sense when you consider that Perl programmers pretty much are clowns.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Carl Banks
why I wholeheartedly favor MI: it allows classes to share behavior with restraints. Java (for example) allows a class to share behavior with only one other class, and that *severely* limits the opportunities to minimize redundancy. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Carl Banks
On Apr 22, 10:36 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Apr 22, 10:22 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > > Java (for example) allows a class to share behavior with only one > > other class, and that *severely* limits the opportunities to mi

Re: Remove multiple inheritance in Python 3000

2008-04-22 Thread Carl Banks
> > But the *goal* of the polymorphy is mainly to have shared behavior. Not at all. The goal of polymorphism is to have objects of different types usable in the same situation. Two such classes might share some behavior, but they don't have to. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Success stories

2008-04-22 Thread Carl Banks
s at the same time it does support the += operator ??? Because "Features A and B are in language X. Python adds Feature A. Therefore Python must also add Feature B (or it'll be weird)" is not valid logic. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with mmap

2008-04-25 Thread Carl Banks
On Apr 25, 9:37 am, Neal Becker <[EMAIL PROTECTED]> wrote: > On linux, I don't understand why: > > f = open ('/dev/eos', 'rw') > m = mmap.mmap(f.fileno(), 100, prot=mmap.PROT_READ|mmap.PROT_WRITE, > flags=mmap.MAP_SHARED) > > gives 'pe

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread Carl Banks
On Apr 26, 11:10 am, n00m <[EMAIL PROTECTED]> wrote: > Both codes below read the same huge(~35MB) text file. > In the file > 100 lines, the length of each line < 99 chars. > > Stable result: > Python runs ~0.65s > C : ~0.70s > > Any thoughts? Yes. Most of the dirty work in the Python example

Re: Python(2.5) reads an input file FASTER than pure C(Mingw)

2008-04-26 Thread Carl Banks
On Apr 26, 12:15 pm, n00m <[EMAIL PROTECTED]> wrote: > fgets() from C++ iostream library??? Sheesh. That'll teach me to read carefully. (Ok, it probably won't.) Other two points still apply. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: list.reverse()

2008-04-29 Thread Carl Banks
e, that is true. But it returns None mostly to avoid confusing the user, who is likely to assume that the operation is non-destructive (or forget that it isn't). Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: computing with characters

2008-04-30 Thread Carl Banks
in(u"x") > > yields an unicode object. This is confusing (but will probably go > > away with Python 3). > > It is only ugly because you aren't used to seeing method calls on string > literals. I'm used to seeing it and I think it's ugly.

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Carl Banks
imple), use ConfigParser, or use a Python file that you exec. Store the file in $HOME/.appname/config.ext on Unix, $USERDIR/ ApplicationData/Appname/config.ext on Windows. I don't recommend using the Windows registry to store options; use it to modify Windows behavior (like file ass

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Carl Banks
On May 1, 1:30 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Thu, 01 May 2008 09:45:28 -0700, Carl Banks wrote: > > On May 1, 12:11 pm, Jon Ribbens <[EMAIL PROTECTED]> wrote: > >> On 2008-05-01, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > > >>

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Carl Banks
On May 1, 4:50 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Thu, 01 May 2008 11:56:20 -0700, Carl Banks wrote: > > On May 1, 1:30 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > >> On Thu, 01 May 2008 09:45:28 -0700, Carl Banks wrote: > >> &g

Re: Best way to store config or preferences in a multi-platform way.

2008-05-01 Thread Carl Banks
On May 1, 7:54 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > No, all I want is to give the OP a useful alternative Fair enough, I can't argue with that. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to store config or preferences in a multi-platform way.

2008-05-02 Thread Carl Banks
tos de programa" y "Archivos de > Programa" respectively, and the user may choose to move them to another > location. > Use SHGetFolderPath to obtain the path; see > http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx Thanks for the heads up: wasn't aware tho

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Carl Banks
housands of programs and > modules that has to run out of the box on whatever system the client > happens to run on. If you're shipping a program that large you out to be packaging the Python interpreter with it. Frankly, this whole discussion is silly, as if it's some kind hard th

Re: is +=1 thread safe

2008-05-03 Thread Carl Banks
tep process: Yes, this will be atomic. It's a pretty good idea, in fact. The underlying increment operation is protected by the GIL; it could be three, forty, or a hundred steps and it'd be atomic at the Python level. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: is +=1 thread safe

2008-05-04 Thread Carl Banks
): thread1=timer() thread2=timer() thread1.start() thread2.start() thread1.join() thread2.join() print 'final count:', count print ' should be:', 2*N if __name__=='__main__': test() Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: is +=1 thread safe

2008-05-04 Thread Carl Banks
On May 4, 2:13 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > However, what I said was not wholly untrue: code in C extensions is > protected by the GIL and thus not interruptable, unless it either > releases the GIL, or calls back into Python code (which is apparently > what numpy

Re: License selection for free software

2008-05-06 Thread Carl Banks
on is very low for most projects. And even when it did > happen, the evil corporation would likely submit patches. The Wine project changed from MIT (I think) to LGPL because evil corporations were hijacking its source code and not submitting patches. It happens. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: ]ANN[ Vellum 0.16: Lots Of Documentation and Watching

2008-05-06 Thread Carl Banks
rned about its viral aspects moreso than the requirement to contribute back released changes. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: License selection for free software

2008-05-07 Thread Carl Banks
ing used only in open source packages. LGPL? No, there is probably no reason to have a serious problem with that if you're going to submit patches, but GPL, yes. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: License selection for free software

2008-05-07 Thread Carl Banks
On May 7, 3:51 am, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > Carl Banks <[EMAIL PROTECTED]> writes: > > Nonsense. They could be more than willing to contribute their > > patches, but aren't willing to accept the GPL's limitation to being > > used

Re: License selection for free software

2008-05-07 Thread Carl Banks
o involved with Apache, which does have a permissive license. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: precedence of [] vs .

2008-08-14 Thread Carl Banks
in the subscript opreator rules. The effect of this is that the grouping a.(b[c]) is impossible. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: negative numbers are not equal...

2008-08-15 Thread Carl Banks
nux2 Type "help", "copyright", "credits" or "license" for more information. >>> a = 'A' >>> b = "%c" % a >>> a 'A' >>> b 'A' >>> a is b False > You must not rely on the > optimization. Good advice. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Good python equivalent to C goto

2008-08-16 Thread Carl Banks
u. Calling a nested function to perform cleanup is prone to omission errors, and it doesn't guarantee that cleanup will happen if an exception is raised. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing exceptions in PEP 3107

2008-08-16 Thread Carl Banks
On Aug 15, 3:42 pm, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: >  > IOW, there is currently no recommended way to do *anything* with >  > annotations(**).  That is entirely left up to users and third-party >  > packages, and the PEP goes out

Re: Missing exceptions in PEP 3107

2008-08-17 Thread Carl Banks
On Aug 17, 9:34 am, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Carl Banks schrieb: > > > You are free to use it for other things.  For example, the following > > usage is obvious and sensible (insofar as listing exceptions is > > sensible): > > >

Re: Missing exceptions in PEP 3107

2008-08-17 Thread Carl Banks
On Aug 17, 7:25 pm, Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > If it bothers you that much, go file a bug report.  Someone might even > > change it.  But it's nothing but needless pedantry. > > Has my "de" domain inspired y

Re: Filling in Degrees in a Circle (Astronomy)

2008-08-22 Thread Carl Banks
ed to the nearest integer. > Maybe there's an interpolation operator? There's nothing built in, but see the bisect module. It is a good way to determine which interval you are in, and you can interpolate the points yourself. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Should Python raise a warning for mutable default arguments?

2008-08-22 Thread Carl Banks
name = substitutions.get(name,name) ... -0 on adding a warning that's disbaled by default. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Should Python raise a warning for mutable default arguments?

2008-08-23 Thread Carl Banks
On Aug 23, 4:09 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 22 Aug 2008 20:37:09 -0700, Carl Banks wrote: > > On Aug 22, 10:42 am, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > >> Sometimes it seems

Re: What's your first choice if you have to write a C module for python?

2008-08-26 Thread Carl Banks
On Aug 26, 8:19 am, 一首诗 <[EMAIL PROTECTED]> wrote: > What's your first choice when you have write a C/C++ module for Python? 1. Plain C code 2. Implement my own C extension code generator in Python 3. ctypes ... ... Infinity. SWIG Carl Banks -- http://mail.python.org/mailman/l

Re: Python multimap

2008-08-27 Thread Carl Banks
xecute "print k['1']"? Best I can tell, you want some sort of association list like this: k = [] k.append(("1","Tom")) k.append(("1","Tommy")) which you can iterate through like this: for key,value in k: And if you need to retrieve items with a certain "key", probably it's easiest to maintain sorted invariant, and to do insertion and lookup with bisection algorithm (see bisect module). I don't know of any class in the standard library that does all that for you though. Out of curiosity, what does a true multimap solve that a dictionary of lists not solve? Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python multimap

2008-08-28 Thread Carl Banks
On Aug 28, 2:41 pm, brad <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > Out of curiosity, what does a true multimap solve that a dictionary of > > lists not solve? > > Nothing really. I went with a variation of the suggested work around... > it's just that w

Re: When to use try and except?

2008-08-29 Thread Carl Banks
o, sometimes files fail to open for other reasons, such as permissions. For things like divide-by-zero, there's no way a local value can change between the zero test and the operation (except in uncommon situations), so it's just a matter of style which way you do it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: When to use try and except?

2008-08-29 Thread Carl Banks
t to check for errors". I tend to use EAFP to check if something "wrong" happened (a missing file, invalid input, etc.), and LBYL for expected conditions that can occur with valid input, even when that condition could be tested with a try...except. For instance, I'd write something like this: if x is not None: y = x.calculate_value() else: y = default_value Main reason I do this is to document that None is an expected and valid value for x, and not incidative of a problem. But it's purely a matter of style and neither way is wrong. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: When to use try and except?

2008-08-30 Thread Carl Banks
On Aug 30, 2:03 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > I wouldn't say that the possibility of EAFP in Python makes it > > obsolute to use LBYL. > > when using CPython, EAFP at the Python level always involve LBYL at the > C leve

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Carl Banks
ect has no attribute '%s'" % attr) self.__dict__[attr] = val def __init__(self,x): self.y = x I suspect most people who go into Python doing something like this soon abandon it when they see how rarely it actually catches anything. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Late initialization using __getattribute__

2008-09-04 Thread Carl Banks
f): self._cursor = VanillaCursor() self._connected = False def __getattr__(self,attr): if not self._connected: self._cursor.connect() self._connected = True return getattr(self._cursor,attr) cursor = SuperCursor() That doens't use a mixin, but why should it? Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Late initialization using __getattribute__

2008-09-04 Thread Carl Banks
an unhealthy extreme. A mixin is simply the wrong tool to do this with. My advice: either use a proxy, or manage your connections better. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Carl Banks
On Sep 4, 3:15 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On 4 ÓÅÎÔ, 22:59, Carl Banks <[EMAIL PROTECTED]> wrote: > > You can write code to guard against this if you want: > > > class A: > > legal = set(["x"]) > > def __setattr

Re: Converting .doc to .txt in Linux

2008-09-04 Thread Carl Banks
u can do it manually with Open Office. <http://www.openoffice.org/> > A free office suite. On Debian there is a package called "unoconv"--written in Python--that can do the conversions from the command line. It requires a running instance of Open Office. However, the doc-to-txt conversion of Open Office isn't that good. (It wasn't as good as Word's formatted text converter, last time I used it.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: "Full" element tag listing possible with Elementtree?

2008-09-05 Thread Carl Banks
solution, but I'd like to point out that this is also trivially easy with recursion: def print_nodes(element, ancestors = []): s = hierarchy = ancestors + ["<" + element.tag + ">"] if element.text is not None: s = s + [element.text] print " &qu

Re: Accessing __slots__ from C

2008-09-11 Thread Carl Banks
he slot in the object structure by querying the member descriptor of the type object. descr = GetAttrString(cls,"varname"); offset = descr->d_member->offset; slotvar = (PyObject*)(((char*)obj)+offset) There might be some macros to simplify this. Use at your own risk. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing __slots__ from C

2008-09-12 Thread Carl Banks
ious. The offsetof() macro would help for the third line (in fact, it's the recommended standard way since there are some C implmentions, somewhere, that the pointer artithmetic method fails). Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: n00b question: Better Syntax for Coroutines?

2008-09-12 Thread Carl Banks
you're stuck with using threads in a standard Python release. Generators can't serve as coroutines when you're yielding from a nested call (they only go one level deep). You can get coroutines with Stackless Python, a non-standard version of Python. But even with Stackless I got the impression that you'd be building coroutines atop something that was fairly thread-like. There is no coroutine syntax. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: lacking follow-through

2008-09-12 Thread Carl Banks
On Sep 12, 12:35 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > The defence rests. > > can you please stop quoting that guy, so we don't have to killfile you > as well... Guy? Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: lacking follow-through

2008-09-12 Thread Carl Banks
to an A.I.'s. > > Your various outpourings appear so rambling and ill-conceived that > silence is often the only polite response. > > If you are flattered to be compared to an AI you must come from the same > race as Mr. Spock in Star Trek. I'm surprised there is anyone who still gives castironpi credit for being fully human. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: question about python

2008-09-13 Thread Carl Banks
7;) > cfile.write('and the web browser converts it. ') > cfile.write(' http://python.about.com/ > index.html">Click me! ') > cfile.write('The wording of your request was: "%s"' %(line)) > cfile.write('') > > cfile.close() > csock.close() Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: question about python

2008-09-13 Thread Carl Banks
you should never output anything you receive through the network without checking it or escaping it to prevent malicious uses.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Function getting a reference to its own module

2008-09-17 Thread Carl Banks
.modules[__name__] or write a separate function to return the appropriate nested module of __name__. Neither method is foolproof I don't think. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: report a BUG of package setuptools-0.6c8.

2008-09-20 Thread Carl Banks
n't list an obvious way to report bugs so I wonder if they're using bugs.python.org? Hope not) If not, the OP should ask on the setuptools mailing list. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Not fully OO ?

2008-09-20 Thread Carl Banks
e or less) define what Python is, not trendy computer science catch words. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: A bit weird dictionary behavior

2008-09-22 Thread Carl Banks
ruth value of an expression... And some would argue that it was wrong to have such a wide definition for the truth value of an expression in the first place... Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Why no tailcall-optimization?

2008-09-23 Thread Carl Banks
ld be better for that, since it would be a pretty complex thing that would benefit only a tiny fraction of users.) Carl Banks (**) Actually the compiler can do some compile-time constant expression folding, but that's about it. Otherwise it's object agnostic. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python style: exceptions vs. sys.exit()

2008-09-24 Thread Carl Banks
might not want to do that. For that matter, a library should never print error or status messages. Messages should either be sent to the caller somehow, or handled using the logging facility. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: matrix algebra

2008-09-24 Thread Carl Banks
never I write Blender plugins I usually do all the dirty work with numpy. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple processes, private working directories

2008-09-24 Thread Carl Banks
acts like threading module but uses processes. I think you can still run it as a third- party module in 2.5. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP Proposal

2008-09-25 Thread Carl Banks
ide-effects can and are supposed to happen in the process of trying. Anyway, this proposal can easily be implemented more or less as proposed without any syntax changes, using the same ideas as the multimethod implementations, but guaranteeing trial-and-error dispatching. Carl Banks (**)

Re: Large Data Sets: Use base variables or classes? And some binding questions

2008-09-26 Thread Carl Banks
to the indices.) This might be a perfect fit for your needs. You have to upgrade to 2.6, though, which won't be released for a few days. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Large Data Sets: Use base variables or classes? And some binding questions

2008-09-26 Thread Carl Banks
On Sep 26, 7:43 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 26 Sep 2008 14:54:36 -0700, Carl Banks wrote: > > However, it seems from the rest of your comments that speed is your main > > concern.  Last time someone reported __slots__ didn&#

Re: Large Data Sets: Use base variables or classes? And some binding questions

2008-09-26 Thread Carl Banks
On Sep 26, 8:53 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > It might still end up being slower (creating slot descriptors might > take more time for all I know) but it's more than just an effect of > less memory. Actually scratch that. Descriptors are only created when the ty

Re: Borg vs Singleton vs OddClass

2008-09-28 Thread Carl Banks
ss,"_instance",None) if obj is None: obj = _NotOddClass._instance = NotOddClass() return obj If you're real kinky you can use a metaclass. There are reasons to prefer any of these. I'd recommend the factory function unless you think the users could significantly

Re: What is not objects in Python?

2008-09-28 Thread Carl Banks
ou to understanda a language for what it is, not for whatever computer science buzzword labels it has. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: What is not objects in Python?

2008-09-28 Thread Carl Banks
n syntax. There's no clear cut distinction there, it's just a design decision. Likewise, making len() into a function is just a design decision, that len is a common enough operation that it need elevated status. It's really nothing more. Python wouldn't suffer much regardless if len is a method, a built-in function, or an operator with its own syntax. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: del and sets proposal

2008-10-03 Thread Carl Banks
uldn't want that addition to `set`\s but at least it can be > implemented without introducing inconsistencies. If set behaved that way then "del a[1]" wouldn't behave like del anymore. Normally, "del whatever" means that you can no longer use "whatever"; in this proposal you can. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: del and sets proposal

2008-10-03 Thread Carl Banks
the first dictionary entry but rather delete the entry in > the object with a value of 1, which IMHO would be perfectly logical for a set > (which is why I started this discussion). It's not logical at all. In all current uses of del, the thing that follows del is a valid expressio

Re: Any advantage in LISPs having simpler grammars than Python?

2006-03-08 Thread Carl Banks
ng. I suppose many LISPers do as well. I guess which is less effort depends on whether you find it more difficult to identify patterns whole line, or read an extra word. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: advice on this little script

2006-03-09 Thread Carl Banks
John Salerno wrote: > John Salerno wrote: > > > from time import sleep > ... > > sleep(1.0) > > Very picky point, but I'd like to know what others think of this. Should > I import as above, or should I do this: > > import time > > time.sleep(60.0) ??? > > I think the 'from time import sl

Re: Help Create Good Data Model

2006-03-11 Thread Carl Banks
s, in which case it won't exactly hurt to put the acquisition inside the try block. It might be true of mutexes for all I know. But even in those rare cases, I recommend always sticking to the idiom for consistency.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Help Create Good Data Model

2006-03-12 Thread Carl Banks
that it's in the standard libarary. But interally it's fairly similar to how you're doing it. (It has a few extra locks to handle empty and full conditions, IIRC.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting nested loop iterations

2006-03-16 Thread Carl Banks
oo for color in animal) for i,(animal,zoo) in enumerate(aciter): pass But even the clear version isn't as nearly clear and straightforward as the nested fors with the counter. I wouldn't forsake that clarity just so it isn't "kludgy". Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Function params with **? what do these mean?

2006-03-20 Thread Carl Banks
pretty good description), but I can't think of any particular reason to search for all occurrences of them. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: New-style Python icons

2006-03-20 Thread Carl Banks
> you like, you can grab them from: > > http://www.doxdesk.com/img/software/py/icons.png I like 'em. Almost makes me wish I was using Windows. (No it doesn't.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: TaskQueue

2006-03-21 Thread Carl Banks
implemented some workaround that I don't remember, and forgot about the issue until your post. But yeah, something like an InterruptableQueue might be a nice thing to have. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: TaskQueue

2006-03-21 Thread Carl Banks
x27;s not applicable to your example, sometimes None is an object you want to pass through. (I think Alex Martelli came up with that one.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: TaskQueue

2006-03-21 Thread Carl Banks
Carl Banks wrote: > But yeah, something like an InterruptableQueue might be a nice thing to > have. Ok, I see now that InterruptableQueue wouldn't help the OP, though it would have helped me in my situation, so it'd still be a good idea. Carl Banks -- http://mail.python.org/

Re: TaskQueue

2006-03-21 Thread Carl Banks
Rene Pijlman wrote: > Carl Banks: > >Rene Pijlman: > >> for i in range(self.numberOfThreads): > >> self.workQueue.put(None) > > > >Or, you could just put one sentinel in the Queue, and subclass the > >Queue's _get method not

Re: Dynamically growing numarray array.

2006-03-22 Thread Carl Banks
ent_array() array([ [ 0., 1., 2.]]) >>> x.add_point([0,0,0]) >>> x.add_point([1,1,1]) >>> x.get_current_array() array([[ 0., 1., 2.], [ 0., 0., 0.], [ 1., 1., 1.]]) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: import random module

2006-03-22 Thread Carl Banks
the current directory, because current directory is in sys.path. Unless there's a change sys.path planned, the shadowing should still happen. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

<    6   7   8   9   10   11   12   13   14   15   >