Class Methods Vs Any Other Callable

2008-05-14 Thread vbgunz
I remember learning closures in Python and thought it was the dumbest idea ever. Why use a closure when Python is fully object oriented? I didn't grasp the power/reason for them until I started learning JavaScript and then BAM, I understood them. Just a little while ago, I had a fear of

Re: Class Methods Vs Any Other Callable

2008-05-14 Thread vbgunz
An instance method works on the instance A Static method is basically a function nested within a class object A class method is overkill? If anything, a static method is overkill... class Foo:   [EMAIL PROTECTED]    def register(cls, listener):        cls.LISTENERS.append(listener)

Re: Class Methods Vs Any Other Callable

2008-05-14 Thread vbgunz
Instance methods make the most sense. A static method makes sense too *but* I can see how a class method not only does what a static method does but how a class method *also* gets the cls reference for free. I don't understand the last part - but I certainly agree on the instance methods

Re: Class Methods Vs Any Other Callable

2008-05-14 Thread vbgunz
Instance methods make the most sense. A static method makes sense too *but* I can see how a class method not only does what a static method does but how a class method *also* gets the cls reference for free. I don't understand the last part - but I certainly agree on the instance

Re: Orlando Florida Python Tutor Needed

2008-05-12 Thread vbgunz
I know you're looking for one-on-one help, direction, and/or tutelage, but since you've not received an answer (yet), here's some general info... For Decorators, have a gander at:    http://www.ddj.com/web-development/184406073;jsessionid=QCNTPTSNXZP2W...    

Orlando Florida Python Tutor Needed

2008-05-10 Thread vbgunz
I will pay anyone for a face-to-face tutoring in the Orlando Florida area. I will pay $20.00 per hour (minimum 2 hours needed). What I need are lessons in Decorators and Class methods. If I can walk away with at least 5 lessons taught in both subjects I will be happy to offer an additional $20.00.

Skill Resume Achievements, What Good Goes Here?

2008-01-02 Thread vbgunz
I spent some time working on a skill resume, the kind of resume college students put together and realized, I am not in college and everything I learned was self-taught. Of course I would like some real world achievements but don't consider throw-away code an achievement and am failing to really

Re: Why does Python never add itself to the Windows path?

2007-01-03 Thread vbgunz
I don't understand what all the fuss is about. Add a single page to the installer and on it, have 3 radio buttons. The choices could be add to path (recommended), add to path with version, do not add to path (not recommended). Please submit a patch to sf.net/projects/python that does so.

Re: Why does Python never add itself to the Windows path?

2006-12-30 Thread vbgunz
Ben Sizer wrote: I've installed several different versions of Python across several different versions of MS Windows, and not a single time was the Python directory or the Scripts subdirectory added to the PATH environment variable. I don't understand what all the fuss is about. Add a single

Re: Why does Python never add itself to the Windows path?

2006-12-24 Thread vbgunz
Ben Sizer wrote: I've installed several different versions of Python across several different versions of MS Windows, and not a single time was the Python directory or the Scripts subdirectory added to the PATH environment variable. Every time, I've had to go through and add this by hand, to

Re: Python, PostgreSQL, What next?

2006-12-02 Thread vbgunz
I need to thank you all for your suggestions and recommendations. I am ultimately aiming to work in Python, PostgreSQL and Django and this link http://www.sqlalchemy.org/news.myt#item_3 sort of made my day :) I really appreciate all of your feedback and will go through Fredrik's links as soon as

Python, PostgreSQL, What next?

2006-12-01 Thread vbgunz
Hello all, I've studied Python and studied PostgreSQL. What is the absolute next best step to take to merge these two finely together? I've heard of SQLAlchemy and some others but before I dive in, I would really like the opinion of those who tried it and other toolkits. My main concern is, I

Re: case insensitive dictionary

2006-11-25 Thread vbgunz
John Henry wrote: I believe the standard dictionary should be amened to allow the use of case insensitive keys - as an option. I found some work done by others to do that at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/283455 but the problem with that approach is that they

Re: How to coerce a list of vars into a new type?

2006-10-02 Thread vbgunz
I want to verify that three parameters can all be converted into integers, but I don't want to modify the parameters themselves. You can twist and tweak this version OR completely redo it. In this version a list of the conversions are returned *but* if you want to only check if such a

Re: RegexBuddy (anyone use this?)

2006-09-16 Thread vbgunz
Has anyone tried this thing.. http://www.regular-expressions.info/regexbuddy.html I use kodos http://kodos.sourceforge.net/. I firmly agree using a tool like this to learn regular expressions will not only save you a ridiculous amount of time spent on trial and error *but* it's really easy

Re: RegexBuddy (anyone use this?)

2006-09-16 Thread vbgunz
kodos does look good but I do not have the pyqt (maybe I am slightly off) interface to use it on my system.. with another graphic interface it would be a must try software. on Ubuntu 6.06, the repos have this 'gtk2-engines-gtk-qt' and it makes QT apps look really awesome on Gnome. Not sure

Re: Learning Python

2006-08-26 Thread vbgunz
JAG CHAN wrote: Friends, As I had written earlier, I am trying to learn Python. I chose IDLE as an editor to learn Python. Now I find that it is an online editor. It is not possible for me to be always on online while learning. Kindly suggest me a suitable editor (for Windows XP) which does

Re: Regex help...pretty please?

2006-08-23 Thread vbgunz
MooMaster Wrote: I'm trying to develop a little script that does some string manipulation. I have some few hundred strings that currently look like this: cond(a,b,c) and I want them to look like this: cond(c,a,b) I zoned out on your question and created a very simple flipper. Although it

Re: InteractiveConsole History on Linux

2006-07-15 Thread vbgunz
Why does code.InteractiveConsole support command history on Windows, but not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not support history at all, and the Windows console is implementing it's own? Is there any way to get command history working with InteractiveConsole on Linux?

Re: InteractiveConsole History on Linux

2006-07-15 Thread vbgunz
vbgunz wrote: Why does code.InteractiveConsole support command history on Windows, but not in a Gnome terminal (all I get is ^[[A^[[B)? Or does it not support history at all, and the Windows console is implementing it's own? Is there any way to get command history working

Re: split a line, respecting double quotes

2006-07-07 Thread vbgunz
Jim wrote: Is there some easy way to split a line, keeping together double-quoted strings? using the re module I find this to probably be the easiest but in no way is this gospel :) import re rex = re.compile(r'(.*?|\S)') sub = 'a b c d e' res = [x for x in re.split(rex, sub) if not

Re: split a line, respecting double quotes

2006-07-07 Thread vbgunz
Is there some easy way to split a line, keeping together double-quoted strings? import re rex = re.compile(r'(.*?|\S)') sub = 'a b c d e' res = [x for x in re.split(rex, sub) if not x.isspace()][1:-1] print res # - ['a', 'b', 'c', 'd e'] instead of slicing the result out, you use this

Re: Python in a nutshell - new edition ?

2006-06-28 Thread vbgunz
Let me assure you that it _won't_ be on paper this coming Saturday (two days from now). I am absolutely certain it will be worth the wait. The Python in a Nutshell book that covers 2.2 is so well written, it's practically amazing the author was able to cram so much in so little space. Although

Re: learning python idioms

2006-06-11 Thread vbgunz
After several years developing in Java, I've begun to switch to Python for several of my new projects as I have found the language quite interesting. I've read several tutorials and implemented a few sample programs and I've found that Python enables one to program in a variety of different

Re: how to clear up a List in python?

2006-05-26 Thread vbgunz
Fredrik_Lundh = 'wah' I bet you enjoy stealing candy from babies and dunging on the little guy every chance you get. You're suppose to be a role model in this community? Your temper tantrum and unrelenting 'look at me look at me i'm bigger and better' machismo attitude is nothing more than a

Re: how to clear up a List in python?

2006-05-26 Thread vbgunz
You perhaps shouldn't become so excited. Next time, if you're not sure of the correctness of your solution, try to wait a bit before posting it, and see if someone other comes up with the same thing you would have posted. George, if Frederik's first reply was replaced with yours chances are

Re: how to clear up a List in python?

2006-05-26 Thread vbgunz
Steve, I have no qualm with Fredrik over this '''if you don't know how to do things, you don't need to post.''' but this ''' if you know why this is about the dumbest way to do what you're doing, and you're posted this on purpose, you really need to grow up.'''. The problem was I did post it on

Re: how to clear up a List in python?

2006-05-26 Thread vbgunz
I read the ten commandments. I enjoyed the link. I see my mistakes. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to clear up a List in python?

2006-05-26 Thread vbgunz
Well, given that you did post it on purpose and had no intent to mess anyone up over it, it is clear that the antecedent in Fredrik's if-statement is not satisfied and therefore your mind should've skipped the consequent statement when reading his response. Why get so upset about something

Re: Python for my mum

2006-05-26 Thread vbgunz
maybe you can tell your moms what to do and what binaries to download or maybe you can download them for her and either send it to her through email or put it on a disc for her... I understand the Windows XP installation binary is easy enough for anyone to get going. Just follow the prompts. Once

Re: Don't wish to give up on a Tkinter GUI Builder :(

2006-05-26 Thread vbgunz
Ah, what I was referring to (somewhat in jest) was something to automatically *write* the code needed by the application. Simply executing it is easy enough and in fact Rapyd-Tk already does this via the save-build-run project-menu choice. sorry I misunderstood you. --

Re: how to clear up a List in python?

2006-05-25 Thread vbgunz
I have new a list , when it hava large number of values, I wonna to delete all the values in it,how to do? something like this will probably help. x = [1,2,3,4,5,6,7,8,9] y = x list([x.pop() for z in xrange(len(x))]) print x, y # [] [] And, if a list have 801 values, I want to get its

Re: how to clear up a List in python?

2006-05-25 Thread vbgunz
del list1[:] thank you for that reply. I never thought of [:] cause to be me I thought it would immediately make a copy of the list or if anything that it would delete a copy so I never played with it. nice :) del list1[:-1000] # keep max. last 1000 appended items in the list

Re: how to clear up a List in python?

2006-05-25 Thread vbgunz
No, he'll have 100 items in the slice... 300, 301,... 399 that's 100 items. you're right, sorry. [300:400] would return 100 items but the item at index 400 would not return. I suggested if he wanted it to try [300:401] as the last slice index is excluded from the return. Thanks for that :) --

Re: script vs inneractive

2006-05-25 Thread vbgunz
the interactive shell will immediatly show the result of an expression without you having to explicitly print the result. In all text editor, you will have to print the result if you wish to see it. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to clear up a List in python?

2006-05-25 Thread vbgunz
if you don't know how to do things, you don't need to post. if you know why this is about the dumbest way to do what you're doing, and you're posted this on purpose, you really need to grow up. If this was the case who then would post any questions? I not only made my post with the best of

Re: how to clear up a List in python?

2006-05-25 Thread vbgunz
I will not try and stop helping others because you don't like my answers. I found a perfectly good way how not to do something that wasn't exactly wrong anyway. if you can take another persons honest attempt to help someone and twist it into something it is not, I can only suggest you look in the

Re: how to clear up a List in python?

2006-05-25 Thread vbgunz
I guess Fredrik's message was more along the lines of ``don't try to help others after a week or two toying with the language because you might be offering disservice, despite your good intentions; leave this to more experienced users``. The words might have been a bit harsher but that's just

Re: NEWB: how to convert a string to dict (dictionary)

2006-05-24 Thread vbgunz
I am sure something much more elaborate will show it's face but this I made in about 10 minutes. Didn't do much testing on it but it certainly does convert your string modeled after a dictionary into a real dictionary. You might wish to check against more variations and possibilities and tweak and

Re: Python Programming Books?

2006-05-24 Thread vbgunz
Learning Python by Mark Lutz will be the most perfect book to get you started! Perhaps there are others aimed at the non-programmer but after getting through that book (2 times) I finally left it with wings... It is a great book for the n00b in my humble opinion. After that, you'll pretty much

Re: Python Programming Books?

2006-05-24 Thread vbgunz
Thanks vbgunz that was the reply I was looking for! Do you think it is wise to hold back for a 3rd edition? No, 2nd edition is literally perfect. The reason why is because almost nothing significant enough has changed since it's publication. In other words, you will not learn any outdated

Re: IronPython 1.0 Beta 7 Released

2006-05-24 Thread vbgunz
maybe I am a bit ignorant and love living in the bliss of it and maybe I am a bit tired on the subject but may I ask you a question? if i decided to use IronPython for strict cPython work, is this possible? probably dumb when I can use cPython but is it still possible in case maybe sometime down

Don't wish to give up on a Tkinter GUI Builder :(

2006-05-23 Thread vbgunz
Hello world, I tried looking everywhere for a decent Tkinter GUI builder and the closest I got to finding one before being horrified from looking at the source was vtcl @ http://vtcl.sourceforge.net. The next closest thing was page @ http://page.sourceforge.net/ Page just didn't cut it for me

Re: New beginner to python for advice

2006-05-23 Thread vbgunz
I am a new beginner to python, would you like give me some advice on studying it? http://www.python.org/doc/ is a real great place to start. Are you looking for different advice? -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't wish to give up on a Tkinter GUI Builder :(

2006-05-23 Thread vbgunz
Thank you very much for the link and info. It looks promising but I am still on the lookout for a drag-n-drop Gui builder like vltc so if anyone has more links to new projects I am definitely interested! PS. I do love the code generated from rapyd! --

Re: Don't wish to give up on a Tkinter GUI Builder :(

2006-05-23 Thread vbgunz
What are you building? I routinely do things like these by hand www.greschke.com/unlinked/images/changeo.jpg www.greschke.com/unlinked/images/pocus.jpg www.greschke.com/unlinked/images/pis.jpg www.greschke.com/unlinked/images/petm.jpg and I can't imagine using a builder for anything 'simpler'.

Re: Don't wish to give up on a Tkinter GUI Builder :(

2006-05-23 Thread vbgunz
As for the code to actually make the application go, well, if there is some automatic way to make that happen it hasn't dawned on me yet. why not execute 'python -u /pathto/module.py' I could be wrong but hope I am not :) -- http://mail.python.org/mailman/listinfo/python-list

Re: find all index positions

2006-05-12 Thread vbgunz
Hello John, Thank you very much for your pointers! I decided to redo it and try to implement your suggestion. I think I did a fair job and because of your suggestion have a better iterator. Thank you! def indexer(string, substring, overlap=1): '''indexer(string, substring, [overlap=1]) - int

Re: find all index positions

2006-05-12 Thread vbgunz
I forgot to explain my reason for over shadowing the 'string' built-in within my iterator. To me, it doesn't matter because the string identifier is temporary within the function and dies when the function dies. Also, I personally don't use the string function and prefer ''.join('hi'), etc. Also,

Re: find all index positions

2006-05-11 Thread vbgunz
I thought this to be a great exercise so I went the extra length to turn it into a function for my little but growing library. I hope you enjoy :) def indexer(string, target): '''indexer(string, target) - [list of target indexes] enter in a string and a target and indexer will either

Re: 2 books for me

2006-05-11 Thread vbgunz
The cookbook assumes you know some Python. if you know it, you're good :) If you're new to Python and programming I would recommend 'Learning Python' by Mark Lutz and David Ascher. if you're very familiar with programming but need to catch up on Python syntax, I would recommend the Python in a

Re: Python CHM Doc Contains Broken Links on Linux in xCHM.

2006-05-08 Thread vbgunz
Thank you Razvan. You're right. I downloaded the 1.7.1 source and built it and the links do work just fine. Thank you for pointing that out! -- http://mail.python.org/mailman/listinfo/python-list

Re: Using StopIteration

2006-05-08 Thread vbgunz
sequence = ['','2'] for index, line in enumerate(sequence): if line.isspace():continue if line[:1].isdigit(): print 'index %s: starts with digit %s' % (index, line[:1]) -- http://mail.python.org/mailman/listinfo/python-list

Re: Using StopIteration

2006-05-08 Thread vbgunz
to catch and recover from StopIterations, use this: try: raise StopIteration except StopIteration: print 'caught StopIteration!' # verbose: sys.exc_info() requires import sys -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory leak in Python

2006-05-08 Thread vbgunz
how big is the set? 100MB, more? what are you doing with the set? do you have a small example that can prove the set is causing the freeze? I am not the sharpest tool in the shed but it sounds like you might be multiplying your set in/directly either permanently or temporarily on purpose or

Re: Why list.sort() don't return the list reference instead of None?

2006-05-08 Thread vbgunz
to throw fire on the fuel (:P), you can get the value back to an in-place mutable change with a single expression... mylist = [2,3,4,1] print mylist.sort() or mylist might not be too pythonic or maybe it is. I guess depends on what side of the glass you might wish to view the solution :) --

Python CHM Doc Contains Broken Links on Linux in xCHM.

2006-05-07 Thread vbgunz
Hello! this is the main error: http://img406.imageshack.us/img406/5218/screenshotxchmerror1ae.png navigation link images broken here: http://img406.imageshack.us/img406/2822/screenshotxchmv12python24docum.png when I first open up the docs, the main page and Global Module Index links in the tree

Re: Replace

2006-05-06 Thread vbgunz
pay attention to Ryan. Do not use 'str' as an identifier as you will over write the built-in doing so. this seems easiest so far. s = tyrtrbd =ffgtyuf == =tyryr =u=p ff s = s.replace('=', '=#') print s # - tyrtrbd =#ffgtyuf =#=# =#tyryr =#u=#p ff --

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread vbgunz
you don't have to say: if True == l_init it is suggested you simply say: if l_init: Remember the and operator requires expressions on both sides to be true to continue. If you notice, your expression on the right side of the 'and' is an assignment and so this is forbidden (SyntaxError).

Re: print out each letter of a word

2006-04-28 Thread vbgunz
what errors are you getting? Could it be an indentation error? I don't see anything wrong with the script except the value of fruit is missing. if fruit is a string, it should work like a charm. double check the length of the fruit with print len(fruit) and check fruit with print type(fruit) and

Re: append function problem?

2006-04-28 Thread vbgunz
seed = [1,2,3] seed.append(4) print seed # [1,2,3,4] many of the list methods are in place methods on a mutable object. In other words, doing the following results in None. seed = [1,2,3] seed = seed.append(4) print seed # None you also just wiped out your list... The append method like many

Re: Extending Methods Vs Delegates

2006-03-26 Thread vbgunz
I am sorry I couldn't reply sooner! Alex, Python in a nutshell is my bible and I take it virtually everywhere! Seriously, I would highly recommend it to anyone with a little to a lot of Python experience. I apologize for misinterpreting your passage on page 80. I will look much closer at your

Extending Methods Vs Delegates

2006-03-21 Thread vbgunz
Hello everyone. I own two books. Learning Python and Python in a nutshell. When cross referencing the two books to try and clarify the ideas behind extending methods and delegates, this is where confusion veered it's ugly head :( Learning Python explains on page 324: Class Interface Techniques

Re: My Generator Paradox!

2006-03-17 Thread vbgunz
I believe I understand now. the yield keyword is sort of like a cousin to return. return will bring back an object I can work with and so does yield *but* yield's object will most likely support the .next() method. So, if I worked with a function that ends with the return keyword and it returns a

Re: My Generator Paradox!

2006-03-17 Thread vbgunz
OK. I hope my understanding of the yield keyword and generators in a general sense are now better understood. When a generator function is assigned to an identifier, no code is executed and a generator is immediately returned. When the next() method is called on the new generator, code from top to

My Generator Paradox!

2006-03-16 Thread vbgunz
I am afraid that this is the first time in which I would probably need something explained to me as if I were a little child. I am having a hard time getting this through my thick skull. What in the world is wrong with this!? ''' ### '''

Re: Argument Precedence (possible bug?)

2006-03-06 Thread vbgunz
Hello, Steven D'Aprano, Terry Jan Reedy! I would really like to extend my thanks to you guys. I hope I've got it right this time! def posKeyArgs(a, b=2, c=3): print a, b, c #posKeyArgs(b=20) # too few positional arguments. a needs an arg. #posKeyArgs(10, c=30, 20) # pos_args cannot follow

Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
Hello all, I am just learning Python and have come across something I feel might be a bug. Please enlightenment me... The following code presents a challenge. How in the world do you provide an argument for *arg4? ## def

Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
Hello all, I am just learning Python and have come across something I feel might be a bug. Please enlightenment me... The following code presents a challenge. How in the world do you provide an argument for *arg4? ## def

Re: Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
Please forgive my call() Change this: argPrecedence('arg1', arg3='arg3', arg2='arg2', arg5='arg5') to this: argPrecedence('arg1', par3='arg3', par2='arg2', arg5='arg5') Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
Hello all, I am just learning Python and have come across something I feel might be a bug. Please enlightenment me... The following code presents a challenge. How in the world do you provide an argument for *arg4? ## def

Re: Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
I am sorry I hung you up on a typo Peter Hansen. On line 5 *arg4 should have been *par4. I hope it makes complete sense now. Sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: Argument Precedence (possible bug?)

2006-03-05 Thread vbgunz
Please allow me some time to look at your examples. I get hung up over the smallest details because in my mind, my approach should have just worked... I learned about these parameters reading O'reilly Learning Python 2nd Edition. On page 217 of the paperback or Chapter 13.5.6 in the ebook, topic: