Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Alan Gauld


[EMAIL PROTECTED] wrote

on more intermediate/advanced topics like linked lists, nodes, 
trees, etc. However, it's kind of like reading a math textbook


Thats because these are abstract theoretical concepts
at the root of programming but not used much in practice in
high level languages like Python. If you were using a language
like C or Fortran or Pascal they would be highly relevant
because the language would not provide much support for
collections of data. But Python offers such a wealth of data
collections that these advanced topics are largely redundant;
just use a list or a dictionary or a set...

any suggestions for learning about real world application of more 
advanced concepts?


There are general rules about when different types apply but
the edges are blurred in Python. For example a linked list is
pretty much a Python list. A double linked list too can often be
faked in Python by using negative indexing. Trees are a bit
more valid and do have uses in applications like heirarchical
data storage such as found in file browsers, family trees,
organisational charts etc. They are also very powerful tools
for constructing searches of large data sets.

Things like bags and sets are just heterogenous collections
which Pythons native types mimic well. (Many of these
concepts grew out of early languages which only allowed
a single type of data in a collection)

OTOH there are cases for most of these data types where
there are arguments for constructing a dedicated implementation
in Python is valid, but they are rare.

If you have specific questions about specific types let us
know and we can offer more speciofic advice.

Also, are there other concepts that I should focus on? Frankly, I'm 
a bit bored because I've hit this ceiling, and I'm not really sure 
where to go to next.


If you are interested in investigating the more advanced
aspects of programming I'd suggest digging into concepts like
closures, locking, semaphores, predicate and lambda calculus,
boolean algebra, relational data theory, functional programming,
aspect oriented programming, literate programming, provable
correctness (use of assertions for pre/post conditions and
invariance etc), meta data. These are all of more direct relevance
in higher level languages like Python.

HTH,

Alan G. 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Kent Johnson
On Thu, Nov 6, 2008 at 11:14 PM,  [EMAIL PROTECTED] wrote:
 Hi everyone,

 I've been teaching myself python for a few months and I'm becoming
 frustrated because I've kind of hit a wall in terms of learning new
 information.

You might like to read the (printed) Python Cookbook. It has many good
examples of idiomatic Python in the context of solving a real problem.
Also I suggest you start working on a project that interests you and
learn what you need to know to complete it.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread W W
On Fri, Nov 7, 2008 at 4:12 AM, Eric Abrahamsen [EMAIL PROTECTED]wrote:


 snip

 Also, are there other concepts that I should focus on? Frankly, I'm a bit
 bored because I've hit this ceiling, and I'm not really sure where to go to
 next.


If you want to learn all sorts of new and exciting things, I'd suggest
learning about cryptography, and writing attacks (on your own data) as a
method of learning more. It's fun, challenging, and there's a real world
application for it, if you happen to enjoy any type of security.

my 2ยข
-Wayne
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Eric Abrahamsen


On Nov 7, 2008, at 12:14 PM, [EMAIL PROTECTED] wrote:


Hi everyone,

I've been teaching myself python for a few months and I'm becoming  
frustrated because I've kind of hit a wall in terms of learning new  
information. In an effort to continue to learn I've found some  
material on more intermediate/advanced topics like linked lists,  
nodes, trees, etc. However, it's kind of like reading a math  
textbook - the tutorials do a decent job of explaining the material  
but it's all kind of theoretical, and I'm not sure how I'd apply  
these concepts in real world applications, or incorporate them into  
my code. Does anyone have any suggestions for learning about real  
world application of more advanced concepts?


Are you writing real-world applications and using them? My (admittedly  
limited) experience has taught me that the real complexities of  
programming don't lie in obscure data structures or rarely-used  
functions, but in the practical, real-world issues that arise from  
creating actual applications: OOP best practices, application  
architecture, programming paradigms, recurring patterns, even just  
plain-old programming gotchas (though there are fewer of these in  
Python than other languages, thankfully). In other words, stuff that  
isn't necessarily described in the manuals, but that becomes evident  
once you've made the same mistakes two or three times, and start  
thinking about modifying your approach to programming. I've never used  
a tree, and a heap only once, but I feel like I've dipped into some  
pretty mind-bending stuff in terms of how I've arranged programs. Take  
metaclasses, for instance: no description of metaclasses I've read  
ever made sense to me; it only started to come clear after I'd looked  
at a module I was writing, realized that there was something really  
fundamentally wrong with it, and then slowly realized that the answer  
was metaclasses. About eleven lines of metaclass programming, as it  
turned out, but those seven lines turned my brain inside out for a  
bit. Not boring in the least!


Yrs,
Eric


Also, are there other concepts that I should focus on? Frankly, I'm  
a bit bored because I've hit this ceiling, and I'm not really sure  
where to go to next.


Thanks,
Ben
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Kent Johnson
On Fri, Nov 7, 2008 at 4:12 AM, Alan Gauld [EMAIL PROTECTED] wrote:
 For example a linked list is
 pretty much a Python list.

Other than the very different timing characteristics! Python lists are
O(1) for reading or writing a value at an index, O(n) for inserting
and deleting. Linked lists are O(n) for reading and writing and O(1)
for insertion and deletion (at a known location).

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Lie Ryan
On Thu, 06 Nov 2008 23:14:38 -0500, btkuhn wrote:

 Hi everyone,
 
 I've been teaching myself python for a few months and I'm becoming
 frustrated because I've kind of hit a wall in terms of learning new
 information. In an effort to continue to learn I've found some material
 on more intermediate/advanced topics like linked lists, nodes, trees,
 etc. However, it's kind of like reading a math textbook - the tutorials
 do a decent job of explaining the material but it's all kind of
 theoretical, and I'm not sure how I'd apply these concepts in real world
 applications, or incorporate them into my code. Does anyone have any
 suggestions for learning about real world application of more advanced
 concepts?
 
 Also, are there other concepts that I should focus on? Frankly, I'm a
 bit bored because I've hit this ceiling, and I'm not really sure where
 to go to next.
 

There is really no ceiling in learning programming. The problem is to 
find a problem. If you're bored, you can do the practically-for-bored-
programmers challenges like Python Challenge (http://
www.pythonchallenge.com/) or Project Euler (http://projecteuler.net/
index.php?section=view)

If you're up to the challenge and responsibility, you could join an open 
source program teams or start one yourself. Alternatively, you could also 
start learning some embedded python flavors, like the one used by 
OpenOffice.org or Inkscape, these provides different challenge to vanilla 
python as you've got to learn their libraries.

If you think you're bored of python, perhaps it is time to start learning 
another language. Having many programming language in your toolbox is 
certainly a life-saver, since some problems are easier to solve in 
certain languages than other. For example, many mathematical problems are 
(much) easier to express in functional language, like Haskell, compared 
to imperative language. Other languages might have features/paradigm that 
are foreign in python, like Eiffel's Programming by Contract.

You might also start seeing domain-specific languages, like SQL 
(database), XSLT (XML), (E)BNF (syntax parsing), etc.

Alternative languages you might consider: Haskell, Prolog, Eiffel, C-
family, Perl, Lisp-family, APL-family, some assembly, shell scripting 
(bash, bat, etc)

If you're EXTREMELY bored though, you might learn some of the more 
esoteric languages, e.g. Shakespeare, Piet, Whitespace, etc (be ready to 
abandon all sanity)

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Alan Gauld


Kent Johnson [EMAIL PROTECTED] wrote


For example a linked list is pretty much a Python list.


Other than the very different timing characteristics! 


True, but its pretty rare that timing issues are a reason 
for me to choose a data structure - especially if I need

to hand code it! :-)

Python lists are O(1) for reading or writing a value at an index, 
O(n) for inserting and deleting. Linked lists are O(n) for reading 
and writing and O(1) for insertion and deletion (at a known 
location).


I would say O(1) only if you already have a reference to 
that location (ie its known in that sense) but if you know that 
it's at position 23 but you only have a reference to the head 
you still need to navigate sequentially to the 23rd element
so its still an O(n). O(1) only applies when inserting at 
the next position to where you currently are. That's not too 
common a scenario in my experience.


But the geneal point is a good specific example (and I 
was struggling to think of one!) where you might choose a 
non standard list over the vanilla version. The array module 
is another case where performance is improved over the 
standard lists.


Alan G.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Kent Johnson
On Fri, Nov 7, 2008 at 6:16 PM, Alan Gauld [EMAIL PROTECTED] wrote:

 True, but its pretty rare that timing issues are a reason for me to choose a
 data structure

I would guess you commonly choose a dict or set over a list when you
need fast tests for membership. Failure to choose dict when
appropriate is certainly a common cause of performance problems.

 But the geneal point is a good specific example (and I was struggling to
 think of one!) where you might choose a non standard list over the vanilla
 version. The array module is another case where performance is improved over
 the standard lists.

The standard lib also includes collections.deque (O(1) insertion and
deletion at both ends) and heapq (binary priority queue). Third party
implementations of b-tree, avltree and trie are available which have
better performance than list and dict for some usage.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Intermediate/advanced concepts

2008-11-06 Thread btkuhn

Hi everyone,

I've been teaching myself python for a few months and I'm becoming 
frustrated because I've kind of hit a wall in terms of learning new 
information. In an effort to continue to learn I've found some material 
on more intermediate/advanced topics like linked lists, nodes, trees, 
etc. However, it's kind of like reading a math textbook - the tutorials 
do a decent job of explaining the material but it's all kind of 
theoretical, and I'm not sure how I'd apply these concepts in real 
world applications, or incorporate them into my code. Does anyone have 
any suggestions for learning about real world application of more 
advanced concepts?


Also, are there other concepts that I should focus on? Frankly, I'm a 
bit bored because I've hit this ceiling, and I'm not really sure where 
to go to next.


Thanks,
Ben
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor