Re: [Tutor] Set Reply-To field to Tutor@python.org

2013-04-09 Thread DoanVietTrungAtGmail
FWIW, I'd like to reverse my answer, and now I agree with Oscar's 29 Jan suggestion to make "Reply-to-tutor-list" the default. Lately, several times a tutor had to forward to the list an email meant for the list but sent to him only, by mistake. On the other hand, the wrote-to-1-person-but-mistake

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-24 Thread DoanVietTrungAtGmail
the author of the package PyJudy <http://stackoverflow.com/questions/550204/judy-array-for-managed-languages/550464#550464>writing in 2009 that he hasn't maintained it for "a few years", that put me off. Which one to use, I don't know yet. I am about to start experimenting w

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-13 Thread DoanVietTrungAtGmail
the question. > > > > > > Original Message > > Subject: [Tutor] Which databases allow lists as record fields? > > Date: Thu, 14 Mar 2013 10:59:27 +1100 > > From: DoanVietTrungAtGmail > > To: Dave Angel > > > > Dear tutors >

Re: [Tutor] Fwd: Which databases allow lists as record fields?

2013-03-13 Thread DoanVietTrungAtGmail
.. > You don't. You create a second table to hold the list. > Then in the second table you include be reference back to the first. > I thought about that but thought it seemed a roundabout way. But assuming I do it that way, how to deal with variable-length list? Most lists have 10^3, but some c

Re: [Tutor] A CSV field is a list of integers - how to read it as such?

2013-03-06 Thread DoanVietTrungAtGmail
> Once a csv file has been read by a csv reader (such as DictReader), it's > no longer a csv file. That was an "Aha!" moment for me. The file is on disk, each row of it is in memory as a list or dict, and it's the list or dict that matters. It's so obvious now. Thanks Dave. > a namedtuple is pr

Re: [Tutor] A CSV field is a list of integers - how to read it as such?

2013-03-03 Thread DoanVietTrungAtGmail
n-memory>says that for large lists in CPython, "the overallocation is 12.5 percent". Trung Doan On Mon, Mar 4, 2013 at 2:12 PM, Dave Angel wrote: > On 03/03/2013 09:24 PM, DoanVietTrungAtGmail wrote: > >> Dear tutors >> >> I am checking out csv as

[Tutor] timeit: 10million x 1 Vs 1million x 10

2013-02-27 Thread DoanVietTrungAtGmail
Dear tutors My function below simply populates a large dict. When measured by timeit populating 10 million items once, versus populating 1 million items ten times, the times are noticeably different: --- import timeit N = 1000 # This constant's value is either 10 million or 1 million testDic

Re: [Tutor] Python Lover

2013-02-13 Thread DoanVietTrungAtGmail
I am also learning and have found it useful to learn from David Beazley's "Python In Action", parts 1 and 2. Part 2 is tough for me because I don't know other languages nor systems programming, but may be OK for you Brajesh. The slidepacks are at http://www.slideshare.net/dabeaz/presentations

Re: [Tutor] Set Reply-To field to Tutor@python.org

2013-01-29 Thread DoanVietTrungAtGmail
On Tue, Jan 29, 2013 at 9:12 PM, Oscar Benjamin wrote: > If you don't mind my asking, do you send many off-list messages as > replies to on-list ones? > Oscar > For this list, I have sent 1 public reply and 2 private replies (to thank individual tutors). Both numbers are too small to have any sig

Re: [Tutor] Set Reply-To field to Tutor@python.org

2013-01-28 Thread DoanVietTrungAtGmail
As a student user of this list, I prefer leaving the Reply-To field unchanged. I like the fact that this means a deliberate decision is required to send public emails. Trung On Tue, Jan 29, 2013 at 12:17 PM, Steven D'Aprano wrote: > On 29/01/13 09:04, Oscar Benjamin wrote: > > One particular l

Re: [Tutor] list of references to object properties

2013-01-19 Thread DoanVietTrungAtGmail
Hi Jose, have you thought about shallow copying? I am learning Python too, so I can be wrong here. But I have just tried the idea and it worked for me: class celestialBody(object): def __init__(self, m, x, y, z): self.mass = m self.pos = [x, y, z] def __str__(self):

Re: [Tutor] Why doesn't line n execute before line n+1?

2013-01-14 Thread DoanVietTrungAtGmail
Mitya Sirenef wrote: > On Mon 14 Jan 2013 10:14:24 PM EST, DoanVietTrungAtGmail wrote: > >> Dear tutors >> >> In learning about the __call__ magic method, in the code below I >> deliberately omitted __call__ and, as expected, I got the error >> message "TypeE

[Tutor] Why doesn't line n execute before line n+1?

2013-01-14 Thread DoanVietTrungAtGmail
Dear tutors In learning about the __call__ magic method, in the code below I deliberately omitted __call__ and, as expected, I got the error message "TypeError: 'Test' object is not callable". But I am surprised that the print statement was not executed, even though the interpreter sees it first.

Re: [Tutor] Decorators: Are they good for checking inputs and outputs?

2013-01-06 Thread DoanVietTrungAtGmail
*.. Could you perhaps give a concrete example of a situation where a decorator would be useful for checking the inputs to a function? .. Oscar* Say I write a function that expects 5 positional arguments, and up to 4 ** arguments. Now I want to: a- check that the first positional argument is a sort

Re: [Tutor] need help with python for counter

2012-12-18 Thread DoanVietTrungAtGmail
After incrementing for a little while, if the condition i == digit is not met for the current character, count is reset by the else: branch. Your count variable must feel frustrated like a dog which keeps being yanked back by a cord of length 0 when it tries to get free. Trung Doan == On