Re: help please

2005-02-12 Thread Erik Max Francis
a local, t2 is indeed referenced before it's assigned (t2 = t2 + letter). The fix is to declare t2 global at the top of Proc: def Proc(text): global t2 ... -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA

Re: For American numbers

2005-02-13 Thread Erik Max Francis
Dan Bishop wrote: They must have gotten the idea from floppy disks, which also use a 1024000-byte "megabyte". It's pretty common industry-wide. Memory is measured in binary prefixes (x 1024), but disk space and bandwidth are measured in decimal prefixes (x 1000). -- Erik Max Fr

Re: Pythonic poker client

2005-02-13 Thread Erik Max Francis
on -- as a tipoff to modified clients and bots. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis If love is the answer, could you rephrase the question? -- Lily Tomlin -- http://mail.python.org/mailman/listinfo/python-list

Re: For American numbers

2005-02-13 Thread Erik Max Francis
ed in kibibytes, but disk space is measured in kilobytes. Something as basic as "1 meg" has different numeric meanings depending on whether you're talking about memory or disk space or metered bandwidth usage. And a 1.44 MB isn't 1000^2 bytes or 1024^2 bytes, but rath

Re: Write Unicode str as utf-8

2005-02-14 Thread Erik Max Francis
there anyway I can patch python such that It will convert the unicode string to utf-8 before the write? Where should I start? codecs.open -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfran

Re: Bug in email package?

2005-02-20 Thread Erik Max Francis
re a good case to iterate over something useful in a message Why would it be a bug if the documentation never stated that the object was iterable? -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM e

Re: exercise: partition a list by equivalence

2005-02-20 Thread Erik Max Francis
John Machin wrote: Xah is asserting his right to be recognised as the author of his artistic creations, line by line. Not very well, however, since his usage doesn't constitute a valid copyright notice :-). -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/m

Re: Tuple index

2005-02-20 Thread Erik Max Francis
at's .find in strings that returns -1. .index in lists raises a ValueError: >>> [1, 2, 3].index(4) Traceback (most recent call last): File "", line 1, in ? ValueError: list.index(x): x not in list -- Erik Max Francis && [EMAIL PROTECTED] && http://www.al

Re: generic equivalence partition

2005-02-26 Thread Erik Max Francis
Xah Lee wrote: ... sorry for the latching on on this broadside issue, but it is impotant ... You made a typo in that last word there. Obviously you meant to write an _e_ instead of an _a_. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, US

Re: Dictionaries of Lists

2005-03-07 Thread Erik Max Francis
ompletely valid regardless of whether you converted it to a list or not. If that was just a thinko while you were asking the question, then the reason ([...]) didn't work is that it's just syntactically wrapping a list comprehension in parentheses, rather than turning them into a tupl

Re: Format strings that contain '%'

2005-03-08 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: I'm trying to do something along the lines of print '%temp %d' % 1 Traceback (most recent call last): File "", line 1, in ? ValueError: unsupported format character 't' (0x74) at index 1 Use %%: >>> '%%temp %d'

Re: None in string formatting

2005-03-08 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: Was doing some string formatting, noticed the following: x = None "%s" % x 'None' Is there a reason it maps to 'None'? I had expected ''. Because %s just calls str on the arguments, and str(None) == 'None'. -- Erik Max Fran

Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Erik Max Francis
be whether or not this as useful as one might thing in Python; if you find yourself doing this, often there are better ways to accomplish the same thing, such as using dictionaries. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA &&a

Python for Palm OS?

2004-12-07 Thread Erik Max Francis
both based on the 1.5 codebase, and both appear to be unmaintained (Pippy has the last news date in 2002; I couldn't find an obvious date for ). Is there any news regarding Python on the Palm OS front? -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/

Re: os.path.islink()

2004-12-08 Thread Erik Max Francis
Egor Bolonev wrote: gui folder link is a .lnk file What he's telling you is that Windows doesn't implement symbolic links. os.path.islink does not detect what you think it does. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA

Python RSS aggregator?

2004-12-17 Thread Erik Max Francis
een before. Somewhat surprisingly to me, I can't seem to find an aggregator that supports all these features (using Mozilla). Is it possible it's time for another Yet Another-type project? -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose,

Re: lambdas vs functions: a bytecode question

2004-12-17 Thread Erik Max Francis
t's a safety net to make sure you don't fall of the end of the function without returning anything; that is, the code analysis is not in place to see whether it's necessary to actually include in the bytecodes or not. -- Erik Max Francis && [EMAIL PROTECTED] && http

Re: CGI zombies with Apache 1.3 on Linux

2004-12-10 Thread Erik Max Francis
(sometimes) spin off a subprocess? -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Defeat is a school in which truth always grows strong. -- Henry Ward Beecher -- http://mail.python.org/mailman/listinfo/python-list

Re: How about "pure virtual methods"?

2004-12-18 Thread Erik Max Francis
Noam Raphael wrote: Well, what do you say? Raising NotImplementedError in the methods that need to be overridden is much more customary, more straightforward, and already works fine. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA &am

Re: BASIC vs Python

2004-12-20 Thread Erik Max Francis
time I used a Sparc - 4 years ago?) That's OpenBoot, the boot prompt. Most people never use that enough to even realize it has anything to do with Forth. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W

Re: Boo who? (was Re: newbie question)

2004-12-20 Thread Erik Max Francis
w bizarre is it that they're trying to "sell" Spry by indicating it uses the "very best" features of Prothon, given that Prothon was a failed project? -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20

Re: Boo who? (was Re: newbie question)

2004-12-21 Thread Erik Max Francis
n mentions ABC in background information on where Python comes from. But Python doesn't mention this as the first sentence in describing what its virtues are! -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121

Re: Boo who? (was Re: newbie question)

2004-12-21 Thread Erik Max Francis
, Pycs, or whatever its name is this week as being inspired by Prothon, a project that failed in every possible way there it to fail, doesn't impress anybody -- technically, marketing-wise, or any other criteria. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.c

Re: What is on-topic for the python list [was "Re: BASIC vs Python"]

2004-12-21 Thread Erik Max Francis
Doug Holton wrote: I'm not going to dignify that or the rest of your note with a response. Please stop dignifying the whole group, then. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM e

Re: trouble building python2.4

2004-12-22 Thread Erik Max Francis
of its banner. Further more, the poplib modules complains when I try to call the poplib.POP3_SSL class, saying that the module has no such class, though the online docs say it does. You've got a copy of Python 2.3.4 installed on your system which is in your PATH first. -- Erik Max Francis &

Re: The limitation of the Photon Hypothesis

2004-12-22 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: I definitely have no rights to judge this article but I have a vague idea that this fine article goes to a wrong place. Except that the topic thing is symbolically related: Photon hYpoTHesis limitatiON. It's a well-known and persistent crank. -- Erik Max Francis &

Re: printing anomaly

2005-03-20 Thread Erik Max Francis
r it's in a list. repr vs. str. The str of the sequence types prints the repr of their contents. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis History is a set of lies agreed upon. -- Napoleon Bonaparte -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs [was: function with a state]

2005-03-24 Thread Erik Max Francis
Xah Lee wrote: Very fucking stupid confusional writing. I agree. Oh, were you talking about the Python documentation? -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Men liv

Re: Win32 or Unix check in python

2005-03-28 Thread Erik Max Francis
GujuBoy wrote: how can you check in python at the beginning if you running the app in WIN32 or UNIX. import sys print sys.platform -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis

Re: return the last item in a list

2005-03-30 Thread Erik Max Francis
Raymond Hettinger wrote: I'm looking for an 'easy' way to have the last item in a list returned. Try mylist.pop() or mylist[-1]. Note that list.pop also removes the last element from the list in the process. -- Erik Max Francis && [EMAIL PROTECTED] && http://ww

Re: Lambda: the Ultimate Design Flaw

2005-03-31 Thread Erik Max Francis
Daniel Silva wrote: Shriram Krishnamurthi has just announced the following elsewhere; it might be of interest to c.l.s, c.l.f, and c.l.p: http://list.cs.brown.edu/pipermail/plt-scheme/2005-April/008382.html April Fool's Day again, eh? -- Erik Max Francis && [EMAIL PROTE

Re: Ternary Operator in Python

2005-04-01 Thread Erik Max Francis
Sean Kemplay wrote: You could use condition and consequent or alternative I use it You should do so cautiously, since if consequent is false, it will not behave as suspected. Not to mention that it's quite unreadable. -- Erik Max Francis && [EMAIL PROTECTED] && http://www

Re: Ternary Operator in Python

2005-04-01 Thread Erik Max Francis
wo would not be equivalent. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis If the sun comes up / And you're not home / I'll be strong -- India Arie -- http://mail.python.org/mailman/listinfo/python-list

Re: playing with pyGoogle - strange codec error

2005-04-05 Thread Erik Max Francis
he same script in java. This is making me wonder if there is an issue with the wrapper for the google api that was originally done in java. Java does not handle Unicode the same way. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 2

Re: Overwrite just one line? Am I a n00b or is this impossible? Both? :D

2005-04-06 Thread Erik Max Francis
pper bound you wish. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Be able to be alone. Lose not the advantage of solitude. -- Sir Thomas Browne -- http://mail.python.org/mailman/listinfo/python-list

Re: Overwrite just one line? Am I a n00b or is this impossible? Both? :D

2005-04-06 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: Ok the key was "r+b" as opposed to "a+b" but why is that? R is for read, correct? And b for binary. Adding the plus gives me some form of write capability? Read binary is "rb," but read-write binary is "r+b." The "+" me

Re: templating system

2005-04-10 Thread Erik Max Francis
emplate would look something like this:: @[for record in records]@ @record.title @[end for]@ Batch expanding the template would look like something as simple as (substituting in your example):: ... return em.expand(open(templateFilename).r

Re: templating system

2005-04-12 Thread Erik Max Francis
had a need to do so, so it's always been low priority. I've certainly never heard of any complaints of EmPy's speed (or lack therefore) as being a problem in the field. Unless you huge realtime demands, I doubt EmPy's speed would be a major impediment. (Of course, if you

Re: ANN: Python 2.3.2 for PalmOS available

2005-04-15 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: If anyone want to check this out, heres the url: http://pyar.decode.com.ar/Members/ltorre/PythonPalm Note the links are swapped; the one that says source package points to the .prc file, and the one that says .prc file goes to the source package. -- Erik Max Francis

Re: ANN: Python 2.3.2 for PalmOS available

2005-04-16 Thread Erik Max Francis
d never returns. It worked on my Treo 650, although you quickly ran out of space in the input text area (if you typed too many characters it would beep and prevent you from typing anymore). -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA,

Re: Proposal: an unchanging URL for Python documentation

2005-04-19 Thread Erik Max Francis
Fredrik Lundh wrote: did you check that link before you posted it? Works here. Your browser is probably concluding the trailing . is part of the URL, rather than sentence punctuation :-). -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA &

Re: ANN: Python 2.3.2 for PalmOS available

2005-04-19 Thread Erik Max Francis
RM wrote: I get odd results when trying to use exponents. For example: 4^2 6 Someone else already pointed out that ** is exponentiation. ^, on the other hand, bitwise exclusive or. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA &am

Re: Python Challenge ahead [NEW] for riddle lovers

2005-04-29 Thread Erik Max Francis
riday. Too bad it comes to an abrupt "temporary end". Ironically, I just used Unix tools (tr, grep, sed) for each of the puzzles except the first one, and that first one was only because I tend to use Python as a convenient calculator anyway :-). -- Erik Max Francis && [E

ANN: EmPy 3.3.2 released (Python 3.x compatibility)

2014-01-28 Thread Erik Max Francis
EmPy should work with any version of Python from 2.4 onward, including 3.x. License This code is released under the LGPL. Release history [since 3.3] - 3.3.2; 2014 Jan 24. Additional fix for source compatibility between 2.x and 3.0. - 3.3.1; 2014 Jan 22. Source c

What is the difference between these two? (Assigning functions to variables)

2014-11-04 Thread Max Nathaniel Ho
Example 1 def compose_greet_func(): def get_message(): return "Hello there!" return get_message greet = compose_greet_func() print greet() Example 2 def greet(name): return "hello "+name greet_someone = greet print greet_someone("John" In Example 1, the function compoe_

Re: What is the difference between these two? (Assigning functions to variables)

2014-11-04 Thread Max Nathaniel Ho
Just to be clear, I was referring to these two lines greet = compose_greet_func() greet_someone = greet On Wednesday, November 5, 2014 11:15:46 AM UTC+8, Max Nathaniel Ho wrote: > Example 1 > > def compose_greet_func(): > def get_message(): > return "Hello the

Re: What is the difference between these two? (Assigning functions to variables)

2014-11-04 Thread Max Nathaniel Ho
On Wednesday, November 5, 2014 2:00:08 PM UTC+8, Cameron Simpson wrote: > On 04Nov2014 19:17, Max Nathaniel Ho wrote: > >Just to be clear, I was referring to these two lines > > > >greet = compose_greet_func() > > > >greet_someone = greet > > Please

Re: while True or while 1

2012-01-21 Thread Erik Max Francis
7;s quite reasonable to assume that (even in Python 2) `True` is bound to something which is, in fact, true. The real reason people still use the `while 1` construct, I would imagine, is just inertia or habit, rather than a conscious, defensive decision. If it's the latter, it's a cas

Re: while True or while 1

2012-01-21 Thread Erik Max Francis
e idiomatic `while 1` notation comes from back in the pre-Boolean days. In any reasonably modern implementation, `while True` is more self-documenting. I would imagine the primary reason people still do it, any after-the-fact rationalizations aside, is simply habit. -- Erik Max Francis &&a

Re: Proposal: Inline Import

2005-12-10 Thread Erik Max Francis
y to import an already-imported module, inline or not, the second (or subsequent) imports are no-operations. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Golf is a good walk spoile

Re: ANN: pygene - genetic algorithms package

2005-12-10 Thread Erik Max Francis
ek or two. Hopefully I'll have a basic system ready by New Year's, but I can't really make any promises. The best way to encourage me to get it done is probably to keep me talking about it :-). -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max

Re: Another newbie question

2005-12-10 Thread Erik Max Francis
> a = point.x > b = point.x > assert (a is b)# can fail > > for that matter > > assert (point.x is point.x) > > can fail. These attributes aren't "member variables" any more. Which is perfectly fine, since testing identity with `

Re: "0 in [True,False]" returns True

2005-12-13 Thread Erik Max Francis
having Booleans, if you can't tell them from integers? Because return True is clearer than return 1 if the purpose of the return value is to indicate a Boolean rather than an arbitrary integer. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.c

Re: "0 in [True,False]" returns True

2005-12-13 Thread Erik Max Francis
sent true print x, y Besides, it's not the only reason, but it's a good one. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Ipsa scientia potestas est. "Kn

Re: "0 in [True,False]" returns True

2005-12-13 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > True too, and could be the reason(or similar too) why the OP wants to > test the type rather than the logical value of it. The type is for the self-documentation purposes. The value is the same; so no, that's not a good reason either. -- Erik Max Franci

Re: sql using characters like é and ã

2005-12-13 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > Utf-8 is the same as Unicode? No, UTF-8 is one (of several) possible encodings for expressing Unicode as a stream of bytes. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121

Re: Worthwhile to reverse a dictionary

2005-12-14 Thread Erik Max Francis
examples I saw (python.org, aspn.activestate.com, > Learning Python by Lutz, among others) use d={'x' : 'y'}. In the latter case the values are ints, whereas in the former they are strings. But you probably didn't mean that; indeed it is the case that d

Re: quick unicode Q

2005-12-14 Thread Erik Max Francis
e an id3 tag) how do I make the > interpretter understand that it may contain unicode? Read it as a string, and then decode it with the .decode method. You specify what encoding it's in. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA,

Re: quick unicode Q

2005-12-14 Thread Erik Max Francis
http://www.id3.org/id3v2.4.0-structure.txt -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis You are in the music / In the man's car next to me -- Sade -- http://mail.python.org/mailman/listinfo/python-list

Re: Cp1251-symbols in SOAP request

2005-12-17 Thread Erik Max Francis
erly, you have to encode it to a string properly. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis Could it be / That we need loving to survive -- Neneh Cherry -- http://mail.python.org/mailman/listinfo/python-list

Re: Cp1251-symbols in SOAP request

2005-12-17 Thread Erik Max Francis
Pelmen wrote: > what to do, to encode it properly? UTF-8? You're the one sending it through a socket; only you know what the other side expects. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W &

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

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