Hello,
Is it possible to create files containing python code in the same sort
of way that you can generate text files.
A simple example perhaps could be a persistent dictionary. Keys and
values are written to the dictionary in a file, that can be imported later.
Thanks,
T
--
C.T
Hello Tutors,
I was just wondering if you have a dictionary key is it faster to do:
if dict['key'] == 'foo':
...
or is this faster:
if 'foo' in dict['key']:
...
Or is there any difference and I'm chasing ghosts?
Thanks,
T
--
C.T.
If I can follow up with the 'not free' theme, I also think 'Practical
Django Projects' by James Bennett is pretty good.
For really fast tutorials, look for screencasts too.
T
And though it's not free, I highly recommend the book Pro Django by
Marty Alchin.
___
Well there was PyMag (http://pymag.phparch.com), each issue had a
dedicated howto for a python topic.
I say 'was' because they seem to busy doing something with their site,
which says they'll be back by January 26th.
I know it was possible to order back issues as pdf's.
T
Bala subramanian wrot
I've change the code and I think I have what you were talking about.
def mysort(list_):
for i in xrange(0, len(list_)):
pos = i
for j in xrange(pos+1, len(list_)):
if list_[i] > list_[j]:
pos = j
list_[i], lis
Dave Angel wrote:
C.T. Matsumoto wrote:
Dave Angel wrote:
(You forgot to do a Reply-All, so your message went to just me,
rather than to me and the list )
C.T. Matsumoto wrote:
Dave Angel wrote:
C.T. Matsumoto wrote:
Hello,
This is follow up on a question I had about algorithms. In the
Jeff Johnson wrote:
C.T. Matsumoto wrote:
Dave Angel wrote:
(You forgot to do a Reply-All, so your message went to just me,
rather than to me and the list )
C.T. Matsumoto wrote:
Dave Angel wrote:
C.T. Matsumoto wrote:
Hello,
This is follow up on a question I had about algorithms. In
Dave Angel wrote:
(You forgot to do a Reply-All, so your message went to just me, rather
than to me and the list )
C.T. Matsumoto wrote:
Dave Angel wrote:
C.T. Matsumoto wrote:
Hello,
This is follow up on a question I had about algorithms. In the
thread it was suggested I make my own
m...@doctors.net.uk wrote:
Dear All,
Quick UT question. I am working on a CSV processing script. I want to write some tests. The tests will need to read in, manipulate and write out some CSV files.
My instinct is to manually construct some small data files, and consider them
as part of the t
Steven D'Aprano wrote:
On Thu, 4 Mar 2010 04:27:23 am C.T. Matsumoto wrote:
Hello,
Can someone tell me the difference between unittests assertEqual and
assertEquals?
assertEqual, assertEquals and failUnless are three spellings for the
same thing. There is no diffe
Dave Angel wrote:
C.T. Matsumoto wrote:
Hello,
This is follow up on a question I had about algorithms. In the thread
it was suggested I make my own sorting algorithm.
Here are my results.
#!/usr/bin/python
def sort_(list_):
for item1 in list_:
pos1 = list_.index(item1
Hello,
Can someone tell me the difference between unittests assertEqual and
assertEquals?
Cheers,
T
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Hello,
This is follow up on a question I had about algorithms. In the thread it
was suggested I make my own sorting algorithm.
Here are my results.
#!/usr/bin/python
def sort_(list_):
for item1 in list_:
pos1 = list_.index(item1)
pos2 = pos1 + 1
try:
item2
Dave Angel wrote:
Jojo Mwebaze wrote:
Hi There,
i would like to implement the following in lists
assuming
x = 3
y = 4
z = None
i want to create a dynamic list such that
mylist = [ x , y, z ] , if z in not None
if z is None then
mylist = [x,y]
Anyhelp!
cheers
Jojo
Are there any
Jojo Mwebaze wrote:
Hi There,
i would like to implement the following in lists
assuming
x = 3
y = 4
z = None
i want to create a dynamic list such that
mylist = [ x , y, z ] , if z in not None
if z is None then
mylist = [x,y]
Anyhelp!
cheers
Jojo
--
James Reynolds wrote:
I have another question related to OOD. What I have is a module with
one parent class and two child classes. Some stuff is done to the
object that is passed to the function in one of the child classes and
this then calls a function from the global class passing local
vari
spir wrote:
On Thu, 18 Feb 2010 09:11:22 -0500
Kent Johnson wrote:
It's true that solving a problem often involves creating an algorithm
in a broad sense. The formal study of algorithms studies specific
techniques and algorithms that have proven to be useful to solve many
hard problems. In
Shashwat Anand wrote:
Solving problems on ACM UVA <http://www.acm.uva.es>, SPOJ
<http://www.spoj.pl>, Codechef <http://www.codechef.com> helps too
plus it is fun.
On Thu, Feb 18, 2010 at 11:48 PM, Alan Gauld
mailto:alan.ga...@btinternet.com>> wrote:
"C.T.
Kent Johnson wrote:
On Thu, Feb 18, 2010 at 9:43 AM, C.T. Matsumoto wrote:
Here is the example.
"To keep this simple and practical, as a suggestion, consider the problem of
sorting a list (a pack of cards, or a list of names or whatever you want)
into order."
Yes, there are
Kent Johnson wrote:
On Thu, Feb 18, 2010 at 8:17 AM, C.T. Matsumoto wrote:
Kent Johnson wrote:
But is that what you are asking for, or are you trying to sharpen your
problem-solving skills? Many progamming problems are solved by simple
loops and data structures without explicitly
Kent Johnson wrote:
On Thu, Feb 18, 2010 at 4:59 AM, C.T. Matsumoto wrote:
Hello Tutors,
Can someone point me to any resources that can teach me about algorithms in
python?
I'm interested in learning how to analyze and make an algorithm.
I have been reading The Algorithm D
e the math background and worked out how to efficiently solve
problems.
Thanks,
Todd
Christian Witts wrote:
C.T. Matsumoto wrote:
Hello Tutors,
Can someone point me to any resources that can teach me about
algorithms in python?
I'm interested in learning how to analyze and mak
Hello Tutors,
Can someone point me to any resources that can teach me about algorithms
in python?
I'm interested in learning how to analyze and make an algorithm.
Oh, I have no background in math, but a sturdy knowledge of python, and
I want to
make more efficient code.
Cheers,
Todd
_
s gotten
much advice, and this discussion seems to changing to objectness.
Thanks,
T
On Wed, Nov 11, 2009 at 7:19 PM, Alan Gauld wrote:
>
> "C.T. Matsumoto" wrote
>
> The Table object you described I find more complicated if each table
>> stands
>> on its own
, Nov 11, 2009 at 10:28 AM, Alan Gauld wrote:
> "C.T. Matsumoto" wrote
>
> First I've got a db class
>>
>> class DB(object):
>> """ This does all the database handling.
>> """
>>
>
> That's fine.
&g
TableList):
""" Foreach CompareItem in the CompareTableList.compare_list. Workout
the differences and store difference in something that can format
a report.
"""
...
Cheers,
T
On Tue, Nov 10, 2009 at 10:12 PM, Alan Gauld wrote:
>
>
formation that I wanted to create a class object. Filling
a 'master list'
of 'CompareItem' objects.
Cheers,
T
On Tue, Nov 10, 2009 at 1:05 AM, Dave Angel wrote:
> C.T. Matsumoto wrote:
>
>> Hello All,
>>
>> I'm making a class and the parameters
Hello All,
I'm making a class and the parameters I'm feeding the class is getting quite
large. I'm up
to 8 now. Is there any rules of thumb for classes with a lot of parameters?
I was thinking
to put the parameters into a tuple and then in the __init__ of the class,
iterate over the tuple
and assi
lass above is take
from Learning Python, and there are several other examples too.
Thanks,
T
Hugo Arts wrote:
On Sat, Nov 7, 2009 at 10:39 AM, C.T. Matsumoto wrote:
yes,
class Foo: # the book says this is a class header
pass
As for my question it looks like the convention is if a clas
starts with a capital.
It's just a detail, but I wanted to know.
T
Alan Gauld wrote:
"C.T. Matsumoto" wrote
I'm reading Learning Python's section 'Operator Overloading' and I
was wondering why class headers that implement and overload are
lowercase?
I'm
Hello All,
I'm reading Learning Python's section 'Operator Overloading' and I was
wondering why
class headers that implement and overload are lowercase?
Cheers,
T
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
31 matches
Mail list logo