Re: Zen of Python

2005-01-19 Thread Bill Mill
The example that occurs to me is that "import smtplib" is better than "import stdlib.inet.services.smtp". Peace Bill Mill bill.mill at gmail.com On Wed, 19 Jan 2005 14:13:47 -0500, Timothy Fitz <[EMAIL PROTECTED]> wrote: > While I agree that the Zen of Python is

Re: a question

2005-01-19 Thread Bill Mill
e = (1,1,1) >>> cmd = '%s/mos user wmarch, cd /fa/wm/%s/%s, mkdir %s, put %s'\ ... '%s' % (mosbin, jaar, filetype, filetype, filetype, filetype) >>> cmd '1/mos user wmarch, cd /fa/wm/1/1, mkdir 1, put 1, chmod 6441' Peace Bill Mill bill.mill at

Re: a question

2005-01-19 Thread Bill Mill
You are correct, sir. Didn't know you could do that. Neato. Peace Bill Mill bill.mill at gmail.com On Wed, 19 Jan 2005 22:10:05 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > > You've got a couple problems. First, you need to end the

Re: list item's position

2005-01-19 Thread Bill Mill
)) when you can, but use it when you need to know the index of something without an additional x.index() call. Peace Bill Mill bill.mill at gmail.com On Wed, 19 Jan 2005 22:04:44 -0500, Bob Smith <[EMAIL PROTECTED]> wrote: > Hi, > > I have a Python list. I can't figure out ho

Re: Distutils: blurring the file==module borders

2005-01-24 Thread Bill Mill
read this thread, it should help you: http://mail.python.org/pipermail/tutor/2005-January/035124.html Peace Bill Mill bill.mill at gmail.com On Tue, 25 Jan 2005 02:15:58 +, Frans Englich <[EMAIL PROTECTED]> wrote: > > Hello all, > > Due to the size of my source, I want t

Dynamic class methods misunderstanding

2005-01-28 Thread Bill Mill
ot; function? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic class methods misunderstanding

2005-01-28 Thread Bill Mill
On 28 Jan 2005 15:41:49 GMT, F. Petitjean <[EMAIL PROTECTED]> wrote: > Le Fri, 28 Jan 2005 10:20:30 -0500, Bill Mill a écrit : > > Hello all, > > > > I have a misunderstanding about dynamic class methods. I don't expect > > this behavior: > > > >

Re: Dynamic class methods misunderstanding

2005-01-28 Thread Bill Mill
le in python 2.4, that's equivalent to: self.m = type(self.__init__)(method, self, Test) I didn't know that you could call types to create another type. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic class methods misunderstanding

2005-01-28 Thread Bill Mill
ouble printing here is a typo? > >>> > > To add m as a new method to the *instance*, use new.instancemethod, as > Diez B. Roggisch already pointed out. > Thanks, you helped me understand it a lot. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic class methods misunderstanding

2005-01-28 Thread Bill Mill
ot the object, as follows: > > |class Test: > |def __init__(self): > |self.method() > | > |def m(self): > |print self > | > |setattr(Test, 'method', m) > |Test() > beautiful; so this appears to be equivalent to the __class__ method that Ha

Re: Dynamic class methods misunderstanding

2005-01-28 Thread Bill Mill
On Fri, 28 Jan 2005 11:59:50 -0500, Hans Nowak <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > > On Fri, 28 Jan 2005 11:09:16 -0500, Hans Nowak <[EMAIL PROTECTED]> wrote: > > > > > >>To add m as a new method to the *class*, do this: > >&

Re: Dynamic class methods misunderstanding

2005-01-28 Thread Bill Mill
you do *not* know the attribute name at coding time but > will have it in a string at run time, as in > > methodname = 'method' > ..# some time later > setattr(Test, methodname, m) > > Sometime Python makes things easier than people are initially willing to > believe ;-) I felt like there had to be a simpler solution. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Java Integer.ParseInt translation to python

2005-01-31 Thread Bill Mill
ing,16); Tell me what this does, give me an example or two, and I'll translate it for you. I don't feel like going to read the java docs to figure it out. You probably want to look at the built-in int() function though. Type help(int) at the python prompt. Peace Bill Mill bill.mill at gm

Re: newbie: Syntax error

2005-02-04 Thread Bill Mill
Chad, try "elif tries == 2" or just "else:". You are not allowed to put an expression after an else statement. I recommend you read the python tutorial at http://docs.python.org/tut/tut.html . Peace Bill Mill bill.mill at gmail.com On Fri, 4 Feb 2005 12:49:51 -0600,

Re: string issue

2005-02-04 Thread Bill Mill
u're operating in-place on an array while it's being iterated over. Since the iterator is only created once, you're can't change the array while you're iterating over it. Instead, try a list comprehension: >>> ips = [ip for ip in ips if '255' not in ip] >>> ips ['128.173.120.79', '198.82.247.98', '127.0.0.1'] Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: string issue

2005-02-04 Thread Bill Mill
d, iterate over > > a copy by using: > > > > for ip in ips[:]: > > ... > > > > regards > > Steve > > Very neat. That's a trick that everyone should know about. I vote it > goes in Dr. Dobbs newsletter. Once you know it, it's neat, and I use it sometimes. However, it's a little too "magical" for my tastes; I'd rather be more explicit about what's going on. Peace Bill Mill bill.mill at gmail.com > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: string issue

2005-02-04 Thread Bill Mill
import copy >>> ips = ['255.255.255.255', '128.173.120.79', '198.82.247.98', ... '127.0.0.1', '255.0.0.0', '255', '128.173.255.34'] >>> for ip in copy(ips): ... if '255' in ip: ... ips.remove(ip) ... >>> ips ['128.173.120.79', '198.82.247.98', '127.0.0.1'] But I still think that the list comprehension is the best. Peace Bill Mill bill.mill at gmail.com > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: Possibly OT: Controlling winamp with Python

2005-02-04 Thread Bill Mill
Brent, You could write the Python program as a proxy of the internet stream. Basically, you would point your proxy at the web stream and receive the data it sends. At the same time, you would be listening for connections on some socket on the local machine. You would then point winamp towards the

Re: Loop in list.

2005-02-08 Thread Bill Mill
node7.html#SECTION00714 . Peace Bill Mill bill.mill at gmail.com On Tue, 08 Feb 2005 06:50:08 -0800 (PST), Jim <[EMAIL PROTECTED]> wrote: > Where did this type of structure come from: > > mat = ['a' for i in range(3)]? > > This will produce a list of t

Re: check if object is number

2005-02-11 Thread Bill Mill
On Fri, 11 Feb 2005 12:11:44 -0700, Steven Bethard <[EMAIL PROTECTED]> wrote: > Is there a good way to determine if an object is a numeric type? > Generally, I avoid type-checks in favor of try/except blocks, but I'm > not sure what to do in this case: > > def f(i): > ... >

Re: Regular Expressions: large amount of or's

2005-03-01 Thread Bill Mill
Kent > > > >> > >> André > >> > > That is not exactly what I want. It should discover if some of > the predefined words appear as substrings, not only as equal > words. For instance, after matching "word2sgjoisejfisaword1yguyg", word2 > and word1 should be detected. Show some initiative, man! >>> known_words = set(["word1", "word2"]) >>> found_words = [word for word in known_words if word in "word2sgjoisejfisawo rd1yguyg"] >>> found_words ['word1', 'word2'] Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How would you program this?

2005-03-02 Thread Bill Mill
9 - 3 3 9 7 8 3 8 7 9 5 9 8 4 7 5 9 - real0m1.255s user0m1.221s sys 0m0.030s Both solutions look correct to me; how about you? With clever enough heuristics, problems that you can expect people to solve will almost always fall to brute force algorithms, I feel. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How would you program this?

2005-03-02 Thread Bill Mill
; 3 3 9 7 > 8 3 8 7 > 9 5 9 8 > 4 7 5 9 > - > > real0m1.255s > user0m1.221s > sys 0m0.030s > Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: passing lists

2005-03-02 Thread Bill Mill
Earl, Please post the smallest snippet of code you can which illustrates your problem. No list is an unsubscriptable object, so you seem to be passing something that is not a list to your function. As it stands, you don't give enough information to give an actual answer. Peace Bill

Re: substring matching

2005-03-02 Thread Bill Mill
e first part is actually XYZ, is there an > easy way of doing that? > data.startswith('XYZ') Please read the python tutorial at http://docs.python.org/tut/tut.html . Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How would you program this?

2005-03-03 Thread Bill Mill
very very unlikely to happen in such a way that the row and column sums are maintained; especially as the number of rows and columns grows. Better to just do a crc or a hash of the data though. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Making things more functional in Python

2005-03-04 Thread Bill Mill
dingly obvious what your code does, which is a good thing. My list comp, on the other hand, is seven kinds of confusing for a reader. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Integer From A Float List?!?

2005-03-04 Thread Bill Mill
e archives for that (it was in february, I think). And, finally, when doing scientific stuff, I found IPython (http://ipython.scipy.org/) to be an invaluable tool. It's a much improved Python interpreter. Peace Bill Mill bill.mill at gmail.com > > (In Matlab, "integer_matrix&qu

Re: Is there a short-circuiting dictionary "get" method?

2005-03-09 Thread Bill Mill
at it means python doesn't have "delayed evaluation"). Here are two ways to do what you want: if 'x' in d: value = d['x'] else: value = bigscaryfunction() or: def sget(dict, key, func, *args): if key in dict: return key else: return func(*args) sget

Re: Is there a short-circuiting dictionary "get" method?

2005-03-09 Thread Bill Mill
t()) >>> z at 0x008D6870> So this seems to be merely an obfuscation of: >>> z = d.get('x', test) >>> z I just wanted to ask, am I missing something? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a short-circuiting dictionary "get" method?

2005-03-09 Thread Bill Mill
it... > def scary(): > print "scary called" > return 22 > > d = dict(x=1) > d.get('x', lambda *a : scary()) > > # print 1 > d.get('z', (lambda *a : scary())()) > scary called > 22 but: >>> d.get('x', (lambda *a: test())()) test called 1 So how is this different than d.get('x', test()) ? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: pre-PEP: Print Without Intervening Space

2005-03-11 Thread Bill Mill
string. I agree with everything said here. Furthermore, I don't like this PEP because it introduces magic. When reading code, you just need to magically know what the double-comma does in a print statement. Yes, there are bits of magic involved in the solutions that already exist, but I am o

Re: Why tuple with one item is no tuple

2005-03-15 Thread Bill Mill
rouping, and do not unambiguously define a tuple. It's a python gotcha. To define a one-tuple, put a comma after the '1': >>>type(('1',)) > > Because I have to treat this "special" case differently in my code. you shouldn't have to; post your code if you still think you do. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Why tuple with one item is no tuple

2005-03-15 Thread Bill Mill
e, since the need to create empty tuples is vanishingly rare, I'm okay with a little inconsistency. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: c.l.p.announce question

2005-03-15 Thread Bill Mill
and people will find your blog. I know for a fact that the daily python-url editors (when not away on vacation) read planet python, and they'll send thousands of visitors to you if they link you. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Text-to-speech

2005-03-21 Thread Bill Mill
On 21 Mar 2005 12:47:07 -0800, Paul McGuire <[EMAIL PROTECTED]> wrote: > Brian, > > Having reviewed your Cease and Desist petition, I'm afraid I must > dispute some or all of your claims: > > 1. Your citation of prior art has one or more significant defects: > a. In your citation, "brace" is clea

Re: Data types

2005-03-24 Thread Bill Mill
On 24 Mar 2005 10:29:40 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am new to python and learning it. Can you please give me a simple > example of user defined type through class mechanism. GIYF: http://www.python.org/2.2/descrintro.html#subclassing Peace Bill Mill

Re: Version Number Comparison Function

2005-03-25 Thread Bill Mill
v1, v2): v1, v2 = v1.split('.'), v2.split('.') for x, y in zip(v1, v2): if x < y: return v1 if y > x: return v2 It assumes that v1 and v2 have the same amount of '.'s and that all of the version numbers are of the same length (i.e

Re: Grouping code by indentation - feature or ******?

2005-03-25 Thread Bill Mill
half your colons, you're spending upwards of 20 seconds per colon? If you want, I'll write a script that checks for colons at the end of lines before increased indentation, and asks you if you want to put one there - I could save you 5.8 minutes per 100 lines of code. How's that for a productivity boost? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: breaking up is hard to do

2005-03-25 Thread Bill Mill
t sort of namespace problems? I think you need to tell us what your specific problems were, so that we can help you more. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: String Splitter Brain Teaser

2005-03-28 Thread Bill Mill
#x27;ATT/GATA/G'): print g ... ['A'] ['T'] ['T', 'G'] ['A'] ['T'] ['A', 'G'] Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: String Splitter Brain Teaser

2005-03-28 Thread Bill Mill
On Mon, 28 Mar 2005 09:18:38 -0800, Michael Spencer <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > > for very long genomes he might want a generator: > > > > def xgen(s): > > l = len(s) - 1 > > e = enumerate(s) > >

Re: String Splitter Brain Teaser

2005-03-28 Thread Bill Mill
l of the problem. Also, item is a much clearer name than stack; I chose stack just to point out how similar the solution to objection 2 was to yours. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: PyParsing module or HTMLParser

2005-03-28 Thread Bill Mill
nother table. > Is it better and easier to use the pyparsing module or HTMLparser? > You might want to check out BeautifulSoup at: http://www.crummy.com/software/BeautifulSoup/ . Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Little Q: how to print a variable's name, not its value?

2005-03-29 Thread Bill Mill
27;. ummm, yes, of course they are. What's your point? > > Mixing data and program code, ie.. variable names as data, is not a > good idea. Down with eval! Exile exec! A pox on both their houses! (i.e. I respectfully disagree that mixing data with program code is a bad idea) Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Little Q: how to print a variable's name, not its value?

2005-03-29 Thread Bill Mill
On Tue, 29 Mar 2005 18:08:04 GMT, Cameron Laird <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Bill Mill <[EMAIL PROTECTED]> wrote: > . > . > . > >(i.e. I respectfully

Re: Which is easier? Translating from C++ or from Java...

2005-03-29 Thread Bill Mill
;s going on so that you don't end up writing another language in python. If you do this, it doesn't matter which of the three you pick. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Little Q: how to print a variable's name, not its value?

2005-03-29 Thread Bill Mill
nt when I hit send. Naturally, I wasn't suggesting that anyone (shudder) do things like your examples of poor code. I had a much smaller point, about which I was not clear: Sometimes, it is handy to mix code and data. There *are* legitimate uses of reflection, eval, and exec. I was too glib in my response to you. I intended no disrespect, only silliness. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Little Q: how to print a variable's name, not its value?

2005-03-31 Thread Bill Mill
because a variable is simply a name binding doesn't mean Python couldn't return the name of the binding. I'm not definitely saying that I *want* an easy name() function - there's a lot of potential for abuse - but I would at least like to see it accomplished before I decide whether I like it or not. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Little Q: how to print a variable's name, not its value?

2005-03-31 Thread Bill Mill
On Thu, 31 Mar 2005 03:33:10 -0500, Bill Mill <[EMAIL PROTECTED]> wrote: > On 31 Mar 2005 08:13:30 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > > > > But surely if you create an integer object and assign it a value, e.g. > &

Re: Pseudocode in the wikipedia

2005-04-01 Thread Bill Mill
using = are much clearer, especially since you often write many of them in a row, whereas you almost always make one assignment per line. I use := every day in PL/SQL, and it's one of the few positive syntactical features of the language. Peace Bill Mill bill.mill at gmail.com -- http://mail.pyth

Re: How to reload local namespace definitions in the python interpreter?

2005-04-04 Thread Bill Mill
port ... as ... idiom? > > e.g. import os.path as op > > > > This would, of course, require the user to qualify the names by > prefixing them with "op.". > What the OP listed above requires that too. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: change extensions

2005-04-05 Thread Bill Mill
os.rename(in_file, str(name[0]) + '.' + 'text')) > you should really use in_file.splitext - your script renames myfile.with.lots.of.dots.txt to myfile.text instead of myfile.with.lots.of.dots.text . If you *really* wanted to use split(), it oughta be ''.join(in_

Re: shebang in cross platform scripts

2005-04-06 Thread Bill Mill
> systems too. > > #!/usr/bin/env python What the others have said already is true, that it will be ignored on windows, with one caveat. The shebang is interpreted by Apache if your script is a CGI script. So, if your script is a CGI, you will need to have a windows version and a ni

Re: shebang in cross platform scripts

2005-04-06 Thread Bill Mill
ll available for > Windows. Google is your friend. > > Symbolic links also work under uwin (don't know for sure about the > others). That means you can install a link in /usr/bin to whereever > python lives, and expect #!/usr/bin/python to work just fine. This works in cygwin

Re: Lambda: the Ultimate Design Flaw

2005-04-07 Thread Bill Mill
On Apr 7, 2005 1:15 AM, Greg Ewing <[EMAIL PROTECTED]> wrote: > Scott David Daniels wrote: > > Aahz wrote: > > > >> You just can't have your cake and eat it, too. > > > > I've always wondered about this turn of phrase. I seldom > > eat a cake at one sitting. > > You need to recursively subdivide

Re: sorting a list and counting interchanges

2005-04-07 Thread Bill Mill
my CS classes (I graduated last May) While I'm at it though, I want to thank Tim for that post. It was one of those posts where afterwards you say "of course!" but beforehand I was totally thinking of it the wrong way. Brought me right back to Abstract. Peace Bill Mill bill.mill a

Re: sorting a list and counting interchanges

2005-04-07 Thread Bill Mill
n or #by implication assert j not in seen just to really frustrate the guy reading your code. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: some sort of permutations...

2005-04-12 Thread Bill Mill
like its recursion really slows it down (but I haven't been profiled it). Does anyone know of a non-recursive algorithm to do the same thing? And, while I'm asking that question, is there a good reference for finding such algorithms? Do most people keep an algorithms book handy? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: preallocate list

2005-04-13 Thread Bill Mill
lst.append(math.sin(i) * i) t1 = timeit.Timer('test1()', 'from __main__ import test1') t2 = timeit.Timer('test2()', 'from __main__ import test2') print "time1: %f" % t1.timeit(100) print "time2: %f" % t2.timeit(100) 09:09 AM ~$ py

Re: preallocate list

2005-04-13 Thread Bill Mill
print "time2: %f" % t2.timeit(100) > The results change slightly when I actually insert an integer, instead of a float, with lst[i] = i and lst.append(i): 09:14 AM ~$ python test.py time1: 3.352000 time2: 3.672000 The preallocated list is slightly faster in most of my tests, but I still

Re: Codig style: " or """

2005-04-13 Thread Bill Mill
ocument on python > coding style. > the authoritative coding style guide is pep 8: http://www.python.org/peps/pep-0008.html Of course, there are style points that are debatable, but for comments, you should definitely be using triple-quotes. Pep 8 points you to pep 257, which is all about docstrings: http://www.python.org/peps/pep-0257.html Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Compute pi to base 12 using Python?

2005-04-14 Thread Bill Mill
noted that running the win32 bc from cygwin messed up my terminal, so I recommend running it from a cmd window (which worked fine). Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: A little request about spam

2005-04-14 Thread Bill Mill
On 4/14/05, César Leonardo Blum Silveira <[EMAIL PROTECTED]> wrote: > Yeah that is happening to me too! Almost all my python-list e-mails go > to the Spam box. > Maybe we should contact the gmail admins? > I've already contacted the gmail admins. There was no response. Pe

Re: A little request about spam

2005-04-14 Thread Bill Mill
On 4/14/05, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > > > Maybe we should contact the gmail admins? > > > > I've already contacted the gmail admins. There was no response. > > have you tried reading the newsgroup via

Re: A little request about spam

2005-04-15 Thread Bill Mill
ning. Here's to b*tching on c.l.p actually solving something ! Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Strings and Lists

2005-04-18 Thread Bill Mill
e bit-twiddling operators to get at your data. These should be *very* fast, as well as memory efficient. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python regex Doc (was: Python documentation moronicities)

2005-04-19 Thread Bill Mill
eractive > sessions, complete with ">>>" and "..."), but nits can always be picked > and I'm not the gatekeeper to Python's documentation. > I'd suggest that he actually make an effort at improving the docs before submitting them. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Bill Mill
think this is more intuitive, since most people (including > > mathematicians) start counting at "1". The reason for starting at > > "0" is easier memory address calculation, so nothing for really high > > level languages. > > Personnaly I would like to ha

Re: Why Python does *SLICING* the way it does??

2005-04-20 Thread Bill Mill
On 20 Apr 2005 13:39:42 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > Op 2005-04-20, Bill Mill schreef <[EMAIL PROTECTED]>: > > On 20 Apr 2005 12:52:19 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > >> Op 2005-04-20, Torsten Bronger schreef &

Re: Troll? was: Re: goto statement

2005-04-20 Thread Bill Mill
ve he meant obfuscating bytecode for a commercial product, to try and avoid decompilation, which is often a desirable function for commercial entities. (Not that I have the technical knowledge to agree or disagree with what he said, I'm just trying to help clear up what's become a fairly

Re: a=[ lambda t: t**n for n in range(4) ]

2005-04-22 Thread Bill Mill
t; t = 2 >>> [(lambda n: t**n)(n) for n in range(4)] [1, 2, 4, 8] >>> t = 3 >>> [(lambda n: t**n)(n) for n in range(4)] [1, 3, 9, 27] I just thought that was kinda neat. If you wanted to obfuscate some python, this would be an awesome trick - hide the value of t somewhere early in the function then pull a variation of this out later. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: What is situation with threads in Python

2005-04-25 Thread Bill Mill
On 4/25/05, Leonard J. Reder <[EMAIL PROTECTED]> wrote: > Hello Mark, > > I took your three day course here at JPL and recall that you said > something was wrong with the implementation of threads within Python > but I cannot recall what. So what is wrong with threads in Python? I'm going to gue

Re: What's do list comprehensions do that generator expressions don't?

2005-04-25 Thread Bill Mill
ar. Once that happens, we can tell people who ask the OP's question that [genexp] is just another way to spell list(genexp), and he should use it if he wants the entire list constructed in memory. > Jeremy> should be relatively simple), it's not worth breaking that > J

Re: Do I need a nested lambda to do this?

2005-04-25 Thread Bill Mill
v, t[1]) for t in tab]) for v, tab in zip(vals, tabs)] [((1.0, 1), (1.0, 3), (1.0, 4)), ((2.3439, 2), (2.3439, 0), (2.3439, 9)), ((4.23420004, 4), (4.23420004, 3), (4.23420004, 1))] Peace Bill Mill bill.mill at gmail.com > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list

Re: Which IDE is recommended?

2005-04-27 Thread Bill Mill
wing+komodo&rnum=3#3a118074c68f1f35 http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/2225676eb7e1b4e/cdee764dfa2b5391?q=best+IDe&rnum=1#cdee764dfa2b5391 Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: trouble with lists

2005-05-03 Thread Bill Mill
for i in range(3)] >>> y [[], [], []] >>> [id(b) for b in y] [168611980, 168612300, 168611916] Or, replace x[0] with a new list, instead of modifying the one already there: >>> x[0] = [2] >>> x [[2], [], []] Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionary comparison

2005-05-05 Thread Bill Mill
key(patch): print "Sun recommends patch %s" % patch for patch in serverx: if not sun.has_key(patch): print "Serverx has unnecessary patch %s" % patch def diff_revs(sun, serverx): for patch, rev in sun.iteritems(): if serverx.has_key(

Re: hard memory limits

2005-05-06 Thread Bill Mill
n the system is > heavily loaded. Otherwise, you're going to hit per-process limits. In > the latter case, adding RAM or swap won't help at all. Raising the > per-process limits is the solution. > A quick google shows it to be mac os X, and a pretty frequent error messa

Re: Getting number of iteration

2005-05-06 Thread Bill Mill
element %s" % (n, x) Earlier: n = 0 for x in lst: print "iteration %d on element %s" % (n, x) n += 1 And you shouldn't use list as a variable name; list() is a built-in function which you'll clobber if you do. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting number of iteration

2005-05-06 Thread Bill Mill
On 5/6/05, Bill Mill <[EMAIL PROTECTED]> wrote: > On 5/6/05, Florian Lindner <[EMAIL PROTECTED]> wrote: > > Hello, > > when I'm iterating through a list with: > > > > for x in list: > > > > how can I get the number of the current iteratio

replace string patern with different value

2005-05-09 Thread Bill Mill
got xyzzy text xyzzy yeah yeah yeah" >>> token 'xyzzy' >>> for rep in L: ... source = source.replace(token, rep, 1) ... >>> source "11 text we've got 22 text 33 yeah yeah yeah" And, if I may, I recommend the Python Tutorial at http://docs.python.org/tut/tut.html . Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Listing of declared variables and functions

2005-05-09 Thread Bill Mill
t; import re >>> locals() {'__builtins__': , 're': , 'x': 12, '__name__': '__main__', 'z': 13, '__doc__': N one} >>> locals().keys() ['__builtins__', 're', 'x', '__nam

Does anybody know the status of PyCon recordings?

2005-05-09 Thread Bill Mill
w if these recordings exist and, if so, where they are? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: A Faster Way...

2005-05-10 Thread Bill Mill
y different format: >>> zip(range(10), range(20, 30)) [(0, 20), (1, 21), (2, 22), (3, 23), (4, 24), (5, 25), (6, 26), (7, 27), (8, 28) , (9, 29)] > Sorry if it seems an homework assignment. It'd be one heck of a short homework assignment. I hope you've read the python

Re: Python Graphing Utilities.

2005-05-10 Thread Bill Mill
form to at least linux and windows. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Graphing Utilities.

2005-05-11 Thread Bill Mill
willl recursively search any directory in AFMPATH, so you only need to specify a base directory if multiple subdirectories contaning '*.afm' files. Peace Bill Mill bill.mill at gmail.com > > Tschö, > Torsten. > > [*] because of the "pslatex" backend, which means t

Re: Python Graphing Utilities.

2005-05-11 Thread Bill Mill
On 5/11/05, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Hallöchen! > > Bill Mill <[EMAIL PROTECTED]> writes: > > > On 5/11/05, Torsten Bronger <[EMAIL PROTECTED]> wrote: > > > >> Fernando Perez <[EMAIL PROTECTED]> writes: > >&

Re: Python Documentation (should be better?)

2005-05-12 Thread Bill Mill
uiltin types, so that you'd find "float (builtin)", "string > > (builtin)", "dict (builtin)", etc. in the appropriate alphabetical > > positions. > > +1 > > TJR > +1 Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How "return" no return ?

2005-05-12 Thread Bill Mill
re writing your own interpreter, it should still be syntactically invalid. Could you perhaps repeat your question with an example of what behavior is surprising you? Peace Bill Mill bill.mill at gmail.com > > "Fredrik Lundh" <[EMAIL PROTECTED]> escribió en el mensaje > ne

Re: increment bits

2005-05-12 Thread Bill Mill
x27;, '0x13', '0x14', '0x15', '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f', '0xe8', '0xe9', '0xea', '0xeb', '0xec', '0xed', '0xee', '0xef', '0xf0', '0xf1', '0xf2', '0xf3', '0xf4', '0xf5', '0xf6', '0xf7', '0xf8', '0xf9', '0xfa', '0xfb', '0xfc', '0xfd', '0xfe', '0xff'] Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
On 19 May 2005 06:56:45 -0700, rh0dium <[EMAIL PROTECTED]> wrote: > Hi All, > > While I know there is a zillion ways to do this.. What is the most > efficient ( in terms of lines of code ) do simply do this. > > a=1, b=2, c=3 ... z=26 > > Now if we really want some bonus points.. > > a=1, b=2,

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
hon. > for i, digraph in enumerate(sorted([''.join((x, y)) for x in alpha for > y in [''] + [z for z in alpha]], key=len)): >globals()[digraph]=i+1 > > How do you implement this sucker?? Works just fine for me. Let me know what error you're getting

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
ord2tuple('ZZ14') (13, 701) >>> coord2tuple('ZZ175') (174, 701) >>> coord2tuple('A2') (1, 0) Are there cols greater than ZZ? I seem to remember that there are not, but I could be wrong. Hope this helps. Peace Bill Mill [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
7;key'] l2.sort(lambda a,b: cmp(f(a), f(b))) return l2 l2.sort() return l2 And from your other email: > I need to go the other way! tuple2coord Sorry, I only go one way. It should be transparent how to do it backwards. Peace Bill Mill [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from numbers to letters

2005-05-19 Thread Bill Mill
On 5/19/05, Peter Otten <[EMAIL PROTECTED]> wrote: > Bill Mill wrote: > > >> Traceback (most recent call last): > >>File"",line1,in? > >> NameError: name 'sorted' is not defined > >> > >> I think you're probably usi

Re: Convert from numbers to letters

2005-05-20 Thread Bill Mill
rly used. I like it especially for signatures like "def change_coord((x, y))". It was one of those features, for me, where I just tried it without knowing of its existence, assuming it would work, and I was pleasantly surprised that it did. Peace Bill Mill bill.mill at gmail.com [1] htt

Re: \r\n or \n notepad editor end line ???

2005-06-08 Thread Bill Mill
ome things you might not expect, including changing /r/n to /n. Try: >>> f = file('d:/deleteme.txt', 'rb') >>> f.read() 'testing\r\n1\r\n2\r\n3' >>> f = file('d:/deleteme.txt', 'r') >>> f.read() 'testing\n1\n2\n3' Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: python server

2005-11-07 Thread Bill Mill
et, over a corporate LAN, on the same computer, on Internet2)? Is there any framework in existance, or is this program being written from scratch? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHON LOOSING FOR JAVA???????

2005-11-08 Thread Bill Mill
office web > > based. I sincerely enjoy the idea althoug I'd like to know what will be > > the future of this wonderful language called Python?? > > I think I know???? Although, the future is difficult to predict??? +1 QOTW Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >