Re: Why is the argparse module so inflexible?

2013-06-28 Thread Isaac To
On Sat, Jun 29, 2013 at 9:36 AM, Ethan Furman wrote: > On 06/27/2013 03:49 PM, Steven D'Aprano wrote: > >> >> Libraries should not call sys.exit, or raise SystemExit. Whether to quit >> or not is not the library's decision to make, that decision belongs to >> the application layer. Yes, the appli

Re: I hate you all

2013-04-05 Thread Isaac To
You underestimated the arrogance of Python. Python 3 tab doesn't map to 4 spaces. It doesn't map to any number of spaces. Tabs and spaces are completely unrelated. If you have a function having the first indentation level with 4 (or any number of) spaces, the next line starting not with 4 space

Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64)

2013-03-09 Thread Isaac To
In general, it is hard for any process to return the memory the OS allocate to it back to the OS, short of exiting the whole process. The only case that this works reliably is when the process allocates a chunk of memory by mmap (which is chosen by libc if it malloc or calloc a large chunk of memo

Re: Import redirects

2013-02-11 Thread Isaac To
On Mon, Feb 11, 2013 at 8:27 PM, Oscar Benjamin wrote: > On 11 February 2013 06:50, Isaac To wrote: > > Except one thing: it doesn't really work. If I `import foo.baz.mymod` > now, > > and if in "bar.baz.mymod" there is a statement `import bar.baz.depmod`, &

Import redirects

2013-02-10 Thread Isaac To
I have a package (say "foo") that I want to rename (say, to "bar"), and for compatibility reasons I want to be able to use the old package name to refer to the new package. Copying files or using filesystem symlinks is probably not the way to go, since that means any object in the modules of the p

Re: yield_all needed in Python

2005-03-05 Thread Isaac To
> "Paul" == Paul Moore <[EMAIL PROTECTED]> writes: Paul> You can work around the need for something like yield_all, Paul> or explicit loops, by defining an "iflatten" generator, Paul> which yields every element of its (iterable) argument, Paul> unless the element is a generator

Re: yield_all needed in Python

2005-03-01 Thread Isaac To
> "Douglas" == Douglas Alan <[EMAIL PROTECTED]> writes: Douglas> If you actually try doing this, you will see why I want Douglas> "yield_all". Oh... I see your point. I was about to suggest that the code in my posts before should be made to work somehow. I mean, if in def fun1(x)

Re: yield_all needed in Python

2005-03-01 Thread Isaac To
>>>>> "Isaac" == Isaac To <[EMAIL PROTECTED]> writes: def gen_all(gen): for e in gen: yield e def foogen(arg1): def foogen1(arg2): # Some code here # Some code here gen_all(arg3) ^ I mean foogen1(arg3), obviously, and si

Re: yield_all needed in Python

2005-03-01 Thread Isaac To
> "Douglas" == Douglas Alan <[EMAIL PROTECTED]> writes: Douglas> If you'll reread what I wrote, you'll see that I'm not Douglas> concerned with performance, but rather my concern is that Douglas> I want the syntactic sugar. I'm tired of writing code Douglas> that looks like

Re: python without OO

2005-01-26 Thread Isaac To
> "beliavsky" == beliavsky <[EMAIL PROTECTED]> writes: beliavsky> I think the OO way is slightly more obscure. It's beliavsky> obvious what x = reverse(x) does, but it is not clear beliavsky> unless you have the source code whether x.reverse() beliavsky> reverses x or if it re

Re: creating generators from function

2004-12-08 Thread Isaac To
> "Mike" == Mike Meyer <[EMAIL PROTECTED]> writes: Mike> I think it's a bit abnormal, because you have to scan the Mike> loop body for breaks. I tend to write: Mike> condition = True Mike> while condition: # corrected Mike> #code which iterates my simulation Then you

Re: The use of :

2004-11-28 Thread Isaac To
> "Greg" == Greg Ewing <[EMAIL PROTECTED]> writes: >> The only punctuation you *need* is whitespace. See Forth Greg> You don't even need that... see FORTRAN. :-) And you don't need everything else either... see this. http://compsoc.dur.ac.uk/whitespace/ :-) Regard