Re: how can this iterator be optimized?

2009-02-16 Thread Basilisk96
forgot about that one. Thanks! -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Levenshtein word comparison -performance issue

2009-02-13 Thread Basilisk96
version. The only quirk to it is that it accepts nothing but unicode. Other than that, it's a keeper. It is extremely fast. Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: how can this iterator be optimized?

2009-02-13 Thread Basilisk96
re efficient. I agree. I would rather call func() only once per iteration in any case. I will revise it to a plain for loop with a single call. Thanks, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: A little bit else I would like to discuss

2009-02-13 Thread Basilisk96
aries that stay in step with currently available language releases would be most welcome. Just my $0.02, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: how can this iterator be optimized?

2009-02-11 Thread Basilisk96
so it's not too bad.. but it's possible for this pattern to apply to more substantial operations. My conjecture is that higher func() loads would favor more the use of a simple for- yield loop. Cheers, Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

how can this iterator be optimized?

2009-02-11 Thread Basilisk96
all. I am pretty sure that the sorted() construct cannot be improved much further, but... ...does anyone have ideas on improving the "rawPairs" iterator so that it calls "func(s)" only once per iteration? Perhaps a lambda construct, but I am not sure how to go about it...? Ch

Re: Is this a good time to start learning python?

2008-04-01 Thread Basilisk96
, I have watched Guido's GoogleTalk on Py3k plans, and the changes are not all that scary. I'm looking forward to it. Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Python in High School

2008-04-01 Thread Basilisk96
ssful for me because the content is well-connected. As far as which language to choose - well, you can make the choice yourself after reading at least the introductions of all the books. If you do decide on Python, there is a library called "pygame" that may achieve your visual game programming goals. Enjoy! -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: super, decorators and gettattribute

2008-01-14 Thread Basilisk96
ssion, and I'm sure a bunch of folks will benefit from it. And please update it (if necessary) to the current Python version. At the time of that writing, 2.3 must have been King, but oh my, how time flies :-) Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: for loop without variable

2008-01-10 Thread Basilisk96
for i in range(len(data_in)): > data_out.append([]) > > This caused me to wonder why Python does not have a "foreach" statement (and > also why has it not come up in this thread)? I realize the topic has probably > been beaten to death in earlier thread(s), but doe

Re: for loop without variable

2008-01-10 Thread Basilisk96
catching unused > > variables in the general is useful to me. > > Agreed. > > -- > \ "Dyslexia means never having to say that you're ysror." | > `\--anonymous | > _o__) | > Ben Finney Neat! That is the best solution I've seen so far. I should definitely dig into the itertools module more often. Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: for loop without variable

2008-01-09 Thread Basilisk96
for f in actions: f() fetching foo... fetching foo... fetching foo... fetching foo... fetching foo... ..but not knowing your specific implementation, I may be off the wall here. Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: using super

2008-01-09 Thread Basilisk96
e = E() > e.meth() > for class_ in E, D1, C1, B1, B2, B0, C, B: > print class_.__name__, super(class_, e).pn() > > > I can clearly see that it doesn't work, I just don't understand why. I'd > > be inclined to chalk it up to super() being a mysterious black box that > > makes no sense *wink* > > super (and mro) work to get to all the superclasses in an order that > produces subtypes before their supertypes. The diamond inheritance > examples "show" why its needed. > > -Scott Cool, thanks for posting this example and clearing that up. Several times in the past I have used super(self.__class__, cls) instead of super(Klass_obj, cls), without a clue that it would wreck the subclasses. My beginner's thought at the time was that it would provide more flexibility.. Good thing I haven't had to subclass them..yet :) Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: using super

2008-01-09 Thread Basilisk96
//www.python.org/doc/newstyle/ Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's great, in a word

2008-01-08 Thread Basilisk96
ne enough to choose. Here's a new word - ...its humanicity factor. That definition, according to me, is: "its ability to let you *quickly* formulate and solve your problem in the way that YOU see it, not as the computer sees it." Did programmers stop writing programs on punch card

Re: "Python" is not a good name, should rename to "Athon"

2007-11-30 Thread Basilisk96
. FWIW, an ASP is also a snake...but that's another discussion. Shall we start one? I think NOT.. This has been an entertaining break from the ordinary, but let's get back to something more useful. Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Lib for audio?

2007-11-29 Thread Basilisk96
ncy analysis based on real-time sampling. It's well worth taking a look: http://pymedia.org/ Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: MP3 and ID3 library/module recommendations

2007-11-03 Thread Basilisk96
ds of audio metadata. On mp3's, that includes track duration, all ID3 info, bitrate, sample rate, etc. It provides an easy dictionary-like interface. It supports a number of audio formats, but I don't believe it has conversion capability. Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: where do I need to "tab"?

2007-10-19 Thread Basilisk96
you upgrade now :) -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: interesting puzzle......try this you will be rewarded...

2007-09-07 Thread Basilisk96
On Sep 7, 5:08 am, "Andreas Tawn" <[EMAIL PROTECTED]> wrote: > > Maybe http://www.pythonchallenge.com/? That's the one, thanks! --- -- http://mail.python.org/mailman/listinfo/python-list

Re: interesting puzzle......try this you will be rewarded...

2007-09-06 Thread Basilisk96
Woody! :)) -- http://mail.python.org/mailman/listinfo/python-list

Re: interesting puzzle......try this you will be rewarded...

2007-09-06 Thread Basilisk96
I got to 14 :) It's rather silly. I remember seeing a more elaborate puzzle that involved coding, cryptography knowledge, etc. to get through it. But what was the link, I forget now... -- http://mail.python.org/mailman/listinfo/python-list

Re: GUI and distrubution

2007-08-24 Thread Basilisk96
GUI2Exe - it makes the distribution process a bit less painful. Of course, you're welcome to search for other stuff as suggested by the other responses. Cheers, Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe/distutils: how to include a tree of files?

2007-08-24 Thread Basilisk96
d its necessary data files in this way. Wouldn't it be nice if py2exe had something simple like that built in... Have you tried GUI2Exe? I've found its interface quite easy to use. It doesn't recurse into a dir tree (feature request?), but it makes the selection process at leas

Re: How to optimise this code?

2007-08-21 Thread Basilisk96
just nice how it works that way. Otherwise, the function factory approach like Hrvoje's functionToCall = getattr(self, "testCase%s" % tc) is the best optimization. Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question: how to get started?

2007-06-16 Thread Basilisk96
source for any beginner in Python, whether he/she has previous programming background or not. -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: interating over single element array

2007-06-09 Thread Basilisk96
Thank you both for clearing that up. -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: interating over single element array

2007-06-09 Thread Basilisk96
And wrap if it > is. Can you give an example of such an iterable (other than a tuple)? I'd certainly like to fix my 'fix' to work for a more general case. Regards, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: interating over single element array

2007-06-08 Thread Basilisk96
for filename in filelist: f = open(filename,'r') #do interesting stuff with file, etc... ..and it's been working very well. Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: creating lists based on parsed items

2007-06-06 Thread Basilisk96
> This would be a RTFM moment :) defaultdict is not a built-in, it is part > of the collections module. Bingo! I should have read higher up in the manual tree :) Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: creating lists based on parsed items

2007-06-06 Thread Basilisk96
nual, I got a "NameError: name 'defaultdict' is not defined". What am I missing in my Python installation? -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Which class's comparison function is called?

2007-06-05 Thread Basilisk96
to add type-checking to the __eq__ method? (untested) def __eq__(self, other): if isinstance(other, int): tmp = other else: tmp = other.a # (other.b in class B definition) return self.a == tmp # (self.b in class B definition) Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: NOOOOB

2007-05-23 Thread Basilisk96
On May 22, 5:44 pm, [EMAIL PROTECTED] wrote: > On May 22, 6:29 am, jolly <[EMAIL PROTECTED]> wrote: > > > Hey guys, > > > I want to begin python. Does anyone know where a good starting point > > is? > > > Thanks, > > Jem > > I really liked How to Think Like a Computer Scientist learning with > pyth

Re: how to use private method in a class

2007-05-21 Thread Basilisk96
in your case the 3 fixes above will allow you now to do this: >>>C = Cc14(2,3) >>>result = C.out(C) >>>result.r, result.i (3, 4) Which is beginning to look like your design intent.. Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: A few questions

2007-05-21 Thread Basilisk96
> After this I went to the tutorial and started trying out some of the > examples. I pasted the code to separate text files and then ran them > through a Terminal window. This stuff is freaking cool!!! Now I > just have to figure out how this all works! > "wxPython in Action" is a decent book fo

Re: A few questions

2007-05-21 Thread Basilisk96
un on that system. > Try wxPython. I've seen it run on a Mac with OS X and Windows simultaneously, where the operating systems were switched from one to the other at the touch of a button, and the GUI had a very native look in either platform (mind you, the app was running exactly

How to cleanly pause/stop a long running function?

2007-05-12 Thread Basilisk96
appropriate for this and how to apply it. Perhaps the above function should be a method of a class that inherits from the appropriate handler class? Any help will be appreciated. -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Basic question

2007-05-12 Thread Basilisk96
post: you want to create a loop that steps by an increment of 2. If that's the case, then: >>> for j in range(0,10,2): ... print j ... 0 2 4 6 8 would be a simple result. Cheers, -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: chdir()

2007-05-08 Thread Basilisk96
ou can avoid such a faux pas by using the raw string construct of the form r"some string". Otherwise, any backslashes in in your string will be interpreted as escape characters. -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check if a string is empty in python?

2007-05-02 Thread Basilisk96
> How do you know that s is a string? It's a presumption based on the original problem statement. The example shown is a simple T/F check, which happens to determine the "emptiness" of strings. If type checking is absolutely necessary, one could use if isinstance(s, basestring): if s:

Re: How to check if a string is empty in python?

2007-05-02 Thread Basilisk96
A simple if s: print "not empty" else: print "empty" will do. -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: ScrolledText?

2007-05-01 Thread Basilisk96
t box scrolled at the bottom :) How about this: >>>help(Tkinter.Text.see) Help on method see in module Tkinter: see(self, index) unbound Tkinter.Text method Scroll such that the character at INDEX is visible. It may be what you're looking for if you use 'end' for inde

Re: ScrolledText?

2007-05-01 Thread Basilisk96
Would this work? self.text = wx.TextCtrl(panel, style=wx.TE_MULTILINE) ... line = '\n' + "Hello world!" self.text.AppendText(line) -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing the continous newline characters from the pythong string

2007-05-01 Thread Basilisk96
What was I thinking? split() will only work if you have no other whitespace characters in the string. A regex like "[\n\r]+" is indeed much more appropriate and robust. Cheers -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing the continous newline characters from the pythong string

2007-05-01 Thread Basilisk96
why not use split: >>>s = " >>>a\n\n\n\n\n\n\n\n\nsss\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvsa\n\n\n\nasf... >>>\n\nafs" >>>s.split() ['a', 'sss', '', 'vsa', 'asf...', 'afs'] -- http://mail.python.org/mailman/listinfo/python-list

Re: My Python annoyances

2007-04-28 Thread Basilisk96
on my PyCon mug there are words "Python: so easy...even your BOSS can use it!" Thankfully, my boss doesn't know the difference between directories and files, so I can easily succeed in making him think that Python really IS a black art :) Cheers -Basilisk96 -- http://mail.python.

Re: Getting started with python

2007-04-17 Thread Basilisk96
code base shrinks compared to its C++ or Java counterpart :) But really, do it just to understand Python on a deeper level. Instead of thinking in the old way, try to think in the Pythonic way. A nice example of this is iteration. Where an iteration counter variable is required in most oth

Re: Extract zip file from email attachment

2007-04-06 Thread Basilisk96
> > Could the file like object still be encoded in MIME or something? > Yes it is. You don't need to seek(0). Try this: decoded = email.base64mime.decode(part.get_payload()) fileObj.write(decoded) -Basilisk96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Generic logic/conditional class or library for classification of data

2007-04-02 Thread Basilisk96
Thanks for the help, guys. Dictionaries to the rescue! Steven, it's certainly true that runtime creation of attributes does not fit well here. At some point, an application needs to come out of generics and deal with logic that is specific to the problem. The example I gave was classification of b

Generic logic/conditional class or library for classification of data

2007-03-31 Thread Basilisk96
This topic is difficult to describe in one subject sentence... Has anyone come across the application of the simple statement "if (object1's attributes meet some conditions) then (set object2's attributes to certain outcomes)", where "object1" and "object2" are generic objects, and the "conditions