Re: [Tutor] writing effective unittests

2013-01-03 Thread Tino Dai
I think what I need is a conceptual shift: how do python programmers use > unittests? > > Here at the Library, we use unit test to test the cases that have many known inputs. For example, some of the data could come in "foo bar baz", and some others could come in as "foo, bar, baz", and others coul

Re: [Tutor] getattr works sometimes

2012-10-05 Thread Tino Dai
On Tue, Oct 2, 2012 at 8:39 PM, Steven D'Aprano wrote: > On 03/10/12 04:20, Tino Dai wrote: > >> and the get_class class works sometime for finding modules within a >>>> certain directory. If the get_class >>>> doesn't work, it throws an Attribut

Re: [Tutor] getattr works sometimes

2012-10-02 Thread Tino Dai
On Tue, Oct 2, 2012 at 2:20 PM, Tino Dai wrote: >>> and the get_class class works sometime for finding modules within a >>> certain directory. If the get_class >>> doesn't work, it throws an AttributeError. >> >> I don't really understand wha

Re: [Tutor] getattr works sometimes

2012-10-02 Thread Tino Dai
>> and the get_class class works sometime for finding modules within a >> certain directory. If the get_class >> doesn't work, it throws an AttributeError. > > I don't really understand what you mean by this. Can you copy and > paste the actual error message (all of it)? > >> >> The module exists i

[Tutor] getattr works sometimes

2012-10-02 Thread Tino Dai
Hi All, I'm using the get_class from: http://stackoverflow.com/questions/452969/does-python-have-an-equivalent-to-java-class-forname and the get_class class works sometime for finding modules within a certain directory. If the get_class doesn't work, it throws an AttributeError. The modul

Re: [Tutor] Code Review?

2012-08-07 Thread Tino Dai
On Mon, Aug 6, 2012 at 6:27 PM, Brian Carpio wrote: > Thanks to everyone who has replied! This is some good information for me > to go learn with!. > > I greatly appreciate it. > > When you refactor your code, let us know. I, for one, would like to see it.

Re: [Tutor] Code Review?

2012-08-06 Thread Tino Dai
On Mon, Aug 6, 2012 at 9:39 AM, Ramchandra Apte wrote: > Another practice is make __license__ = "GPL license..." > and __author__ = "Brian Carpio " > I do so. > > > On 6 August 2012 19:08, Ramchandra Apte wrote: > >> In scripts/add_node.py GPL Licene should be GPL License >> >> >> Brian, I

Re: [Tutor] finally without try or except

2012-07-31 Thread Tino Dai
On Mon, Jul 30, 2012 at 9:01 PM, Steven D'Aprano wrote: > If you want to be robust, it is best not to try to beat the database. That > means you should write to the database as soon as you can, as often as you > need to, and let the database do what it does best: reliable transaction > storage. An

[Tutor] ImportError

2012-07-31 Thread Tino Dai
Hi All, I have been banging my head against a wall trying to figure it out. I'm getting a ImportError on a class that I know exists. I'm wondering if there is some dark corner of the import mechanism that I don't understand. -Tino Traceback (most recent call last): File "manage.py", lin

Re: [Tutor] finally without try or except

2012-07-30 Thread Tino Dai
On Mon, Jul 30, 2012 at 3:35 PM, Brett Ritter wrote: > On Mon, Jul 30, 2012 at 12:20 PM, Tino Dai wrote: > > Yes, but that would involve surrounding the entire method with a try > except > > finally block. I was > > told by the Python-Guru-In Residence that should

Re: [Tutor] finally without try or except

2012-07-30 Thread Tino Dai
On Mon, Jul 30, 2012 at 1:44 PM, Prasad, Ramit wrote: > > Actually, what I'm doing is keeping a pending item log in memory as an > array > > and then saving it to the DB at the end of the program, but what happens > if > > the user hits ctrl-c, then the pending items array is lost. That's the > us

Re: [Tutor] finally without try or except

2012-07-30 Thread Tino Dai
On Mon, Jul 30, 2012 at 2:44 PM, Albert-Jan Roskam wrote: > *From:* Tino Dai > > *To:* nz*tutor pythonzzz > *Sent:* Monday, July 30, 2012 6:56 PM > *Subject:* [Tutor] finally without try or except > > Hi! > > Is there anyway to execute a block of code at th

Re: [Tutor] finally without try or except

2012-07-30 Thread Tino Dai
On Mon, Jul 30, 2012 at 1:52 PM, Mark Lawrence wrote: > On 30/07/2012 17:56, Tino Dai wrote: > >> Hi! >> >> Is there anyway to execute a block of code at the end of a program >> in >> 2.6 regardless of what happened before eg exiting normally or died

Re: [Tutor] finally without try or except

2012-07-30 Thread Tino Dai
On Mon, Jul 30, 2012 at 1:16 PM, Marc Tompkins wrote: > On Mon, Jul 30, 2012 at 9:56 AM, Tino Dai wrote: > >> Hi! >> >> Is there anyway to execute a block of code at the end of a program >> in 2.6 regardless of what happened before eg exiting normally or d

[Tutor] finally without try or except

2012-07-30 Thread Tino Dai
Hi! Is there anyway to execute a block of code at the end of a program in 2.6 regardless of what happened before eg exiting normally or died because of an exception? I was thinking about maybe a free standing finally code block or a decorator. Any hints? Tino

[Tutor] Readabilty vs 80 characters

2012-04-19 Thread Tino Dai
Hi! I have a question about style. In PEP-8, it says don't exceed 79 characters, but can this rule ever be trumped by readability? Eg. if someobject.filter(something) \ .filter(somethingreallyreallyreallyreallylong == somethingelsereallyreallylong) \ .filter(otheth

Re: [Tutor] python editor

2012-02-08 Thread Tino Dai
On Wed, Feb 8, 2012 at 9:17 AM, R.S. wrote: > I'm using Spyder (http://code.google.com/p/spyderlib/) and Notepad++ on > Windows. > > I don't like pycharm. This software is consuming too much resources witch > for me is poinless. Pycharm can eat even 500MB+ of RAM for simple > application. > > > 2

[Tutor] Namespace question

2012-01-20 Thread Tino Dai
Hi everybody, Got a namespace question framed inside a Django project (but I still think it's pertinent to Python). We moved and broke settings.py four different files in a separate directory called settings. So instead of doing a >>> import settings >>> settings.whatever We are having to d

Re: [Tutor] Something in my .pythonrc broke my shell

2011-08-11 Thread Tino Dai
On Thu, Aug 11, 2011 at 6:44 AM, Wolf Halton wrote: > Tino, > Copy the contents of your .pythonrc here so we can see what is going on. > Wolf > > I pastebin'ed it: http://pastebin.com/tdsK9JtK -Thanks, Tino ___ Tutor maillist - Tutor@python.org To un

[Tutor] Something in my .pythonrc broke my shell

2011-08-11 Thread Tino Dai
Hi Everybody, I'm using sontak's environment to give me a IDE in vim. He also crafted some code in the .pythonrc. Problem is, it broken my keyboard. The letter b not longer displays when I'm in the python shell (2.6.5 - linux), but everything is fine when enter the shell using the -E flag.

Re: [Tutor] Meta language and code generation

2011-04-01 Thread Tino Dai
On Fri, Apr 1, 2011 at 1:09 PM, Karim wrote: > > Hello All, > > I would to ask you if somebody has experience or can give direction in a > new project I have. > I have a meta language description (in xml) from which I should generate > code on different > languages. In my case, lisp and tcl. > >

Re: [Tutor] very odd math problem

2011-03-11 Thread Tino Dai
> Some further resources: > > http://floating-point-gui.de/ > http://introcs.cs.princeton.edu/91float/ > > David Goldberg used to have a fantastic (although quite technical) > discussion of floating point issues, "What Every Computer Scientist Should > Know About Floating-Point Arithmetic": > > htt

Re: [Tutor] Ideas and good examples

2011-02-03 Thread Tino Dai
On Thu, Feb 3, 2011 at 2:24 PM, David Goering wrote: > Hello, > this is my first message here... and come to think of it my first Message > in a Mailing List what so ever. So a moment of epic historical importance :) > Anyway I decided I wanted to learn Python as I didn't really know any > script

Re: [Tutor] Having a problem with markdown

2011-01-26 Thread Tino Dai
On Wed, Jan 26, 2011 at 2:46 AM, ian douglas wrote: > Hey all, > > I followed a tutorial on creating a very simple wiki in Python, which > worked fine until the example where the instructor wanted to render the > output through markdown.markdown() > > Here's the view code: > > from agwiki.wiki.mo

Re: [Tutor] class question

2011-01-26 Thread Tino Dai
> > > A raw casting comes into a factory. It is listed as such. When machined, > this part number changes to a different part number. The raw casting has > no "quality related" stuff, but the machined casting does, and it can have > more than one "quality related" thing. > > ...because, the raw

[Tutor] Was: Trying to parse a HUGE(1gb) xml file in python Now: OT, Hackerspaces

2010-12-20 Thread Tino Dai
Hi Ashish, Check out Noisebridge ( https://www.*noisebridge*.net/) in SF. I think you will find there are like minded tech people there. It also has Mitch Altman ( http://en.wikipedia.org/wiki/*Mitch*_*Altman* ) is one of

Re: [Tutor] (no subject)

2010-10-30 Thread Tino Dai
On Sat, Oct 30, 2010 at 6:44 PM, Jacob Bender wrote: > Dear Tutors, > > I was wondering how I could make an AI for creatures that run > around, and try to survive. Like polyworld. The real problem is making > the code connection to make them learn. Can you please help? > > Thanks > Hi Jacob,

Re: [Tutor] Test Drive Development, DocTest, UnitTest

2010-09-23 Thread Tino Dai
> The lines between doc tests, blackbox testing, whitebox testing, and > regression testing is blurry. People may legitimately disagree on > whether a specific test is documentation, testing the interface, > testing the implementation, or all three. > Wow!!! Ok that clears up a lot. Thank you

Re: [Tutor] Test Drive Development, DocTest, UnitTest

2010-09-22 Thread Tino Dai
On Wed, Sep 22, 2010 at 3:53 AM, Walter Prins wrote: > You might also have a look at some of the other popular testing frameworks > e.g. Nose (http://somethingaboutorange.com/mrl/projects/nose/0.11.2/) and > py.test (http://wiki.python.org/moin/PyTest) Both of these have the > advantage that the

Re: [Tutor] Test Drive Development, DocTest, UnitTest

2010-09-22 Thread Tino Dai
> > The *primary* purpose of doctests are to be executable examples. When > you write documentation, including example code is the most natural > thing in the world. doctest lets you execute those examples, to ensure > that they work. They're certainly not meant as an exhaustive test of > every sin

[Tutor] Test Drive Development, DocTest, UnitTest

2010-09-21 Thread Tino Dai
Hi All, In my journey from a hacker to a professional software developer, I have started to learn the finer points of Test Drive Development via Django (no questions about Django though). I am torn between the DocTest and UnitTest. I like the one "fileness" of the DocTest, but am concerned ab

Re: [Tutor] Help with Object Oriented Programming

2010-08-31 Thread Tino Dai
On Mon, Aug 30, 2010 at 2:59 PM, Knacktus wrote: > You could google for > > 1) Alex Martelli, Design Patterns > He's a Pyton guru and there're some online talks (at Google and some > conferences) about DP; a bit difficult to understand, well, he's guru ;-) > > 2) http://www.suttoncourtenay.org.u

Re: [Tutor] Help with Object Oriented Programming

2010-08-31 Thread Tino Dai
On Mon, Aug 30, 2010 at 3:21 PM, Alan Gauld wrote: > > "Tino Dai" wrote > >>      I'm beefing up my Object-Oriented Analysis and Design - getting >> the gaps in my >> knowledge filled in through the Head First OOAD book > > I don't know i

Re: [Tutor] Help with Object Oriented Programming

2010-08-31 Thread Tino Dai
On Mon, Aug 30, 2010 at 2:26 PM, Serdar Tumgoren wrote: > I haven't read it yet myself, but the below book just came out: > > http://www.amazon.com/Python-3-Object-Oriented-Programming/dp/1849511268/ref=cm_cr_pr_sims_t > > I'm not aware of any other book that focuses exclusively on OO in Python, >

[Tutor] Help with Object Oriented Programming

2010-08-30 Thread Tino Dai
Hi Everybody, I'm beefing up my Object-Oriented Analysis and Design - getting the gaps in my knowledge filled in through the Head First OOAD book (http://headfirstlabs.com/books/hfooad/). That book focuses on Java - is there a comparable book for Python? I have already read the Alan Gauld'

Re: [Tutor] retrieve URLs and text from web pages

2010-06-29 Thread Tino Dai
> > I decided to go with Regular Expressions to modify the text. In the >> Python.org it is stated that they provide more options and flexibilty >> compared to strings and their modules. >> > > "their modules" referring to the "string" module and the string methods > here, I assume. > > Regular e

Re: [Tutor] retrieve URLs and text from web pages

2010-06-28 Thread Tino Dai
On Sun, Jun 27, 2010 at 12:15 PM, Khawla Al-Wehaibi wrote: > Hi, > > I’m new to programming. I’m currently learning python to write a web > crawler to extract all text from a web page, in addition to, crawling to > further URLs and collecting the text there. The idea is to place all the > extracte

Re: [Tutor] Misc question about scoping

2010-06-07 Thread Tino Dai
>answerDict=dict(map(lambda x: (str(x[1]),x[0]),map(lambda x: \ >> x.values(),Answer.objects.filter(fk_questionSet=1). \ >> filter(fk_question=1).values('widgetAnswer').order_by(). \ >> annotate(widgetCount=Count('widgetAnswer') >> >> > The first time there

Re: [Tutor] Misc question about scoping

2010-06-05 Thread Tino Dai
On Fri, Jun 4, 2010 at 8:24 PM, Alan Gauld wrote: > "Hugo Arts" wrote > > > [1] http://mitpress.mit.edu/sicp/ >> [2] >> http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/ >> >> > And I'd add the superb How to Design Programs: > > http://www.htdp.org/ > > It teaches Scheme pr

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Tino Dai
> I have a distinct feeling that you would simply love a language like lisp. LOL, it's actually on the list of things to do. And hear that one will become a better programmer once they learn LISP. > The code is succinct, and it may very well be called elegant in some > sense of the word. I might

Re: [Tutor] Misc question about scoping

2010-06-04 Thread Tino Dai
> That is technically correct, you could do that. That's a good example of > the syntax of the `if` expression, but it's a bad example of where to > use it: > > (1) it only works in Python 2.5 or better; and > > (2) experienced Python programmers will laugh at you :) > > with all due respect to Ala

[Tutor] Misc question about scoping

2010-06-03 Thread Tino Dai
Hi All, Is there a way to express this: isThumbnail = False if size == "thumbnail": isThumbnail = True like this: [ isThumbnail = True if size == "thumbnail" isThumbnail = False ] and the scoping extending to one level above without resorting to the global keywo

[Tutor] Question about Python being object oriented

2010-05-08 Thread Tino Dai
Hi Everybody, My friend and I were having a disagreement about Python. Has Python always been an OO language or was it at one point a procedural language like C? Thanks! -Tino ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscri

[Tutor] getting original pattern from regular expression object

2010-04-19 Thread Tino Dai
If I have: import re a=re.compile('foo') is there a way to get the original pattern of foo from the object a? Thanks, Tino ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tu

Re: [Tutor] Recommendations on Workshops, Courses, Live Online Training

2010-03-11 Thread Tino Dai
On Thu, Mar 11, 2010 at 1:22 PM, Alan Gauld wrote: > > "Khalid Al-Ghamdi" wrote > > > I've subscribed to ShowMeDo, but I feel something more than just video >> tutorials. Do you have any recommendations on where I can find workshops, >> Courses, Live Online Training where I can interact with a r

Re: [Tutor] Downloading S3 Logs

2010-02-11 Thread Tino Dai
On Thu, Feb 11, 2010 at 11:23 AM, Lao Mao wrote: > Hello, > > I've written the below to get the previous day's logs from an Amazon S3 > bucket. > > #!/usr/bin/python > import time > from datetime import datetime > import boto > > daily_s3_log = open("/tmp/s3logs", "w+") > now = datetime.now() > c

[Tutor] Can we unroll a loop?

2009-11-02 Thread Tino Dai
Hi Everybody, I am wondering about a better approach to doing this: for obj in groups: rVs = rVs + Event.objects.get(group=obj) rVs.sort() Instead what I'm looking for is to have a construct that would expand out to this: rVs = Event.objects.get(group=groups[0]) |

Re: [Tutor] Pack/Unpack hacking

2009-09-07 Thread Tino Dai
In general, xxx.pyc is the compiled Python bytecode for xxx.py, so > struct.py is the source for struct.pyc. > > Looking at struct.py, it's entire contents is > from _struct import * > from _struct import _clearcache > > This is a pretty common idiom in the std lib for modules that are > implemente

[Tutor] Pack/Unpack hacking

2009-09-06 Thread Tino Dai
Hi All, Hope the people in the US are having a nice Labor Day! I am looking for the source code for the pack/unpack functions found in the struct package. As of this email, I have tried a strings on the struct.pyc file. The inspection of the pyc file was hoping that I could find a stub to the

Re: [Tutor] rationale for nested classes?

2009-08-17 Thread Tino Dai
Bob, I could see where you could use a class inside of a class. Is it possible for you give a simple example of it? Thanks, Tino On Fri, Aug 14, 2009 at 2:05 PM, Serdar Tumgoren wrote: > Okay, those explanations definitely help. I thought I had run into a > situation where nested classes m

Re: [Tutor] Web framework: looking for python-tutor's angle.

2009-08-13 Thread Tino Dai
On Thu, Aug 13, 2009 at 2:09 PM, Mac Ryan wrote: > A couple of months ago I took the time to read a few articles on python > web application frameworks and I got the impression that the two most > mature and active projects are Zope and Django. > > Zope vs. Django hits 879.000 pages on google but

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread Tino Dai
On Thu, Jun 11, 2009 at 1:15 PM, Alan Gauld wrote: > > "Tino Dai" wrote > >> >> I know that this is a python group but you might want to try the open >> source utility called Expect. It does what you need it to do without >> having >> havin

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread Tino Dai
Hi, I know that this is a python group but you might want to try the open source utility called Expect. It does what you need it to do without having having to go through this trial and error process with subprocess. http://expect.nist.gov/ -Tino On Thu, Jun 11, 2009 at 9:45 AM, eShopping w

Re: [Tutor] smptlib question

2009-06-08 Thread Tino Dai
On Mon, Jun 8, 2009 at 5:15 PM, Albert-jan Roskam wrote: > > (sorry for posting this again, but something might have gone wrong) > > Hi, > > I made a very simple program to send everybody I know a change of address I > am parsing the .msg files with another function, which returns a set called >

[Tutor] multithreaded debugger

2007-10-22 Thread Tino Dai
Hi Everybody, Is there a multi-threaded debugger in Python? I running into some problems and a debugger would be very helpful here. Thanks, Tino ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] calling a variable name

2007-10-22 Thread Tino Dai
On 10/21/07, Bryan Fodness <[EMAIL PROTECTED]> wrote: > > > I want to get a variable name dependent on another variable. I have > tried, > > 'fs' + str(int(round(unblockedFS))) for fs13 > > and I get an invalid literal. If I code in the fs13, everything works. Is > it possible to do this? > > > >

[Tutor] getting a result from an if condition

2007-10-04 Thread Tino Dai
Hi Everybody, I'm having some problems with get an if block to work. import re regex=re.compile('(some expression)') # What I'm trying to get to work if (m=regex.search('some long string')): print m.groups() - The thing that isn't working is the m=regex in the if line. Is this

Re: [Tutor] Quick question

2007-09-22 Thread Tino Dai
On 9/21/07, Jerry Hill <[EMAIL PROTECTED]> wrote: > > On 9/21/07, Tino Dai <[EMAIL PROTECTED]> wrote: > > Is there a more pythonic way of doing this: > > > > if queuePacket.has_key('procSeq') and \ > > queuePacket.has_key('opacSeq&#x

[Tutor] Quick question

2007-09-21 Thread Tino Dai
Is there a more pythonic way of doing this: if queuePacket.has_key('procSeq') and \ queuePacket.has_key('opacSeq') and \ queuePacket.has_key('keySeq') and \ len(queuePacket['procSeq']) == 0 and \ len(queuePacket['opacSeq']) == 0 and \ len(queuePacket['keySeq']) == 0: ? -Thanks, Tino

[Tutor] Multi-threading help

2007-09-07 Thread Tino Dai
Hi there, I'm working on a multi-threaded utility to monitor network connections between three machines The configuration of the three machines are: a web machine that feeds back to two machines for processing. Sometimes when the web connection is closed, the corresponding processes on the t

Re: [Tutor] Condensing Some Massive Code

2007-09-05 Thread Tino Dai
On 9/2/07, David Millar <[EMAIL PROTECTED]> wrote: > > Hello. I'm working on a text adventure game right now, and I seem to be > kind of stuck. There's a huge chunk of code called moreaction() that pulls > scripted events for certain locations. It's ever-changing so I'm not looking > for specifics,

[Tutor] Detecting sequences in lists

2007-08-27 Thread Tino Dai
Hi Everybody, Thank you so much for the information on sets. I think that that has certain uses, but in my case I can't find a way. I have been thinking about sequences in a list. Let me give you an example: tset = [ 1,2,4,0,0,1,2,4,4] What I want to do is detect the 1,2,4 sequence and pe

Re: [Tutor] using in over several entities

2007-08-25 Thread Tino Dai
On 8/24/07, Chris Calloway <[EMAIL PROTECTED]> wrote Thanks everybody for their assistance! Makes my code a lot more elegant. -Tino ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] using in over several entities

2007-08-24 Thread Tino Dai
Hi there, I am wondering about a short cut to doing this. Let's say that we have an array: dbs= ['oracle','mysql','postgres','infomix','access'] and we wanted to do this: if 'oracle' in dbs or 'mysql' in dbs or 'bdb' in dbs: <... do something ...> Is there a short way or writing this? S

[Tutor] subprocess and su

2007-08-21 Thread Tino Dai
Hi there, I'm have a tough time figuring out how to get su and subprocess working. I have PIPE=subprocess.pipe sbp=subprocess.Popen (["su","-",stdin=PIPE,stdout=PIPE,close_fds=True,shell=True) how I thought that it was supposed to work was it would allow me to use sbp.communicate() to send

Re: [Tutor] Restarting a module

2007-07-23 Thread Tino Dai
On 7/23/07, Alan Gauld <[EMAIL PROTECTED]> wrote: "Tino Dai" <[EMAIL PROTECTED]> wrote > Sorry about that. I think that a simpler question would be: I'm not sure what the better question is, but I think I answered it :-) > In my driver code: > > a

Re: [Tutor] Restarting a module

2007-07-23 Thread Tino Dai
Sorry about that. I think that a simpler question would be: In my driver code: ap = apacheModule.apacheModule(configXML) while 1: try: rVs=ap.perf() for anObj in self.objList: getattr(anObj,"do")(rVs) time.sleep(1) except ArraryOutOfBoundsE

[Tutor] Restarting a module

2007-07-23 Thread Tino Dai
Hi Everybody, I have a question about restarting a part of the program after it dies. I have a driver program that instantiates a class and runs methods from that class. Occasionally, the method gets bad data and it bombs out. Instead of bombing out, I would like the program to grab new data

Re: [Tutor] Running program from Python

2007-07-20 Thread Tino Dai
On 7/20/07, Chris Smith <[EMAIL PROTECTED]> wrote: Howdy, I am working on some research. I'm trying to optimize the performance of an antenna. For the simulation of the antenna it would be easiest to use an antenna software package that I have in my lab. I know that Matlab can call the antenna

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Tino Dai
On 7/19/07, Eric Brunson <[EMAIL PROTECTED]> wrote: Tino Dai wrote: > On 7/19/07, *Kent Johnson* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> > wrote: > > > The two advantages that I can see are, I don't need to type as > much, and > >

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Tino Dai
For what purpose would you do this? For one thing: sheer laziness ;). But seriously, I though that if I abstracted all of those classes, it would be easier to maintain in the future. That is the real reason behind my wanting refactor that piece of code. -Tino

Re: [Tutor] Style question with classes and modules

2007-07-19 Thread Tino Dai
On 7/19/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > The two advantages that I can see are, I don't need to type as much, and > there would be a speed up in the execution of code. Why do you expect a speedup? In the Python Reference by David Beazley on p. 40, he substituted import math wi

[Tutor] Style question with classes and modules

2007-07-19 Thread Tino Dai
Hi there Everybody, I have style question with importing of modules and classes. Presently, I have several files importing several modules. #apacheModule import dbBase import dbCommon import miscBase My question is there any advantage to me wrapping them in a single file (wrapper), and th

Re: [Tutor] File parse

2007-07-19 Thread Tino Dai
On 7/18/07, Tiger12506 <[EMAIL PROTECTED]> wrote: >I sent a sample of the file "testin.txt" in the last email. Here are the > lines themsevles: Oh! Sorry. I didn't look in the attachments - I expected the lines in the email. My mistake. Try this ~~ :-P ## import

Re: [Tutor] curses

2007-07-16 Thread Tino Dai
On 7/16/07, Tiger12506 <[EMAIL PROTECTED]> wrote: curses does not run on my Windows XP computer. Is this supposed to be a Linux only module? Traceback (most recent call last): File "", line 1, in File "C:\Python25\lib\curses\__init__.py", line 15, in from _curses import * ImportError:

Re: [Tutor] eyeD3 module installation on XP

2007-07-13 Thread Tino Dai
On 7/13/07, Richard Querin <[EMAIL PROTECTED]> wrote: I'm interested in writing a small app - or attempting to ;) - which will involve using the eyeD3 python module to process id3 tags of a given set of files. There are source downloads as well as downloads for various linux distros, which is f

Re: [Tutor] Question about code reviews

2007-07-13 Thread Tino Dai
On 7/12/07, Tiger12506 <[EMAIL PROTECTED]> wrote: >> >> > Do you know of any service or person that could do a code review >> > for me? >> >> Perhaps if you were more specific about what you are looking for in the >> review? If you merely want something to check your code for possible >> er

Re: [Tutor] Question about code reviews

2007-07-12 Thread Tino Dai
On 7/12/07, Adam A. Zajac <[EMAIL PROTECTED]> wrote: > Do you know of any service or person that could do a code review > for me? Perhaps if you were more specific about what you are looking for in the review? If you merely want something to check your code for possible errors and how well

[Tutor] Question about code reviews

2007-07-11 Thread Tino Dai
Hi there, Do you know of any service or person that could do a code review for me? Thanks, -Tino ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Question about lambda and new.instancemethod

2007-07-10 Thread Tino Dai
Hi Everybody, I have been working on a parser for myself. I want to create methods on the fly with the information that I get from a file. Here is my question: class configure: <.stuff deleted..> def parseGlobal(self,projectName,section,project): for ele

Re: [Tutor] An interesting case... of east vs. west

2007-07-10 Thread Tino Dai
On 7/10/07, John <[EMAIL PROTECTED]> wrote: I was trying to read in a tab delimited file i was given with lat and lon, the thing is I needed decimal lat, and decimal long... well, anyway I think you can see what my problem was: for i in range(0,344) y=d[i][2].split('\xb0') x=d[i][3].spli

Re: [Tutor] Importing and creation on the fly

2007-06-28 Thread Tino Dai
On 6/26/07, Tino Dai <[EMAIL PROTECTED]> wrote: On 6/26/07, Dave Kuhlman <[EMAIL PROTECTED]> wrote: > On Tue, Jun 26, 2007 at 12:20:18PM -0400, Tino Dai wrote: > > Hi there, > > > > I've been banging my head on this for about two weeks, and I can&#x

Re: [Tutor] Importing and creation on the fly

2007-06-26 Thread Tino Dai
On 6/26/07, Dave Kuhlman <[EMAIL PROTECTED]> wrote: On Tue, Jun 26, 2007 at 12:20:18PM -0400, Tino Dai wrote: > Hi there, > > I've been banging my head on this for about two weeks, and I can't > figure out a solution to this. I'm wondering if you could

[Tutor] Importing and creation on the fly

2007-06-26 Thread Tino Dai
Hi there, I've been banging my head on this for about two weeks, and I can't figure out a solution to this. I'm wondering if you could assist me on this pesky problem. I'm reading in an xml file that has the name of class, location, and the filename into a dictionary. I want to import th

[Tutor] Advanced tutorial on pygtk

2007-01-29 Thread Tino Dai
Hi there Everybody, I'm currently writing a program in pygtk, and I'm looking for a more advanced tutorial in pygtk. I have read the one that is on the pygtk.orgsite, and that has given a me a good basis from which to start. Now, I am looking to expand my range of knowledge. Also with that,

[Tutor] Question about structuring my pygtk program

2007-01-23 Thread Tino Dai
Hi Everybody, I have a question about structuring first pygtk program now that I have the basics working, I am moving to the next step of organizing my program so it doesn't turn into spaghetti code. Right now, what I'm doing is if a component of the GUI is used in more than one spot, I mak

Re: [Tutor] Variables of Variables

2007-01-23 Thread Tino Dai
*** Stuff deleted Wanted to give you an update. It is working now. Thank you ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Variables of Variables

2007-01-22 Thread Tino Dai
On 1/18/07, Danny Yoo <[EMAIL PROTECTED]> wrote: > Rather than storing your data as variables, you could store it in a > dictionary. Then you can dynamically access data however you like.. Suggesting a dictionary here is right. ** Stuff deleted about why using variables of variables is bad **

[Tutor] Variables of Variables

2007-01-18 Thread Tino Dai
Hi Everybody, Is there a way to do variables of variables in python. For example in perl: $foo = 'bar' $$foo = '5' and $bar will have a value of 5. I have been search high and low for a simple way to do this in python? -Thanks, Tino ___ Tutor mai

[Tutor] General programming question

2006-07-18 Thread Tino Dai
Hi Everybody, I have a general question about programming. My program that I have been writing is fully modularized. My question is: Is there a programming technique that would alleviate the passing of a huge number of variables. Let me further elucidate. I could see a day when I would be writi

Re: [Tutor] Python on AIX

2006-07-12 Thread Tino Dai
On 7/12/06, Steve Nelson <[EMAIL PROTECTED]> wrote: Hello all,Just started a new job - most of the machines I am administering areAIX, and don't have Python at all.  What is going to me the mostpain-free, scaleable and supportable way of getting Python onto these machines?  I need to take this requ

Re: [Tutor] More assistance with queues and global variables

2006-07-05 Thread Tino Dai
On 7/5/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Tino Dai wrote:> Hi All,>>  My project is almost working (and without global variables!), and> there is one more hurdle that I want to jump. That is using the> SocketServer module and passing a queue (or for that matter a

[Tutor] More assistance with queues and global variables

2006-07-05 Thread Tino Dai
Hi All, My project is almost working (and without global variables!), and there is one more hurdle that I want to jump. That is using the SocketServer module and passing a queue (or for that matter any kind of variable) to the handle method. I took a look at SocketServer to see what classes I n

Re: [Tutor] Unit testing

2006-06-29 Thread Tino Dai
Okay, I was bored tonight, so I cooked up an illustration.Thanks for that! Here's an example with five stages.  Stage 1 takes a string and fills aninput queue with a series of letters from the string.  Stages 2-4 do just take a letter off its input queue and move it to its output queue.  Stage5 ta

Re: [Tutor] Unit testing

2006-06-28 Thread Tino Dai
On 6/27/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Tino Dai wrote:> How I have it now:>> semaA = threading.semaphore()>> class nameA:>def __init__(self):> >>def run(self): >  >  semaA.release()&

Re: [Tutor] Unit testing

2006-06-28 Thread Tino Dai
Then where you create instances of those classes:sema = threading.semaphore() a = nameA(sema)b = nameB(sema)Maybe you don't even need the semaphore at all: have a look atQueue.Queue, it might do exactly what you need.Ok, I think I'm going to back up and explain what I'm am heading towards. I'm work

Re: [Tutor] Unit testing

2006-06-27 Thread Tino Dai
On 6/27/06, Tino Dai <[EMAIL PROTECTED]> wrote: On 6/27/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Tino Dai wrote:> And there is one caveat, I> will have to make a bunch of semaphores global instead of local to the> classes. While I know that there is no hard and fast rul

Re: [Tutor] Unit testing

2006-06-27 Thread Tino Dai
On 6/27/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Tino Dai wrote:> And there is one caveat, I> will have to make a bunch of semaphores global instead of local to the> classes. While I know that there is no hard and fast rule about using> global variables, where can I find or ca

Re: [Tutor] Unit testing

2006-06-27 Thread Tino Dai
On 6/27/06, Baiju M <[EMAIL PROTECTED]> wrote: On 6/26/06, Tino Dai <[EMAIL PROTECTED]> wrote:[...]> How would I unit test python GUIsFew weeks back I wrote a small article,may be helpful, so here it is : http://baijum81.livejournal.com/11598.htmlRegards,Baiju MBaiju, This is e

Re: [Tutor] Unit testing

2006-06-27 Thread Tino Dai
On 6/27/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > Ok, that leads me to my next question.  Currently, I have a class> that I> want to unit test, but it contains a semaphore from another class.> Now, I> could make the semaphore a global variable, or I bring in the other > class.> One violates "good

  1   2   >