Re: Overriding iadd for dictionary like objects

2009-08-28 Thread Carl Banks
On Aug 28, 2:42 pm, Terry Reedy tjre...@udel.edu wrote: Carl Banks wrote: I don't think it needs a syntax for that, but I'm not so sure a method to modify a value in place with a single key lookup wouldn't occasioanally be useful. Augmented assignment does that. Internally uses two

Re: List iterator thread safety

2009-08-27 Thread Carl Banks
to the object. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Object's nesting scope

2009-08-27 Thread Carl Banks
design points of Python: that attributes should always be accessed explicitly. Having said that, the syntax you propose is awful. :) Normally when this is proposed they use a keyword such as using: p = Person() using p: name = Carl Banks location = Los Angeles or, perhaps to save a line

Re: List iterator thread safety

2009-08-27 Thread Carl Banks
On Aug 27, 7:25 am, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Thursday 27 August 2009 15:26:04 Carl Banks wrote: Deleting items from a list while iterating over it is a bad idea, exceptions or not. Hmm, this sounds like something someone might do for a game.  You have a list

Re: Object's nesting scope

2009-08-27 Thread Carl Banks
On Aug 27, 8:01 am, zaur szp...@gmail.com wrote: On 27 авг, 18:34, Carl Banks pavlovevide...@gmail.com wrote: The idea has been discussed in various forms here quite a bit over the years.  I doubt there's any chance it'll be accepted into Python, because it goes against one of the main

Re: Python, qt, and lgpl

2009-08-26 Thread Carl Banks
for them. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with Python scoping rules

2009-08-26 Thread Carl Banks
On Aug 26, 7:09 am, kj no.em...@please.post wrote: In 16b72319-8023-471c-ba40-8025aa6d4...@a26g2000yqn.googlegroups.com Carl Banks pavlovevide...@gmail.com writes: First, one of the goals of OO is encapsulation, not only at the level of instances, but also at the level of classes. =A0Your

Re: Context manager to temporarily change the variable of a register [aka write swap(a,b)]

2009-08-26 Thread Carl Banks
    print x  # prints 5 Well, it wouldn't be a can I rebind a variable using a with- statement thread if someone didn't post a solution that they thought worked, but didn't test it on local variables. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with Python scoping rules

2009-08-26 Thread Carl Banks
- 1)     _classvar = fact(5)     fact = staticmethod(fact) print Demo9._classvar xx = Demo9() print xx.fact(6) print Demo9.fact(8) This won't work normally. It only worked for you because you made a typo. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with Python scoping rules

2009-08-26 Thread Carl Banks
On Aug 26, 8:36 am, kj no.em...@please.post wrote: In 1bf83a7e-f9eb-46ff-84fe-cf42d9608...@j21g2000yqe.googlegroups.com Carl Banks pavlovevide...@gmail.com writes: Yeah, it's a little surprising that you can't access class scope from a function, but that has nothing to do with encapsulation

Re: Literal concatenation, strings vs. numbers (was: Numeric literals in other than base 10 - was Annoying octal notation)

2009-08-24 Thread Carl Banks
there's really only one reasonable interpretation. The point of consistency is to help understand things by analogy, but if analogy doesn't help understanding--and it wouldn't in this case--there's no point. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: elementtree

2009-08-24 Thread Carl Banks
is to write out the ElementTree object as XML with an .xml extension, and view it in a modern web browser (Firefox, IE, others maybe) that can show XML structure. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying octal notation

2009-08-24 Thread Carl Banks
to explain it, but I decided it's not worth a serious argument. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying octal notation

2009-08-22 Thread Carl Banks
programming langauge is, at most, a polite suggestion for how Python should do it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying octal notation

2009-08-22 Thread Carl Banks
but this relic of the past should have been consigned to the waste bin of history long ago. :) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: proposal: add setresuid() system call to python

2009-08-21 Thread Carl Banks
with this: ctypes.pythonapi.PyErr_SetFromErrno(ctypes.py_object(OSError)) Not entirely sure it'll work with Python built with a static library, but I think it will. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Need cleanup advice for multiline string

2009-08-19 Thread Carl Banks
it some other way than by following up to an obvious joke, probably one designed to diffuse the ill-feeling. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I convert an iterator over bytes into a str?

2009-08-18 Thread Carl Banks
. If the syntax bothers you can always do this: str.join(,iter(four score)) I think .join is ugly as hell but in this case convenience beats beauty for me. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 'for' loop is memory inefficient

2009-08-17 Thread Carl Banks
because you can use xrange, you don't need compiler magic to recognize and optimize range. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Need cleanup advice for multiline string

2009-08-17 Thread Carl Banks
* friendly form, so there is really nothing to worry about it. I like how being very friendly means calling people after a guy who tried to blow up the English Parliament. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Diversity in Python (was Re: Need cleanup advice for multiline string)

2009-08-17 Thread Carl Banks
altogether. Price you pay for popularity. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Need cleanup advice for multiline string

2009-08-17 Thread Carl Banks
On Aug 17, 5:40 pm, Mensanator mensana...@aol.com wrote: On Aug 17, 4:06 pm, Carl Banks pavlovevide...@gmail.com wrote: On Aug 17, 10:03 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: I'm no English native, but I already heard women/men referring to a group as guys, no matter

Re: Need cleanup advice for multiline string

2009-08-17 Thread Carl Banks
On Aug 17, 8:49 pm, Mensanator mensana...@aol.com wrote: On Aug 17, 8:04 pm, Carl Banks pavlovevide...@gmail.com wrote: On Aug 17, 5:40 pm, Mensanator mensana...@aol.com wrote: On Aug 17, 4:06 pm, Carl Banks pavlovevide...@gmail.com wrote: On Aug 17, 10:03 am, Jean-Michel

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread Carl Banks
complaints to be made about this situation it's that there are any 2.x learning materials anythere that continue to use range() and not xrange() in this context. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 'for' loop is memory inefficient

2009-08-16 Thread Carl Banks
is able to do this. Cython can do this easily because it is a different language that is a lot less dynamic than Python. If you don't care about the dynamic stuff why don't you just use Cython? Or quit complaining and just use xrange. Carl Banks -- http://mail.python.org/mailman/listinfo/python

Re: for cycle with assigning index

2009-08-15 Thread Carl Banks
)): Funcs.append(create_funcs_caller(i)) (I prefer to do it this way in any case; never liked the keyword argument hack way of doing it.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing - group effort to hire writers?

2009-08-15 Thread Carl Banks
is that their response is to shutdown changes that are intended to *help* newbies help themselves. It seems self-defeating to me. Intended to help newbies doesn't necessarily mean it actually will help newbies. (Just sayin'.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: random.gauss vs. random.normalvariate

2009-08-15 Thread Carl Banks
. So since both are offered and gauss is faster, I assume it must have some offsetting disadvantage.  What is it? random.gauss is not thread safe. I'm kind of surprised the html docs don't mention this; the docstring does. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble with reload

2009-08-14 Thread Carl Banks
altogether; only import modules. It's more typing and a bit less efficient, but it makes everything more straightforward and consistent. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: OptionParser How to: prog cmd [options] [arguments]

2009-08-14 Thread Carl Banks
optparse instead of argparse. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: hashability

2009-08-12 Thread Carl Banks
by the language to be equal to itself, so equality is preserved and there should be no issue with it, even if the hash code changes across invocations. Now, if you are doing something weird with the hash value itself-- which I highly discourage--then all bets are off. Carl Banks -- http://mail.python.org

Re: Extending embedded python-can extensions be local to a dictionary?

2009-08-12 Thread Carl Banks
was vague; if you want a better answer please rephrase to be more specific. Include details like what you would like the code of a Python plugin to look like. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing - group effort to hire writers?

2009-08-11 Thread Carl Banks
has been available for months. Hello, I'm mailing you to kindly request, again, that you please stop validating r's disruptiveness by responding to him on comp.lang.python. Thank you. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Social problems of Python doc [was Re: Python docs disappointing]

2009-08-11 Thread Carl Banks
that opinions differ; they have to take perceived defects in the docs personally. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: How to access a function's formal signature?

2009-08-11 Thread Carl Banks
attributes (and maybe also it's underlying code object) which are read-only. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: hashability

2009-08-11 Thread Carl Banks
? It is possible to redefine == operator by defining __ne__ instead of __eq__, at least on Python 2.5, so you should keep that in mind. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Unrecognized escape sequences in string literals

2009-08-10 Thread Carl Banks
On Aug 9, 11:10 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Sun, 09 Aug 2009 18:34:14 -0700, Carl Banks wrote: Why should a backslash in a string literal be an error? Because the behavior of \ in a string is context-dependent, which means a reader can't know

Re: With or without leading underscore...

2009-08-10 Thread Carl Banks
): def __init__(self,*args,**kwargs): raise TypeError('Type not callable; use factory function instead') @classmethod def _create_object(cls,initial_value): self = object.__new__(cls) # avoid __init__ self.value = initial_value Carl Banks -- http://mail.python.org

Re: Unrecognized escape sequences in string literals

2009-08-10 Thread Carl Banks
other character is just the character, except for backslash followed by a newline, which suppresses the newline. That would be reasonable; it'd match the behavior of regexps. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Unrecognized escape sequences in string literals

2009-08-10 Thread Carl Banks
On Aug 10, 1:37 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 10 Aug 2009 00:37:33 -0700, Carl Banks wrote: On Aug 9, 11:10 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Sun, 09 Aug 2009 18:34:14 -0700, Carl Banks wrote: Why should

Re: Monkeypatching an object to become callable

2009-08-09 Thread Carl Banks
errors raised inside the _instancecall method. Then set _instancecall on any objects you want to be callable. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Unrecognized escape sequences in string literals

2009-08-09 Thread Carl Banks
real-world importance, but in terms of raw unPythonicness this might be the worst offense the language makes. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax checker in python

2009-08-08 Thread Carl Banks
py_compile.compile(sys.argv[1],'/dev/null',None,False) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing - group effort to hire writers?

2009-08-08 Thread Carl Banks
, that guy is Xah Lee, a person who's been trolling Usenet for a long time. He is best ignored, but I don't blame someone for snapping at him. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: How to reset document string

2009-08-07 Thread Carl Banks
not being visible at an interactive prompt. I have given you some fairly vague answers, hopefully that'll give you some idea. It sounds like you have an ambitious project, suggesting that you are probably good enough to implement the suggestions. Carl Banks -- http://mail.python.org/mailman

Re: how to overload operator (a x b)?

2009-08-07 Thread Carl Banks
to return a closure with a boolean value. See my upcoming reply to the author. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: how to overload operator (a x b)?

2009-08-07 Thread Carl Banks
On Aug 7, 9:01 pm, Carl Banks pavlovevide...@gmail.com wrote: On Aug 7, 7:18 am, Diez B. Roggisch de...@nospam.web.de wrote: alex23 schrieb: On Aug 7, 10:50 pm, Benjamin Kaplan benjamin.kap...@case.edu wrote: That isn't an operator at all. Python does not support compound

Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread Carl Banks
probably be useful, but might also attract spam and lots of useless fluff, because it's likely to be much higher volume than documentation on other projects. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug or feature: double strings as one

2009-08-07 Thread Carl Banks
several mutually-exclusive features. http://www.geocities.com/connorbd/tarpit/magentaaarm.html (It's on Geocities, yikes, someone better archive that) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Subclassing Python's dict

2009-08-06 Thread Carl Banks
indispensible, though.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: How to combine regexps?

2009-08-05 Thread Carl Banks
(evidently) will soon use to create a regexp. Yes, you can do that in Python as well, in exactly the same way, using Python's string manipulation capabilities. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: iterate lines with regex

2009-08-03 Thread Carl Banks
of implicit boolean values, but given that Python has it, I think it is best to adhere strongly idiomatic uses like regexps. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Seeding the rand() Generator

2009-08-03 Thread Carl Banks
On Aug 3, 8:12 pm, Fred Atkinson fatkin...@mishmash.com wrote: On Sun, 2 Aug 2009 17:00:40 -0700 (PDT), Carl Banks pavlovevide...@gmail.com wrote:         I appreciate the response.           I am executing a statement to retrieve one record at random.           An example would

Re: RUBY vs COMMON LISP

2009-08-03 Thread Carl Banks
smoking? That's like Perl! Haven't you learned your lesson? Python's syntax might even be better than Lisp's, but it's certainly harder to parse.- Hide quoted text - Go away, troll. [This is cross-posted; I recommend that no one else follow up.] Carl Banks -- http://mail.python.org/mailman

Re: cgi script

2009-08-02 Thread Carl Banks
or there was an error in a CGI script. Your script has a syntax error. (You forgot a colon or something like that.) If you can, try to run the file directly from a Python interpreter to see where the error is. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Seeding the rand() Generator

2009-08-02 Thread Carl Banks
information if you want a better answer than that. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing

2009-07-31 Thread Carl Banks
bookmark in web browser for Python documentation - keyword search for correct module (easy with firefox) - scroll. This might not be the smoothest method ever (omg you have to use a *mouse*) but it should be usable enough. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing

2009-07-31 Thread Carl Banks
On Jul 31, 1:55 pm, Mark Lawrence breamore...@yahoo.co.uk wrote: Apart from that what have the Pythonistas ever done for us? Nothing!:) Please don't feed the trolls. And if you do feed the trolls don't smile at them. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs disappointing

2009-07-31 Thread Carl Banks
On Jul 31, 2:28 pm, kj no.em...@please.post wrote: In e22013d0-fbad-44e0-919b-ad5bb5f2d...@g19g2000vbi.googlegroups.com Carl Banks pavlovevide...@gmail.com writes: (omg you have to use a *mouse*) That's precisely the point.  There's a huge number of programmers out there who, like me

Re: Python docs disappointing

2009-07-31 Thread Carl Banks
On Jul 31, 3:09 pm, kj no.em...@please.post wrote: In 09bf4f17-40a5-4bad-81d3-1950545b7...@g6g2000vbr.googlegroups.com Carl Banks pavlovevide...@gmail.com writes: snip Thanks.  Your remarks at least confirm that my impression was not simply due to my noob ignorance: the keyboard-accessible

Re: Semaphore Techniques

2009-07-29 Thread Carl Banks
On Jul 29, 7:14 am, Piet van Oostrum p...@cs.uu.nl wrote: Carl Banks pavlovevide...@gmail.com (CB) wrote: CB On Jul 28, 3:15 pm, John D Giotta jdgio...@gmail.com wrote: I'm looking to run a process with a limit of 3 instances, but each execution is over a crontab interval. I've been

Re: gamma approximation : what is module cmath and where is it located ?

2009-07-29 Thread Carl Banks
? Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Confessions of a Python fanboy

2009-07-29 Thread Carl Banks
Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Semaphore Techniques

2009-07-28 Thread Carl Banks
, then you want to use a thread pool (create three threads, and give them tasks as necessary). But you'll have to have a way for the process started by crontab to communicate with the server. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: len() should always return something

2009-07-25 Thread Carl Banks
and inconsistency, especially if you are a Python newbie. Just pass in a list if your function expects a list. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: non-owning references?

2009-07-25 Thread Carl Banks
really is the point? Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: If Scheme is so good why MIT drops it?

2009-07-25 Thread Carl Banks
://xahlee.org/perl-python/index.html • Xah's PHP Tutorial  http://xahlee.org/php/index.html   Xah ∑http://xahlee.org/ Wow, you leave no stone unturned. computer science R us I'm stealing this. Carl BAnks -- http://mail.python.org/mailman/listinfo/python-list

Re: If Scheme is so good why MIT drops it?

2009-07-24 Thread Carl Banks
On Jul 24, 11:06 am, Raffael Cavallaro raffaelcavall...@pas.espam.s.il.vous.plait.mac.com wrote: On 2009-07-23 23:51:02 -0400, Carl Banks pavlovevide...@gmail.com said: On Jul 23, 5:52 pm, Rui Maciel rui.mac...@gmail.com wrote: fft1976 wrote: How do you explain that something as inferior

Re: len() should always return something

2009-07-24 Thread Carl Banks
that can be indexed.  Sounds like a big mess to me... You can call the big mess Matlab. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: comments? storing a function in an object

2009-07-23 Thread Carl Banks
On Jul 22, 8:38 pm, a...@pythoncraft.com (Aahz) wrote: In article f3d88edf-b5d3-43e4-89a3-b05ef0f55...@p28g2000vbn.googlegroups.com, Carl Banks  pavlovevide...@gmail.com wrote: You have to be REALLY REALLY careful not to pass any user-supplied data to it if this is a server running on your

Re: If Scheme is so good why MIT drops it?

2009-07-23 Thread Carl Banks
On Jul 23, 2:37 am, Nobody nob...@nowhere.com wrote: On Wed, 22 Jul 2009 15:17:52 -0700, Carl Banks wrote: So do all these OSes have some kind of __mega_unifying_poll system call that works for anything that might possibly block, that you can exploit from a user process? Threads ;) Yeah

Re: If Scheme is so good why MIT drops it?

2009-07-22 Thread Carl Banks
allows some threads to run while others are blocked in a system call (as well as in a few other minor cases), which can't be done with green threads. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: If Scheme is so good why MIT drops it?

2009-07-22 Thread Carl Banks
On Jul 22, 10:20 am, Paul Rubin http://phr...@nospam.invalid wrote: Carl Banks pavlovevide...@gmail.com writes: Wrong.  It only partially undermines the utility of native threads, not completely.  Native threading allows some threads to run while others are blocked in a system call (as well

Re: If Scheme is so good why MIT drops it?

2009-07-22 Thread Carl Banks
On Jul 22, 12:04 pm, Paul Rubin http://phr...@nospam.invalid wrote: Carl Banks pavlovevide...@gmail.com writes: Why is that such an advantage?  Green threads work fine if you just organize the i/o system to never block.   Because then I don't have to organize the I/O system never

Re: If Scheme is so good why MIT drops it?

2009-07-22 Thread Carl Banks
On Jul 22, 1:53 pm, Jean-Paul Calderone exar...@divmod.com wrote: On Wed, 22 Jul 2009 12:35:52 -0700 (PDT), Carl Banks pavlovevide...@gmail.com wrote: On Jul 22, 12:04 pm, Paul Rubin http://phr...@nospam.invalid wrote: Carl Banks pavlovevide...@gmail.com writes: Why

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread Carl Banks
On Jul 19, 10:18 pm, Tim Daneliuk tun...@tundraware.com wrote: Uh Carl ... are you familiar with the concept of mocking humor? You got me, lip hurts bad. :) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Mutable Strings - Any libraries that offer this?

2009-07-20 Thread Carl Banks
a list of characters). Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: comments? storing a function in an object

2009-07-20 Thread Carl Banks
idea to pass it through some kind of validator for extra protection. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: If Scheme is so good why MIT drops it?

2009-07-19 Thread Carl Banks
at the original thread on comp.lang.lisp it seems they were doing a surprisingly good job discussing the issue. I'm guessing it's because the fanboy Lispers like Ken Tifton were busy with a flamewar in another thread (LISP vs PROLOG vs HASKELL). Carl Banks -- http://mail.python.org/mailman/listinfo

Re: If Scheme is so good why MIT drops it?

2009-07-19 Thread Carl Banks
On Jul 19, 4:29 pm, Tim Daneliuk tun...@tundraware.com wrote: Carl Banks wrote: On Jul 19, 10:33 am, fft1976 fft1...@gmail.com wrote: On Jul 19, 9:55 am, Frank Buss f...@frank-buss.de wrote: E.g. the number system: In many Lisp implementations (/ 2 3) results in the fractional object 2/3

Re: Self optimizing iterable

2009-07-17 Thread Carl Banks
using a dictionary. A regexp can be used after dispatching to extract parameters if necessary. It's possible to have disjoint regexps without a simple dispatch criterion, but I'd guess that's less common. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Why not enforce four space indentations in version 3.x?

2009-07-16 Thread Carl Banks
ask me. Not Perlish at all. (Perl would never want you not to use something.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: no return value for threading.Condition.wait(timeout)?

2009-07-16 Thread Carl Banks
to see if you are the owner of the condition, but this method is undocumented. cond = Condition() ... cond.acquire() while not ok_to_proceed(): cond.wait() if not cond._is_owned(): # must've timed out raise TimeOutException operate() cond.release() Carl Banks -- http

Re: no return value for threading.Condition.wait(timeout)?

2009-07-16 Thread Carl Banks
misread the code. So scratch what I said. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: import module unbelieveable behaviour

2009-07-15 Thread Carl Banks
. Pretty confusing if you ask me. Unfortunately Python is very unPythonic when it comes to importing. :( Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: import module unbelieveable behaviour

2009-07-15 Thread Carl Banks
the code import sys; print sys.modules.get('nc'); what does that output? Is there an old nc.py or nc.pyc file anywhere? Carl Banks Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Carl Banks
On Jul 13, 8:25 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 13 Jul 2009 17:49:23 -0700, Carl Banks wrote: On Jul 13, 12:31 pm, Piet van Oostrum p...@cs.uu.nl wrote: seldan24 selda...@gmail.com (s) wrote: s Hello, s I'm fairly new at Python so hopefully

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Carl Banks
On Jul 14, 2:14 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 14 Jul 2009 01:30:48 -0700, Carl Banks wrote: Seriously, do you *ever* take more than 2 seconds to consider whether you might be missing something obvious before following up with these indignant knee

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Carl Banks
On Jul 14, 4:48 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message 93f6a517-63d8-4c80- bf19-4614b7099...@m7g2000prd.googlegroups.com, Carl Banks wrote: Or would you rather let all unexpected exceptions print to standard error, which is often a black hole in non

Re: decorators - would be nice if...

2009-07-14 Thread Carl Banks
. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to add a position value to each item in a list

2009-07-09 Thread Carl Banks
in enumerate(page): page['position'] = start+i return page That might not work depending on what you are doing but you should consider it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing times like 5 minutes ago?

2009-07-06 Thread Carl Banks
).communicate() return float(stdout) clock_scan('1 hour ago') clock_scan('next week') Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-04 Thread Carl Banks
a __del__ method you care enough to clean it up explicitly.  'with' blocks are very nice for that. The OP already said with blocks won't suffice since the resources are long-lived objects that aren't limited to a single scope. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching equivalent to C++ RAII or deterministic destructors

2009-07-02 Thread Carl Banks
. I'd recommend making an effort to call it and to rely on __del__ as little as possible. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: invoking a method from two superclasses

2009-07-01 Thread Carl Banks
that if more than one class on the mro defines a   method only the first will get called? super returns [a proxy to] the *next* class in the MRO chain; it may or   may not be a superclass of C (it may be a sibling class instead). It could be even a niece class. Carl Banks -- http

Re: Making code run in both source tree and installation path

2009-07-01 Thread Carl Banks
. If you have any C-extensions it might complicate this. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Carl Banks
relatively random order. Instead, call random.shuffle() on the list, and iterate through that to get the elements in random order. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Why re.match()?

2009-07-01 Thread Carl Banks
(notwithstanding Duncan Booth's explanation of slight semantic differences). However, I find myself using re.match much more often than re.search, so perhaps in this case a second obvious way is justified. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Carl Banks
On Jul 1, 5:49 pm, Paul Rubin http://phr...@nospam.invalid wrote: Carl Banks pavlovevide...@gmail.com writes: Instead, call random.shuffle() on the list, and iterate through that to get the elements in random order. It's better to use random.sample() than random.shuffle(). If you're

Re: Trying to use sets for random selection, but the pop() method returns items in order

2009-07-01 Thread Carl Banks
On Jul 1, 6:37 pm, Paul Rubin http://phr...@nospam.invalid wrote: Carl Banks pavlovevide...@gmail.com writes: If you're iterating through the whole list and don't need to preserve the original order (as was the case here) random.shuffle() is better. 1. Random.sample avoids iterating through

<    1   2   3   4   5   6   7   8   9   10   >