Re: Testing the availability of a module

2005-12-19 Thread Erik Max Francis
ImportError in your except clause. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Substance is one of the greatest of our illusions. -- Sir Arthur Eddington -- http://mail.python.org/mailman/listinfo/python-list

Re: parsing engineering symbols

2005-12-20 Thread Erik Max Francis
t; => 12000.0 > I searched the web, but could not find any function. There's some extensive code in the SI class in BOTEC which does this: http://www.alcyone.com/software/botec/ -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/

Re: How to check if a string "is" an int?

2005-12-21 Thread Erik Max Francis
eError: ... do something else ... -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis May it not be that, at least, the brighter stars are like our Sun, the upholding and energizing ce

Re: How to check if a string "is" an int?

2005-12-21 Thread Erik Max Francis
. To make sure you get it right, you'll have to do exactly what the Python parser does in order to distinguish integer literals from other tokens. Taken to the extreme for other types, such as floats, you're far better off just using the internal mechanisms that Python itself uses,

Re: How to check if a string "is" an int?

2005-12-21 Thread Erik Max Francis
e latter is clearly a more useful functionality. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Make it come down / Like molasses rain -- Sandra St. Victor -- http://mail.python.org/mailman/listinfo/python-list

Re: serialize object in jython, read into python

2005-12-22 Thread Erik Max Francis
Noah wrote: > You can give up on pickle, because pickle is only > guaranteed to work with the exact same version of the Python > interpreter. Not true. You're thinking of marshal. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jos

Re: call static function from extension module - syntaxerror

2005-12-22 Thread Erik Max Francis
f and > using setup. My method is defined as > > static PyMethodDef ast_man_methods[] = { > {"exec",exec,METH_VARARGS,"Execute Asterisk commands."}, > {NULL,NULL,0,NULL} > }; > > What might be my problem?? exec is a reserved word. >>> exe

Re: Vector math library

2005-12-31 Thread Erik Max Francis
o do vector > addition, cross products, dot products etc. and probably in the future > I'll need matrix math as well. ZOE has an la a module that helps with linear algebra computations including (three-dimensional) vectors and matrices: http://www.alcyone.com/software/zoe/

Re: Unicode Question

2006-01-09 Thread Erik Max Francis
David Pratt wrote: > This is not working for me. Can someone explain why. Many thanks. Because '\xbe' isn't UTF-8 for the character you want, '\xc2\xbe' is, as you just showed yourself in the code snippet. -- Erik Max Francis && [EMAIL PROTECTED] &&a

Re: Limiting the size of List and making it Homogeneous

2006-01-13 Thread Erik Max Francis
nts of type int. > C, C++: >int intarr[5] > How can I achieve this kind of behavior ? Use a list and keep it of length 5. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis

Re: On Numbers

2006-01-16 Thread Erik Max Francis
e whether your hierarchy of numeric types includes a complex type or not. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Walk into a room and make the / Whole interior inferior -- Ice Cube -- http://mail.python.org/mailman/listinfo/python-list

Re: On Numbers

2006-01-18 Thread Erik Max Francis
t; Mathematica. Note that cmath.sqrt returns the expected complex result for cmath.sqrt(-1.0). -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Our purpose is to make the agony o

Re: On Numbers

2006-01-18 Thread Erik Max Francis
out that cmath.sqrt is what you want if you really do want the complex result rather than the principal real one. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Dear World: I am le

Re: String handling and the percent operator

2006-07-13 Thread Erik Max Francis
t;for w in words: > yield w > > message = "%s %s %s %s" > > print message % SentenceGenerator() > > (I ask because the above doesn't work)? Use tuple(SentenceGenerator()). A generator is just another object, so using it with the % operator tries to sub

Re: String handling and the percent operator

2006-07-14 Thread Erik Max Francis
Tom Plunket wrote: > Excellent. Thanks. Has this been around long? I "learned" Python in > the 1.6 days iirc, but haven't done much except simple scripting with > it since... Yep. Been around since at least 1.5.x. -- Erik Max Francis && [EMAIL PROTECTE

Re: String handling and the percent operator

2006-07-14 Thread Erik Max Francis
se:: aFormatString % anObject is a shortcut for:: aFormatString % (anObject,) so things like:: print "Your birthday is on %s" % date are allowed. So when the object is an iterator, it's just treated as a single value in a 1-tuple, rather than iterate

Re: Coding style

2006-07-17 Thread Erik Max Francis
Donn Cave wrote: > Tac-tics is right, an empty list is not False. But that's not what he said. He said it was "not false." That's wrong. It's false. It's just not False. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/ma

Re: Coding style

2006-07-17 Thread Erik Max Francis
riginal question was, "The first one." Feel free to write it the other way with an explicit test, but it's not Pythonic. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM eri

Re: building an index for large text files for fast access

2006-07-24 Thread Erik Max Francis
alex23 wrote: > The standard library module 'libcache' does exactly what you're > considering implementing. I believe the module you're referring to is `linecache`. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ Sa

Re: singleton decorator

2006-08-07 Thread Erik Max Francis
Andre Meyer wrote: > Am I missing something here? What is the preferred pythonic way of > implementing singleton elegantly? Create a class and then derive from it. There are examples on the Cookbook. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/ma

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-08 Thread Erik Max Francis
path will invariably be wrong. (Yes, for those about to nitpick, it's conceivable that env might be somewhere other than /usr/bin. However, that is very rare and results in a no-win situations regardless of the issue of where Python is installed.) -- Erik Max Francis && [EMAIL P

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-08 Thread Erik Max Francis
nX.Y would be a better choice. (Maybe that's what you meant.) -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Never contend with a man who has nothing to lose. -

Re: How to reverse tuples in a list?

2006-08-08 Thread Erik Max Francis
h list comprehensions? Use reversed: >>> t = (1, 2, 3) >>> u = tuple(reversed(t)) >>> u (3, 2, 1) -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM er

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
Stephan Kuhagen wrote: > MichaƂ Bartoszkiewicz wrote: > >> #!/bin/sh >> """exec" python "$0" "$@""" > > Wow, cool... I like that! Only someone genuinely fond of the Tcl hack could ... -- Erik Max Francis && [

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
evel of a sh interpreter -- thereby, defeating the purpose? -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Only those who dare to fail greatly can ever achieve greatly. -- Robert F. Kennedy -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
the right thing but foil `file`, intentionally or unintentionally -- just as we've seen in this thread. The right way to approach this with `file` is to acknowledge that such tricks are inherently sh-specific and leave it identified as a sh file. Because that is, of course, exactly what it

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
's processing, which is what the previously discussed tricks amount to. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Punctuality is the virtue of the bored. -- Evelyn Waugh -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
rly not if almost all tcl-scripts are > started that way. The problem is that there are endless ways to do that, and figuring out all the cases makes `file` an sh interpreter, not the magic number detector it's supposed to be. -- Erik Max Francis && [EMAIL PROTECTED] && h

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
not having publicly-writable things in your PATH. In other words, this is the argument for not putting things like /tmp or . (because you might cd to somewhere publicly writable like /tmp) in your PATH, not really for avoiding /usr/bin/env in hash bangs. -- Erik Max Francis && [EMAIL P

Re: Global Objects...

2006-08-15 Thread Erik Max Francis
KraftDiner wrote: > myGlobalDictionary doesn't seem to be visible to my someClass methods. > Why? What should I do? Specify more clearly what is happening, what you wanted it to do, and why you think it's wrong? You haven't given enough information. -- Erik Max Franci

Re: Can I do this with list comprehension?

2006-08-22 Thread Erik Max Francis
[4, 8, 10] > > Any hints? >>> from itertools import izip >>> a = [0, 1, 0, 1, 1, 0] >>> b = [2, 4, 6, 8, 10, 12] >>> [y for x, y in izip(a, b) if x == 1] [4, 8, 10] -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/

Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton

2006-10-05 Thread Erik Max Francis
Ilias Lazaridis wrote: > please relax and do not speak for all current and future readers > (archives). He may not be speaking for all of them, but he's speaking for the vast majority. You are a consummate pest. -- Erik Max Francis && [EMAIL PROTECTED] && http:/

Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton

2006-10-06 Thread Erik Max Francis
Steve Holden wrote: > I have to say I find the colour of your socks *much* more interesting. Especially what with the skulls and all. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M e

Re: class print?

2006-10-07 Thread Erik Max Francis
SpreadTooThin wrote: > Hi... Many python object can be printed simpy by saying: > print obj > what method(s) need to be implemented in my own classes such that print > dumps the object? __str__ -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/

Re: Painless way to do 3D visualization

2006-10-08 Thread Erik Max Francis
So, I'd really appreciate any hints as to where to look for anything a > little more usable. There's also ZOE: http://www.alcyone.com/software/zoe/ but if a lack of documentation turned you off to VPython then ZOE is probably not for you either. -- Erik Max Francis &&

Re: Python component model

2006-10-11 Thread Erik Max Francis
Ilias Lazaridis wrote: > http://dabodev.com > http://case.lazaridis.com/wiki/DaboAudit Who. Cares. What. You. Think? -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfran

Re: shuffling elements of a list

2006-06-01 Thread Erik Max Francis
David C. Ullrich wrote: > Good example, because we know that EMF is not dumb. I've seen > the same algorithm many times - the best example is ... Man, an error made _six years ago_ and people are still bringing it up ... -- Erik Max Francis && [EMAIL PROTECTED] &&

Re: An oddity in list comparison and element assignment

2006-06-01 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > With all due respect to your well-deserved standing in the Python > community, I'm not convinced that equality shouldn't imply invariance > under identical operations. Doo you really want 2 == 2.0 to be False? -- Erik Max Francis

Re: C# equivalent to range()

2006-06-01 Thread Erik Max Francis
They actually wanted to talk about Python, not some random other language that you're trying to learn that has nothing to do with it ... -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM e

Re: Max function question: How do I return the index of the maximum value of a list?

2006-06-04 Thread Erik Max Francis
gene tani wrote: > http://www.rubyquiz.com/quiz24.html His question was for three-card poker, not normal poker. The ranking of hands in three-card poker isn't the same as in normal best five-card poker rankings; for instance, in three-card poker, a straight beats a flush. --

Re: Where is the ucs-32 codec?

2006-06-04 Thread Erik Max Francis
ll builds), > like the 'utf-8' codec does, right? Note that UTF-32 is UCS-4. UCS-32 ("Universial Character Set in 32 octets") wouldn't make much sense. Not that Python has a UCS-4 encoding available either. I'm really not sure why. -- Erik Max Francis && [EMA

Re: C# equivalent to range()

2006-06-04 Thread Erik Max Francis
owingly ask questions in the wrong places, and then actually _defend_ their actions after they're politely but firmly informed how to fix the problem. You're really not making yourself look any better by continuing this thread ... -- Erik Max Francis && [EMAIL PROTECT

Re: Where is the ucs-32 codec?

2006-06-05 Thread Erik Max Francis
lready supported. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Democritus may have come from Abdera, but he was no dummy. -- Carl Sagan -- http://mail.python.org/mailman/listinfo/python-list

Re: C# equivalent to range()

2006-06-05 Thread Erik Max Francis
saying that the "enjoy to waste their time niggling." He's complaining that people weren't nice to help. But they _were_. They answered his question politely and to the point. It's _he_ that turned rude after that. -- Erik Max Francis && [EMAIL PROTECTED] &am

Re: C# equivalent to range()

2006-06-05 Thread Erik Max Francis
| | http://www.catb.org/~esr/faqs/smart-questions.html Sorry, if you think those are unacceptable tones for responses to off-topic questions, the real world is going to be something of an unpleasant shock. He asked a question. He was told how to get the answer. No one was rude until _

Re: C# equivalent to range()

2006-06-05 Thread Erik Max Francis
Neuruss wrote: > The other zilion persons who were not interested (other than the four I > mentioned above) silently and peacefully ignored the question on went > on with their happy lifes. That's because many of them have killfiled you. -- Erik Max Francis && [EM

Re: the most efficient method of adding elements to the list

2006-06-05 Thread Erik Max Francis
alf wrote: > Would it be .append()? Does it reallocate te list with each apend? > > l=[] > for i in xrange(n): > l.append(i) No, it doesn't. It expands the capacity of the list if necessary. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcy

Re: CENSORSHIP - Django Project (Schema Evolution Support)

2006-06-07 Thread Erik Max Francis
Rene Pijlman wrote: > Wikipedia always tells the Absolute Truth, because if it doesn't, we can > edit it and fix it right away. Tell that to John Seigenthaler. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37

Re: CENSORSHIP - Django Project (Schema Evolution Support)

2006-06-07 Thread Erik Max Francis
Thorsten Kampe wrote: > I think I have a deja-vu... Did someone say "Xah"?! With a hint of Brandon. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Too much a

Re: Xah Lee network abuse

2006-06-10 Thread Erik Max Francis
Mallor wrote: > I know I'm coming late to the barbeque. In passing, I ask: do you have > an objective, impartial perspective on the subject of committing > crimes? Because libel is a crime. No, it is a tort. -- Erik Max Francis && [EMAIL PROTECTED] && http://www

Re: Xah Lee network abuse

2006-06-10 Thread Erik Max Francis
. Is there? Anyway, it's certainly a tort in all relevant jurisdictions here. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Covenants without the sword are but words. -- Camden -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah Lee network abuse

2006-06-10 Thread Erik Max Francis
something factually true is _not_ in and of itself a defense against a libel suit in the UK. As for the reverse side of the issue, in jurisdictions where it _is_ a defense, if one were to accuse him of being a pedophile but couldn't prove it, that would certainly be an actionable o

Re: Xah Lee network abuse

2006-06-11 Thread Erik Max Francis
libel. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis To perceive is to suffer. -- Aristotle -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah Lee network abuse

2006-06-11 Thread Erik Max Francis
rson who he was replying to, i.e., you. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Twenty-four hours a day, three-hundred sixty-five days a year as Secretary

Re: Xah Lee network abuse

2006-06-11 Thread Erik Max Francis
ibel law is not quite as simple as the original poster was making it out to be). If you don't wish to defend your position, that's fine, but pointing fingers is kind of weird at this stage. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jos

Re: Xah Lee network abuse

2006-06-11 Thread Erik Max Francis
Philippa Cowderoy wrote: > I'd still appreciate being referred to as "she" rather than "he" though. Oops, my bad. Never occurred to me after all these years, which is kind of embarrassing, actually :-). -- Erik Max Francis && [EMAIL PROTECTED] && h

Re: curses module bug in windows python?

2006-06-14 Thread Erik Max Francis
Tim Daneliuk wrote: > Nope - this module is not supported under Windows ... There's at least one Python curses module for Windows: http://adamv.com/dev/python/curses/ -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA &a

Re: String negative indices?

2006-06-22 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > Is there some magic I'm missing here? Wouldn't it actually be better for > Python to treat 0 as a > special case here, so that x[-2:0] and x[-2:] generated the same result? No, since x[-2:0:-1] already has meaning and it isn't what you want

Re: String negative indices?

2006-06-24 Thread Erik Max Francis
an matrices whose elements are reals, or something else? -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis My heart is pure as the driven slush. -- Tallulah Bankhead -- http://mail.python.org/mailman/listinfo/python-list

Re: String negative indices?

2006-06-25 Thread Erik Max Francis
nterpreted your "distinct, different, zeroes" as referring to the elements but not the matrices. Just a misunderstanding. Every zero matrix is an additive identity, and there are an infinite number of them. That's certainly true. -- Erik Max Francis && [EMAIL PROTECTED]

Re: Python question

2006-06-25 Thread Erik Max Francis
access this same data structure in this way multiple times before moving on to the next one, would be to turn it into a dictionary first:: d = dict(row) print d['min'] Note that all of these solutions assume that the key you want is indeed in there. If it might not be, t

Re: how do i make an array global

2006-06-27 Thread Erik Max Francis
i] = ... -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Every human being is a problem in search of a solution. -- Ashley Montagu -- http://mail.python.org/mailman/listinfo/python-list

Re: a class variable question

2006-06-27 Thread Erik Max Francis
. You mean:: class A: _var1 = 0 ... def func1(self): A._var1 = 1 All you're doing in your example is setting a local variable inside the func1 method, which has no effect. -- Erik Max Francis && [EMAIL PROTECTED] &&a

Re: a class variable question

2006-06-27 Thread Erik Max Francis
> > def func1(self): > self._var1 = 1 Note this only changes the attribute in the instance. If he wants it to be changed for all other instances, he needs to change it in the class with:: A._var1 = 1 -- Erik Max Francis && [EMAIL PROTECTED] && http://www

Re: how do i make an array global

2006-06-28 Thread Erik Max Francis
t have to be concerned about the precise case in which it's required, reducing bugs when you change a block so that it would have been required if you hadn't included it. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA &&

Re: defining multi dimensional array

2006-07-04 Thread Erik Max Francis
bruce wrote: > basic question.. > > how do i define a multi dimensional array > > a[10][10] > > is there a kind of a = array(10,10) It's just a list of lists. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ Sa

Re: language design question

2006-07-09 Thread Erik Max Francis
y to rewrite this using methods (member functions). >> [a.len() for a in ('abc', (1,2,3), [1,2], {1:2})] > > Did you actually try that? He was answering a hypothetical. He wasn't suggesting that was valid syntax today. -- Erik Max Francis && [EMAIL PROTECTED] &a

Re: 3d simulation

2006-07-10 Thread Erik Max Francis
alimoe wrote: >> Genetic Programming or Genetic Algorithms? > > whats the difference? Genetic algorithms usually involve the manipulation of bit strings. Genetic programming usually involves more program-like constructs, such as Lisp s-expressions. -- Erik Max Francis &&a

Re: Test for number?

2006-09-04 Thread Erik Max Francis
Helmut Jarausch wrote: > One step further > > try: >eval(x+'0') > That is an exceedingly bad idea. Type: __import__('sys').exit(), in the prompt and see what happens. You _never_ want to run `eval` on an untrusted string. Never. -- E

Re: time-based point system

2006-09-13 Thread Erik Max Francis
that, you can define (or get help defining) how to calculate them. As it is you've not given nearly enough information to answer your question. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W &

Re: time-based point system

2006-09-13 Thread Erik Max Francis
to define more clearly what properties of this negative function you want to narrow it down beyond that. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis Get married, bu

Re: time-based point system

2006-09-13 Thread Erik Max Francis
efine them up front, it results in a very unsatisfactory guessing game of proposing a function, you telling me what's wrong with it, and repeat until either or both of us get bored. And, by the way, this is a question about mathematics, and so has nothing to do specifically with Python.

Re: Strange behaviour of 'is'

2006-09-21 Thread Erik Max Francis
whether their identity is shared with other objects in other contexts is never significant. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis Little things / Cut like k

Re: eval(source, {'builtins': {}}) archived as Faq

2006-09-28 Thread Erik Max Francis
ource): return eval(source, {'builtins': {}}) ... >>> e('__import__("sys").exit()') Oops, the interpreter exited. Just when you think you've covered all the bases, you haven't. -- Erik Max Francis && [EMAIL PROTECTED] && http://ww

Re: eval(source, {'builtins': {}}) archived as Faq

2006-09-29 Thread Erik Max Francis
oit I gave wouldn't have worked so easily. The bottom line here is that you shouldn't even try to go through the exercise of seeing if you can bullet-proof a solution using eval; instead, you shouldn't even try. -- Erik Max Francis && [EMAIL PROTECTED] && http://ww

Re: type(foo) == function ?

2006-11-29 Thread Erik Max Francis
in general, explicit typechecks are not a good idea, since they often preclude user-defined objects from being used. Instead, try performing the call and catch the resulting TypeError: >>> f = 'asdf' >>> try: ... f() ... except TypeError: ... print "oops, f is

Re: How to test if two strings point to the same file or directory?

2006-12-16 Thread Erik Max Francis
x27;. That's what os.path.expanduser is for. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis It is much safer to obey than to rule. -- Thomas a Kempis -- http://mail.python.org/mailman/listinfo/python-list

Re: python , Boost and straight (but complex) C code

2006-12-30 Thread Erik Max Francis
> > namespace { // Avoid cluttering the global namespace. iostream and namespaces are both most definitely C++ features, not C. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfranc

Re: python , Boost and straight (but complex) C code

2006-12-30 Thread Erik Max Francis
s that you're dealing with C++ code throughout, not C, contrary to what you had claimed. C and C++ are not the same language. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M e

Re: Some thougts on cartesian products

2006-01-23 Thread Erik Max Francis
a set, then it should either be a generator or a set. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Nothing is potent against love save impotence. -- Samuel Butler -- http://mail.python.org/mailman/listinfo/python-list

Re: StringIO proposal: add __iadd__

2006-01-29 Thread Erik Max Francis
e as "temp_buf.write(v)". > So the suggestion is to add a __iadd__ method to StringIO and cStringIO. > > Any thoughts? Why? StringIO/cStringIO have file-like interfaces, not sequences. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/

Re: Why checksum? [was Re: Fuzzy Lookups]

2006-02-01 Thread Erik Max Francis
Are there any other reasons? Because if you store a hash, then you can keep that around even when the original file is archived, moved elsewhere, or deleted. It's awfully helpful for building databases of files you've seen before. -- Erik Max Francis && [EMAIL PROTECTED] &&

Re: A problem with some OO code.

2006-02-04 Thread Erik Max Francis
to get help will usually allow _you_ to see where the problem was in the process. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis God said: "Let Newton be"; and all w

Re: how do you pronounce 'tuple'?

2006-02-12 Thread Erik Max Francis
nced the latter if you list out the various pronounciations for large n, seems me the _uhs_ outweigh the _oos_. (There's quadruple on one side, but then quintuple, sextuple, septuple, heptuple, octuple, etc., etc., etc.) -- Erik Max Francis && [EMAIL PROTECTED] && http://w

Re: how do you pronounce 'tuple'?

2006-02-13 Thread Erik Max Francis
in its history when every post had to be accompanied by a Monty Python gag ... -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Whatever it is you came to teach me / I am here

Re: how do you pronounce 'tuple'?

2006-02-13 Thread Erik Max Francis
there are no cartesian products involved you're just talking about an element of a set, which is just a thing. Of course that's still a completely valid construct in Python so the question stands. If a 4-tuple is a quadruple, a 3-tuple is a triple, a 2-tuple is an pair, then I gues

Re: how do you pronounce 'tuple'?

2006-02-13 Thread Erik Max Francis
but there's already plenty of existing English usage such that 3-tuple : triple :: 2-tuple : pair. (A 2-tuple is an "ordered pair" in mathematics.) If a 2-tuple is a pair, then it would seem to follow that a 1-tuple is a single. -- Erik Max Francis && [EMAIL PROTECTED

Re: how do you pronounce 'tuple'?

2006-02-13 Thread Erik Max Francis
nipple? We don't talk about that anymore since the Incident. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Society attacks early when the individual is helpless. -- B.F. Skinner -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you pronounce 'tuple'?

2006-02-13 Thread Erik Max Francis
I don't think it's something we need to worry about. I'm sure you'd just call them "empty tuples" or "0-tuples" and move on :-). -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 5

Re: how do you pronounce 'tuple'?

2006-02-14 Thread Erik Max Francis
It's a "trip-you-uple", which you can pronounce anyway you like ;-) All I hear there is "triple you up," which is good if you're in a poker tournament, which I suppose tells you where my mind has been lately. -- Erik Max Francis && [EMAIL PROTECTED] &&

Re: aborting without killing the python interpreter

2006-02-18 Thread Erik Max Francis
tring (the help for sys.exit shows that if a string is passed in, it will be printed before the process exits with failure -- something I wasn't aware of actually). -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 2

Re: number ranges (was Re: Matlab page on scipy wiki)

2006-02-19 Thread Erik Max Francis
typically use a normal ellipsis "..." to indicate any sort of repeated pattern. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis To know oneself, one should assert oneself

Re: Mutable numbers

2006-02-20 Thread Erik Max Francis
cs doesn't change that fact. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis I will always remember / This moment -- Sade -- http://mail.python.org/mailman/listinfo/python-list

Re: Opening files without closing them

2006-03-05 Thread Erik Max Francis
> Just keep doing what you are doing, please. Note quite. The assignment of the resources to its variable needs to be done before the try: f = open(file) try: contents = f.read() finally: f.close() -- Erik Max Francis && [EMAIL PROTECTED] &

Re: Static Methods in Python

2005-05-01 Thread Erik Max Francis
aticMethod(x, y, z): ... aStaticMethod = staticmethod(aStaticMethod) -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Wyrd has swept all my kin / all the brave chiefs away

Re: How to detect a double's significant digits

2005-05-05 Thread Erik Max Francis
d not only is that a major PITA, you almost never get it > bug-for-bug right... Especially since all of his examples have the same number of significant digits (3), as the term is usually meant. Zeroes to the right are significant, not zeroes to the left. -- Erik Max Francis && [

Re: F.readline

2005-05-05 Thread Erik Max Francis
Robert Kern wrote: > There is no such command built in. You will have to build it yourself > out of the components that are available. linecache is probably what he's looking for. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose,

Re: How to detect a double's significant digits

2005-05-05 Thread Erik Max Francis
ly wanted to get the number of digits involved, then that's fine, but that's not what significance is. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Eternity is very long, especially near the end. -- Woody Allen -- http://mail.python.org/mailman/listinfo/python-list

Re: Fredrik Lundh

2005-05-08 Thread Erik Max Francis
D H wrote: > Yet again someone bitches about a thread right after they hypocritically > throw their own little darts into the mix. No one cares. Please take it elsewhere. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA &

Re: What are OOP's Jargons and Complexities?

2005-05-23 Thread Erik Max Francis
Jonathan Bartlett wrote: > I think you're misreading some of what is being said. I think you're giving the author too much credit. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AI

<    1   2   3   4   5   6   >