Re: Python-URL! - weekly Python news and links (Nov 12)

2007-11-12 Thread Carl Banks
On Nov 12, 2:46 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > Gabriel Genellina wrote: > > QOTW: "AOP is a programming paradigm in the same way indie is a genre of > > film." - Carl Banks > >http://groups.google.com/group/comp.lang.python/msg/224e922a3e1a8

Re: cmp and sorting non-symmetric types

2007-11-13 Thread Carl Banks
ered comparisons, not for subset and superset testing. Unfortunately, the rogue operators are already there and in use, so the right solution would probably cause more trouble than it would save at this point. But it'd still cause less trouble than resurrecting the __cmp__ operator. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Design Patterns - composition vs. inheritance

2007-11-15 Thread Carl Banks
ave something like this: mypet.owner.get_attributes() you should reverse-refactor it into something like this: mypet.get_owner_attributes() I would agree that the former is preferable, especially in cases like this one where the classes aren't really closely related. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Design Patterns - composition vs. inheritance

2007-11-15 Thread Carl Banks
s tricky, error prone, and defeats the purpose of keeping seperate namespaces. OTOH, if you find yourself delving several dots deep a lot, it suggests that you need to refactor you code. Move some of the code from the shallower classes into the deeper classes, closer to the data it needs. Hope this helped and didn't confuse you even more. :) Good luck learning. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Should proxy objects lie about their class name?

2007-11-26 Thread Carl Banks
to be tacit support from the language for mimicking the proxied classes in such ways. I guess for me it would be a judgment call on based how tight I wanted the proxy class to be--is it being the class, or is it just standing in? Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for ocbc example

2007-11-27 Thread Carl K
jay graves wrote: > On Sep 21, 2:43 am, Tim Golden <[EMAIL PROTECTED]> wrote: >> Carl K wrote: >>> It seems there are 2 odbc modules - pyOdbc and mxOdbc - anyone know the >>> difference? >> In short, pyodbc is open source; mxOdbc requires a commercial licens

Re: A context manager for temporary memoization.

2007-11-29 Thread Carl Banks
memoized( fib ) : > print fib.__doc__ > for i in xrange( 36 ) : >print "n=%d => %d" % (i, fib(i)) > print fib.__doc__ > print fib.__doc__ > > outputs : > > biggus fibbus > memoized version of function

Re: Witch editor to use!

2007-11-30 Thread Carl Banks
spe or shoud i use my favorite > > text editor! > > > i used IDLE on windows and it seamd nice. Now i have linux installed on > > my mashine and boa works, spe wont start, IDLE crashes when compailinfg! > > > And if editor is bether choice witch one to use! >

Re: Why Python 3?

2007-12-04 Thread Carl Banks
k the Python 3 effort has done well to keep things from getting out of hand; I expect transitions to be mostly smooth. Probably the trickiest aspect of transition will be getting Unicode and byte strings straight. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python surpasses Perl in TIOBE index

2007-12-04 Thread Carl Banks
s. > Even more amazing is the rate C++ is losing > ground:http://www.tiobe.com/tiobe_index/C__.html This might be the best of all. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python surpasses Perl in TIOBE index

2007-12-06 Thread Carl Banks
scripts that (paraphrasing the perl man page) require a bit more complexity than sed or awk; these sorts of things don't really need version control. Python is more geared to complex applications, so version control comes into play a lot more. It's not a surprise that Python would have more commits then, even back as far as 2000 when Perl was the shizzle. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: New subclass vs option in __init__

2007-12-07 Thread Carl Banks
) when > the new behavior changes only slightly the existing subclass, perhaps > a simple default option in the subclass's __init__ method would be > best. Where is the tipping point? Good question. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: New subclass vs option in __init__

2007-12-07 Thread Carl Banks
On Dec 7, 9:36 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-12-07, Carl Banks <[EMAIL PROTECTED]> wrote: > > > On Dec 6, 11:56 am, "Kurt Smith" <[EMAIL PROTECTED]> wrote: > >> It would seem that there are cases where one would be > &g

Re: How does python build its AST

2007-12-08 Thread Carl Banks
one gets bound to a? To do something similar in C would require preprocessor macros (ick). Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: setattr getattr confusion

2007-12-08 Thread Carl Banks
class Key(object): def __init__self): self.__dict__['props'] = KeyProps() def __getattr__(self,var): return getattr(self.props,var) def __setattr__(self,var,val): setattr(self.props,var,val) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm missing something here with range vs. xrange

2007-12-07 Thread Carl Banks
ate ten million integer objects dwarfs the time required to allocate a single list with ten million entries, and this cost occurs with both range and xrange, unless you break early. > Given the amount of performance difference, I don't see why > xrange even > exists. To keep memor

Re: Best way to protect my new commercial software.

2007-12-10 Thread Carl Banks
e OP was asked by a misguided management to make sure it was "reverse-engineer-proof". So any attempt to convince the OP may be aimed at the wrong person. Misguided as they are, sometimes you have to placate these people. So, are there any ways to make it "harder" to reverse engineer a

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread Carl Banks
. If it's for school you're probably covered, but in real world, it would be better to: 1. Rewrite calculation to avoid arccos and arcsin (using trigonometric or geometric identities) 2. Clamp it to range [-1.0:1.0]. You can do this in numpy with numpy.clip(). Carl Banks -- http://m

Re: state machine and a global variable

2007-12-14 Thread Carl Banks
def set_state(): return my_machine.get_state() Some users won't want the simplified interface. Really. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: container.___le___ can use only <=?

2007-12-15 Thread Carl Banks
en both be > supplied by the contained objects. And yet, by the same reasoning, using > and <= for list and tuple is also a "bad idea". > If a LarchTree user stores objects that don't support __gt__, > will he have a legitimate complaint when using LarchTree.__le__

Re: Pythonic way to add method alias in subclass

2007-12-15 Thread Carl Banks
tly more self-documenting. And if you had been using super(), you could have avoided repeating the symbol Foo. But 2 is more efficient and less typing than 3. Option 4 is abhorrent. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: container.___le___ can use only <=?

2007-12-15 Thread Carl Banks
On Dec 15, 9:05 am, [EMAIL PROTECTED] wrote: > On Dec 15, 8:33 am, Carl Banks <[EMAIL PROTECTED]> wrote: > > > > > On Dec 14, 4:15 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > > > When implementing the rich comparison operators for some sort of >

Re: New+old-style multiple inheritance

2007-12-18 Thread Carl Banks
plication to depend on their library? Sometimes you have to work with code that's not up to your standards, but come on. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: New+old-style multiple inheritance

2007-12-18 Thread Carl Banks
ng old and new style > classes. > > Monkey patching is definitely unpythonic. You must be a Ruby guy. Why > don't you try doing something else to get the behavior you want, > something more explicit? Time and place. A well-considered, timely monkey-patch can sometimes save all kinds of workarounds and other headaches. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: It's ok to __slots__ for what they were intended (was: Don't use __slots__ (was Re: Why custom objects take so much memory?))

2007-12-18 Thread Carl Banks
p anyone. The OP wanted to minimize memory usage, exactly the intended usage of slots. Without knowing more about the OP's situation, I don't think your or I or Chris Mellon can be sure it's not right for the OP's situation. You're obviously smart and highly expert i

Re: New+old-style multiple inheritance

2007-12-19 Thread Carl Banks
On Dec 19, 10:55 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Dec 18, 3:16 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > > > On Dec 18, 10:08 am, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > We are trying to monkey-patc

Re: In an inherited class, "embedded" classes is referenced?

2007-12-19 Thread Carl Banks
dict): for key,value in clsdict.iteritems(): if isinstance(value,type): clsdict[key] = type(value.__name__,(value,),{}) type.__new__(cls,name,bases,clsdict) class A(object): __metaclasS__ = AutoSubclassMetaclass class C(object): foobar = 40 class B(A): pass Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

mac dashboad

2007-12-21 Thread Carl K
How do I hang an app off the mac dashboard? The goal is a python version of Weatherbug. something like: read xml data from a URL, display some numbers, mouse over shows more details Carl K -- http://mail.python.org/mailman/listinfo/python-list

Re: mac dashboad

2007-12-21 Thread Carl K
ianaré wrote: > On Dec 21, 12:37 pm, Carl K <[EMAIL PROTECTED]> wrote: >> How do I hang an app off the mac dashboard? >> >> The goal is a python version of Weatherbug. >> >> something like: >> read xml data from a URL, >> display some num

Re: mac dashboad

2007-12-21 Thread Carl K
Chris Mellon wrote: > On Dec 21, 2007 3:25 PM, Carl K <[EMAIL PROTECTED]> wrote: >> ianaré wrote: >>> On Dec 21, 12:37 pm, Carl K <[EMAIL PROTECTED]> wrote: >>>> How do I hang an app off the mac dashboard? >>>> >>>> The goal is a

convert pdf to png

2007-12-23 Thread Carl K
I need to take the take the pdf output from reportlab and create a preview image for a web page. so png or something. I am sure ghostscript will be involved. I am guessing PIL or ImageMagic ? all sugestions welcome. Carl K -- http://mail.python.org/mailman/listinfo/python-list

Re: convert pdf to png

2007-12-24 Thread Carl K
Jaap Spies wrote: > Carl K wrote: >> I need to take the take the pdf output from reportlab and create a >> preview image for a web page. so png or something. I am sure >> ghostscript will be involved. I am guessing PIL or ImageMagic ? >> >> all sugestions welco

Re: convert pdf to png

2007-12-24 Thread Carl K
Grant Edwards wrote: > On 2007-12-24, Carl K <[EMAIL PROTECTED]> wrote: > >>> If it is a multi page pdf Imagemagick will do: >>> >>> convert file.pdf page-%03d.png >> I need python code to do this. It is going to be run on a >> someone else&#x

Re: convert pdf to png

2007-12-24 Thread Carl K
Andrew MacIntyre wrote: > Grant Edwards wrote: >> On 2007-12-24, Carl K <[EMAIL PROTECTED]> wrote: >> >>>> If it is a multi page pdf Imagemagick will do: >>>> >>>> convert file.pdf page-%03d.png >>> I need python code to do th

Re: convert pdf to png

2007-12-24 Thread Carl K
Jaap Spies wrote: > Carl K wrote: >> Grant Edwards wrote: >>> On 2007-12-24, Carl K <[EMAIL PROTECTED]> wrote: >>> >>>>> If it is a multi page pdf Imagemagick will do: >>>>> >>>>> convert file.pdf page-%03d.png >&

Re: convert pdf to png

2007-12-25 Thread Carl K
Diez B. Roggisch wrote: > Carl K schrieb: >> Grant Edwards wrote: >>> On 2007-12-24, Carl K <[EMAIL PROTECTED]> wrote: >>> >>>>> If it is a multi page pdf Imagemagick will do: >>>>> >>>>> convert file.pdf page-%03d.pn

Re: convert pdf to png

2007-12-25 Thread Carl K
Rob Wolfe wrote: > Carl K <[EMAIL PROTECTED]> writes: > >> I need to take the take the pdf output from reportlab and create a >> preview image for a web page. so png or something. I am sure >> ghostscript will be involved. I am guessing PIL or ImageMagic ? >>

Re: convert pdf to png

2007-12-26 Thread Carl K
Grant Edwards wrote: > On 2007-12-25, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >> Carl K schrieb: >>> Grant Edwards wrote: >>>> On 2007-12-24, Carl K <[EMAIL PROTECTED]> wrote: >>>> >>>>>> If it is a multi page pdf Imagem

Re: PEP 359: The "make" Statement

2006-04-17 Thread Carl Banks
h to justify a new statement. Metaclasses aren't too common, and are generally used by experts who don't need the straightforwardness the make statement would provide. But, properties, dicts, and other things could benefit from some of the semantics the class statement, and with the make statem

Re: PEP 359: The "make" Statement

2006-04-17 Thread Carl Banks
Tim Hochberg wrote: > Carl Banks wrote: > > Mike Orr wrote: > > > >>>I think this PEP is going off the rails. It's primary virtue was that it > >> > >>was a simpler, clearer way to write: > >> > >> class Foo(args): > &g

Re: Method Call in Exception

2006-04-19 Thread Carl Banks
same exception; might have to disambiguate them somehow in the except block. Language-wise, I doubt there are any serious gotchas whem running regular (as opposed to error handling) code in an except block. So go right ahead; no need to feel guilty about it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing interfaces in Python...

2006-04-19 Thread Carl Banks
es be mature enough that writing interface definitions would be useful and not a burden. (And let's face it: there aren't many projects that get that far. :) Adaptation I have no comment about, not having needed it (yet). Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: what has python added to programming languages? (lets be esoteric, shall we ; )

2006-04-21 Thread Carl Banks
e not - or hardly - existed in programming > before python? Nesting by indentation Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: what has python added to programming languages? (lets be esoteric, shall we ; )

2006-04-21 Thread Carl Banks
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Carl Banks <[EMAIL PROTECTED]> wrote: > >Wildemar Wildenburger wrote: > >> Are there any concepts that python has not borrowed, concepts that were > >> not even inspired by other languages? I'

Re: OOP / language design question

2006-04-25 Thread Carl Banks
[EMAIL PROTECTED] wrote: > Heiko Wundram wrote: > > Because sometimes you don't want to call the base classes constructors? > Sounds strange to me at the moment, but I'll try to adjust to this > thought. In Java and C++, classes have private members that can only be accessed by the class itself (a

Re: OOP / language design question

2006-04-25 Thread Carl Banks
that I'd say that Python __init__ is analogous to Java and C++ constructors, but is not a constructor because C++ and Java constructors are not constructors. :) And Java has pointers, not references. :) A-rose-by-any-other-name-ly yr's, Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: OOP / language design question

2006-04-25 Thread Carl Banks
Duncan Booth wrote: > In other words, the object is constructed in Python before any __init__ is > called, but in C++ it isn't constructed until after all the base class > constructors have returned. That's true. Good point. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: OOP / language design question

2006-04-26 Thread Carl Banks
t yet been > set up. In Python, if you try to use an uninitialized member you get an AttributeError; I really don't see too much inherent danger here. If you make a mistake, the language tells you and you fix it. C++ and Java are worse since accessing uninitialized variables is a silen

Re: A defense for bracket-less code

2006-04-26 Thread Carl Banks
ine if can't be > followed by an else. Thus proving the original claim about it being confusing. :) I think he intended it to parse this way: if ($x) { $y++ if $z; } else { $z--; } Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: OOP / language design question

2006-04-27 Thread Carl Banks
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > "Carl Banks" <[EMAIL PROTECTED]> wrote: > > >bruno at modulix wrote: > >> [EMAIL PROTECTED] wrote: > >> > I was wondering, why you always have to remember to call bas

Re: unable to resize mmap object

2006-05-02 Thread Carl Banks
It would accept a filename rather than a file descriptor, anonymous blocks would be handled OS-independently, rather than mapping /dev/zero, and so on.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuple assignment and generators?

2006-05-04 Thread Carl Banks
q = 0 >>> r = 0 >>> s = 0 >>> id(q) 134536636 >>> id(r) 134536636 >>> id(s) 134536636 [snip] > My rule, don't do it unless you know exactly why you > want to do it. It will trip you up at some point and > be VERY hard to find. It's ok to do it with constant objects, really. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuple assignment and generators?

2006-05-05 Thread Carl Banks
e? If yes, then use ==. 0 == 0 should be true even if the two zeros are different objects. Corrollary: You should test for singleton objects with is. None, NotImplemented, and Ellipsis are singleton objects; this is part of the language and not an implementation detail. You can rely on

Re: Multi-line lambda proposal.

2006-05-09 Thread Carl Banks
ultiple times in the same statement. Try showing what they look like nested. The "readable" example would turn into ASCII vomit. Probably the day it makes it into Python is the day Python jumps the shark. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Can Python installation be as clean as PHP?

2006-05-09 Thread Carl Banks
gle-file executables. PyInstaller works on Unix too, IIRC. If you're good at tweaking stuff and have some knowledge of Python internals; it's possible to make a minimal distro just by copying files out of a regular installation by hand (and maybe zipping some them up). This can be a

Re: Can Python installation be as clean as PHP?

2006-05-09 Thread Carl Banks
G. Monzón wrote: > Please don't compare PHP with Python... They are very different worlds. I'm not. I was simply agreeing that the single executable way the OP claimed PHP does it can *sometimes* be preferrable in Python, and giving him recommendations thereto. Carl Ba

Re: New tail recursion decorator

2006-05-10 Thread Carl Banks
n func(*args,**kwd) > return iterfunc CONTINUE could be put inside tail_recursive, couldn't it? And to squeeze a little more speed out of it, var could be a list (saves a hash lookup). Cool decorator. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Time to bundle PythonWin

2006-05-11 Thread Carl Banks
ction for SGI IRIX modules, and IRIX support is scheduled to be dropped in Python 3000. There might be a good reason why win32 isn't in Python base distro, but that it's Windows-only isn't it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: distributing a app frozen by cx_freeze

2006-05-12 Thread Carl Banks
shared library (if the license allows it, of course), or rebuild the qt.so with the static QT libraries. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: distributing a app frozen by cx_freeze

2006-05-13 Thread Carl Banks
u're doing this on Linux, it's not all that unreasonable to require QT to be installed on the target system. Any reasonable distribution has it nicely packaged. But, if you must, "ldd qt.so" will list library dependencies of qt.so. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Script to make Windows XP-readable ZIP file

2006-05-18 Thread Carl Banks
gt; Position the CWD in the desired base directory of > the archive, > add the files to the archive using their relative pathnames, and put > the CWD back > where it was when you started: This may be the best way anyways, unless you have some reason to not change the current directory. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3102 for review and comment

2006-05-20 Thread Carl Banks
modifier (like Ada's "in and out") instead? Problem with that is then positional arguments line up wrong. Ick. def func(a : int = 1): pass def func(a : kwonly int = 1): pass Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception style (was: calling python functions using variables)

2006-05-20 Thread Carl Banks
alling it and catch CallableError (or whatever it is). Of course, that error can be raised inside the function; and in this case, there's no way to isolate only the part you you're checking for an exception. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception style (was: calling python functions using variables)

2006-05-20 Thread Carl Banks
hecking is appropriate to it -- and if needed, raise > some custom "command failure" exception after handling the real failure > internally. That probably doesn't help when the exception is due to a bug and not bad input. If you have an AttributeError due to a bug, it w

Re: noob import question

2006-05-20 Thread Carl Banks
. So queuing instead of Queue. Unfortunately, the Python library isn't setting a good example here. Too much glob.glob, time.time, socket.socket, and Queue.Queue. I hope all these go away in Python 3000. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread Carl Banks
tianly negative) pronouncement, so we have it on the record. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP-xxx: Unification of for statement and list-comp syntax

2006-05-21 Thread Carl Banks
in y: if x is not None: _.append(x) In other words, each for and if in a listcomp is equivalent to a nested block in a regular statement. There's a regular way to nest, and listcomp way, and they're separate. This PEP suggests we should mix them up--now *that'

Re: Counter-spam: Change the subject

2007-12-26 Thread Carl K
PROTECTED]:~$ cat /etc/hosts 127.0.0.1 localhost 127.0.0.1 asus17.personnelware.comasus17 127.0.0.1 newsgroups.comcast.net Carl K -- http://mail.python.org/mailman/listinfo/python-list

Re: Extracting images from a PDF file

2007-12-26 Thread Carl K
I am trying to convert the pdf to a png, but without having to run external commands. so I will understand if you arn't happy with pdfimages. Carl K -- http://mail.python.org/mailman/listinfo/python-list

Re: list in a tuple

2007-12-27 Thread Carl Banks
nnoys quite a few people. When you reply to a message, please move your cursor to below the quoted message before you begin typing. Thank you Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Cheat sheet

2007-12-27 Thread Carl Banks
ne or two about the set objects. (It's probably at least better than listing internal objects.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: convert pdf to png

2007-12-28 Thread Carl K
pre-processing goes: the pdf is generated from data the user just entered into a web page. it may not even be saved to the DB yet. the new ImageMagick bindings should do what I need: http://www.procoders.net/?p=39 Carl K -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system question

2007-12-28 Thread Carl Banks
which seems to be what you need. In IDLE, you'll have to capture the output of the programs and print it yourself, since you can't (AFAIK) run a DOS shell in an IDLE window. Untested: import subprocess output = subprocess.Popen('MD "' + new_folder + '"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0] print output Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: fastest method to choose a random element

2008-01-05 Thread Carl Banks
: for i in xrange(len(x)-1): j = random.randrange(i+1,len(x)) tmp = x[j] if test_property_func(tmp): return tmp x[j] = x[i] x[i] = tmp return None Then, for example, use it like this: def odd(i): return i&1 e = random_element_with_proper

Re: list property fires get on append

2008-01-06 Thread Carl Banks
hildren to be an instance attribute rather than a class attribute, so I redid it that way, but .) P.S. Is calling a method called "firing" in C#? Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: python interfaces

2008-01-06 Thread Carl Banks
en than a benefit, especially in code that is young and still subject to lots of redesign and refactoring. And ehen interfaces do make sense, such as in a plugin system or a complex framework, the user should be free to ignore the interface at his own risk. Carl Banks -- http://mail.python.or

Re: Python's great, in a word

2008-01-07 Thread Carl Banks
7;ve done enough to choose. "it doesn't suck". (Really. All programming languages have good, useful features. Even Perl. Python is unique in having no very bad ones.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's great, in a word

2008-01-08 Thread Carl Banks
quot;its pythonicity". Mixing Greek and Latin suffixes usually works better than mixing Greek and Germanic, doesn't it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: for loop without variable

2008-01-09 Thread Carl Banks
intrc file (location may vary on Windows) and there was a declaration in the file that listed symbols to ignore. Last time I bothered running it, I added "id" to that list, since I use it often (bad habit) and almost never use the builtin id, but still wanted shadowing warnings for othe

Re: Pygame w/ GUI

2008-01-09 Thread Carl Banks
the event loop, same as most GUIs do. Plus it's not straightforward to integrate the SDL window into the widget systems. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: for loop without variable

2008-01-10 Thread Carl Banks
repeat" as the keyword.) 1. Looping a fixed number of times is quite uncommon. 2. A syntax for it buys you almost nothing. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Magic function

2008-01-11 Thread Carl Banks
Obj(*args) self.tracked_objs.add(obj) return obj def run(self): for obj in self.tracked_objs: # do something with obj bigobj = Bigobj() obj1 = bigobj.create_object(params1) obj2 = bigobj.create_object(params2) # maybe do something with obj1 and obj2 here bigobj.run() Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: where do my python files go in linux?

2008-01-12 Thread Carl Banks
I recommend putting *.py files there as well, so users can refer to it if there are any problems, but you don't have to. The Python module compileall is your friend here. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: where do my python files go in linux?

2008-01-12 Thread Carl Banks
hatever to their path path and use it that way. I realize it's a fine line and a judgment call in some cases, but site- packages is really for libraries; applications should use their own directories. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Is unicode.lower() locale-independent?

2008-01-12 Thread Carl Banks
ighted that str.rstrip() > removed the trailing-padding-for-nicer-layout no-break spaces that the > users had copy/pasted from some clown's website :-) > > What was the *real* cause of your irritation? If you want to use str.split() to split words, you will foil the user who wants to not break at a certain point. Your use of rstrip() is a lot more specialized, if you ask me. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: SyntaxError: 'import *' not allowed with 'from .'

2008-01-14 Thread Carl Banks
recursion. Or, perhaps something more subtle than infinite recursion, such as hard-to-comprehend rules about what modules and subpackages would be imported. So they just decided to disallow it. Just a guess. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: module naming conventions

2008-01-14 Thread Carl Banks
? Is there a best practices guide for module > naming? Not really. Try to pick a unique name for your project. <:\ Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: TopSort in Python?

2008-01-18 Thread Carl Banks
dia article, which led me to the topsort algorithm. I did a dance of joy. Ten minutes later I saw it mentioned it on comp.lang.python. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Using "pickle" for interprocess communication - some notes and things that ought to be documented.

2008-01-18 Thread Carl Banks
ng "univeral newlines" in a non-text format seems like it's not a good idea. For text-format pickles it'd be the right thing, of course. > Incidentally, in the subprocess, it's useful to do > > sys.stdout = sys.stderr > > after setting up the Pick

Re: I don't understand what is happening in this threading code

2008-01-18 Thread Carl Banks
quot; > % id(w.should_keep_running)) > > if __name__ == "__main__": > main() It looks like your program's hanging while the waiter is waits to acquire another plate of hot food. Quick and dirty solution is to have waiter timeout at intervals while waiting for the chef and check the clock to see if his shift has ended. Better solution is to rewrite the logic, which you did. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Module/package hierarchy and its separation from file structure

2008-01-24 Thread Carl Banks
f itself). You can reassign the class's module: from org.lib.animal.monkey import Monkey Monkey.__module__ = 'org.lib.animal' (Which, I must admit, is not a bad idea in some cases.) Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: translating Python to Assembler

2008-01-24 Thread Carl Banks
On Jan 24, 10:14 am, Bjoern Schliessmann wrote: > Tim Roberts wrote: > > Grant is quite correct; Python scripts (in the canonical CPython) > > are NOT compiled into assembly language. Scripts are compiled to > > an intermediate language. Processors execute Python scripts when > > the interpreter

Re: Module/package hierarchy and its separation from file structure

2008-01-25 Thread Carl Banks
t least for classes, without softening the one-to-one module-to-file relationship, or using "hacks". In fact, I'd say this is good practice. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Generational Interfaces

2008-01-25 Thread Carl Banks
s when it's not there. Make sense? Details can vary, but that's the basic idea. In this way, you can combine some of the openness that helps in early development, but also have some of the benefits of stricter typing when things mature and turn out to be pretty strictly useful, withou

Re: Generational Interfaces

2008-01-25 Thread Carl Banks
On Jan 26, 12:32 am, Paul Rubin <http://[EMAIL PROTECTED]> wrote: > Carl Banks <[EMAIL PROTECTED]> writes: > > AirplaneInterface = InterfaceTracker("Airplane") > > ... > > set_up_initial_state() > > ... > > Airplane

Re: Generational Interfaces

2008-01-26 Thread Carl Banks
appropriate for that particular use. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Module/package hierarchy and its separation from file structure

2008-01-29 Thread Carl Banks
ISTM you came here looking for a particular means and not a particular end. Python already has the power to meet your stated needs, but you won't use that solution because it's "hacky". Apparently all you really wanted was the loosened file structure in the first place. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Module/package hierarchy and its separation from file structure

2008-01-30 Thread Carl Banks
quot;unintended consequences", by a very large margin. Python has always been one-to-one module-to-file (excepting modules built into the interpretter), and many codes and tools have come to depend on it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: Naive idiom questions

2008-01-31 Thread Carl Banks
effect other than by writing separate, independent > manpages? Not a big expert on docstrings (they seem so superfluous...) but perhaps there are third-party packages that let you specify meta- documentation with function decorators. For example: @overview("Blah blah blah") @authors("So and so") def some_function(): pass Try looking on PyPI (cheeseshop.python.org). Python's in-code documentation is pretty basic; I think Python is happy to outsource more elaborate schemes to third party packages. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

Re: very simple Genetic Algorithm completed

2008-02-01 Thread Carl Banks
on, to get a random index in a range. Perhaps even better still, use random.choice. It gets a random element in a sequence. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list

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