Re: [Tutor] Django Read

2010-07-08 Thread Huy Ton That
I've went through the djangobook myself, and found it quite readable. This would be my recommendation as well. Be sure to read the sidebar comments; if you ever feel stuck, someone else may have addressed the question/answer for you! -Lee On Thu, Jul 8, 2010 at 9:31 AM, Jeff Johnson wrote: > O

[Tutor] Python Documentation Clarification

2010-07-12 Thread Huy Ton That
This is going to sound silly, but I realized there are some areas within the documentation that do not make absolute sense to me. e.g. compile(source, filename, mode[, flags[, dont_inherit]]) I see within this built in function, the first argument can be what they define as source, the second ar

Re: [Tutor] Python Documentation Clarification

2010-07-12 Thread Huy Ton That
Proverbial Ah-ha moment all. This clarifies things greatly (: Thanks you all!! On Mon, Jul 12, 2010 at 11:29 AM, Nick Raptis wrote: > > >> compile(source, filename, mode[, flags[, dont_inherit]]) >> >> I see within this built in function, the first argument can be what they >> define as source,

Re: [Tutor] django help....

2010-07-26 Thread Huy Ton That
I highly recommend www.djangobook.com The continuity is very good, and along the side of the book are comment boxes with further insight from users. After getting to about chapter 4, you should be able to toggle between djangoproject.com's documentation and the rest of the djangobook for further

Re: [Tutor] Problem with input() and unicode string

2010-07-28 Thread Huy Ton That
You can do: input(unicode('Introduce el año:', 'latin-1').encode('latin-1')) Maybe someone could explain it better than I can. HTH, Huy On Wed, Jul 28, 2010 at 12:05 PM, Alex wrote: > Hello, I have a problem with this code: > > # -*- coding: latin-1 -*- > year = u'año, ò, ó, ç' > print year

[Tutor] Where to start with Unit Testing

2010-08-01 Thread Huy Ton That
Hi all, Do any of you have any feedback, strategies and best practices related to unit testing within Python. This is a relatively new topic for me. I was thinking of starting with reading the documentation associate with the unittest module. -Huy ___ T

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread Huy Ton That
All these responses are incredible, I will go through them on my venture to bring unit testing under my belt. I have never done formal unit testing in my programming career, I've just gone through way of general debugging and utilizing version control such as Mercurial. On Sun, Aug 1, 2010 at 9:4

Re: [Tutor] Where to start with Unit Testing

2010-08-02 Thread Huy Ton That
code, then writing some code to test what I think I know. I'll try to integrate this and commit this to memory with time where I won't have to look back as much (: On Sun, Aug 1, 2010 at 9:25 AM, Mac Ryan wrote: > On Sun, 2010-08-01 at 03:30 -0400, Huy Ton That wrote: > > H

Re: [Tutor] Where to start with Unit Testing

2010-08-02 Thread Huy Ton That
One final note, that I thought might be useful to others. I've just discovered doctest, which allows you to run tests on your embedded function/class documentation. Check it out here: http://docs.python.org/tutorial/stdlib.html#quality-control On Sun, Aug 1, 2010 at 3:30 AM, Huy Ton That

Re: [Tutor] how to get str() to use my function?

2010-08-04 Thread Huy Ton That
You could write __str__ function >>> class card(object): ... def __init__(self, card1, card2): ... self.card1, self.card2 = card1, card2 ... def __str__(self): ... return str(str(self.card1)+','+str(self.card2)) ... >>> a = card(0,0) >>> str(a) '0,0' On Wed, Aug 4,

Re: [Tutor] how to get str() to use my function?

2010-08-04 Thread Huy Ton That
ause the first was > self. I put the function inside my card class: > def __eq__(self, card1, card2): > return(card1.rank==card2.rank) > #end def __eq__ > For some reason it is still looking for three arguments... > > > On 8/4/10, Huy Ton That wrote: > > You could wri

Re: [Tutor] getattr()

2010-08-04 Thread Huy Ton That
ase > there is no module so why can you substitute 'output_text'? > > thanks, > > Pete > > On 2010-08-04, at 3:09 PM, Huy Ton That wrote: > > If it is in the same code, and the namespace isn't a module or another > class you could do this: > > def output_te

Re: [Tutor] getattr()

2010-08-04 Thread Huy Ton That
Oh, that's right, I should have tried to example in the interpreter instead of in my head:P Say Bob, Is that the preferred method over something like: >>> import __main__ as main On Wed, Aug 4, 2010 at 3:32 PM, bob gailer wrote: > On 8/4/2010 1:23 PM, Pete wrote: > > Hi, > > I'm trying to u

Re: [Tutor] getattr()

2010-08-04 Thread Huy Ton That
I have a side question, I am using python 2.7. Why do you use class A: instead of class A(object): ? -Huy On Wed, Aug 4, 2010 at 4:08 PM, bob gailer wrote: > On 8/4/2010 4:04 PM, bob gailer wrote: > >> On 8/4/2010 3:44 PM, Huy Ton That wrote: >> >>> Oh, that'

Re: [Tutor] string to list

2010-08-05 Thread Huy Ton That
Speaking of which, is there some place you or anyone can recommend on picking up all the constructs for list comprehension & generator comprehension. I've perused the python.org documents and have just been building them according to example. How can I pick up more advanced usage? I mostly catch

Re: [Tutor] Question about Dictionaries

2010-08-16 Thread Huy Ton That
What do you mean by subclass? On Aug 16, 2010 3:26 PM, "Emile van Sebille" wrote: On 8/16/2010 10:44 AM Chorn, Guillaume said... > > Hi All, > > I know that I can look up the value for a particular key in a > dictionary, but can... Yes. But you'll need to implement it. There are likely modul

[Tutor] classmethod, staticmethod functions (decorator related)

2010-09-10 Thread Huy Ton That
I am reading the decorator section within Expert Python Programming and I am very confused in the first example, of a method that was done before decorators. It reads: class WhatFor(object): def it(cls): print 'work with %s' % cls it = classmethod(it) def uncommon(): pr

Re: [Tutor] classmethod, staticmethod functions (decorator related)

2010-09-12 Thread Huy Ton That
Hm, thanks guys; I just had to verify I was thinking sanely about it. I am going to pick up classmethods next. Do any of you have common design patterns for the usage. They are just items I haven't integrated in my coding, and I want to be certain I'm off on the right foot (: On Sun, Sep 12, 2010

Re: [Tutor] classmethod, staticmethod functions (decorator related)

2010-09-13 Thread Huy Ton That
Thank you all, I was taking a look at the module decimal.py as you cited, and it makes sense now. Looks very useful to make tools without having to instantiate anything. On Mon, Sep 13, 2010 at 7:05 AM, Steven D'Aprano wrote: > On Mon, 13 Sep 2010 12:29:07 pm Huy Ton That wrote: > &