Programmology

Studying and researching things of programming the 3d space.
131 comments
73 entries
Advertisement
okonomiyaki
May 14, 2005
I like templates
I finally buckled down and learned templates. More than the basic "class T" prefix to a class too, the real in-depth stuff. I realized that didn't really know them.

I've heard from people that hate them, and I've heard from people who love them. I love them, personally, though I'll admit they are…
365 views
okonomiyaki
May 02, 2005
I got an A!
Well, I got a 130/120 on my Python journal. The 10 extra points was given because I read the article and logged it in my second post. He liked the online approach and overall style of this journal. I also had to turn in two Python programs: one showing off syntax and another one that does someth…
294 views
okonomiyaki
April 26, 2005
Python #11 - Static class functions
I just figured out how to make class functions static. It's kind of tricky; just create a new definition as an attribute and bind it to the function.

class myClass:
x,y = 0,0
def add():
return (myClass.x + myClass.y)
add = staticmethod(add)


Now you can do the following:

>>> m…
328 views
okonomiyaki
April 26, 2005
Python #10 - Exceptions
Exceptions in Python are handled using the standard "try/catch" statement, except Python uses "except" instead of "catch". Of course, it conforms to the syntax of Python. You can have several catch clauses with different types of exceptions. Something which I haven't seen before is the ability t…
378 views
okonomiyaki
April 26, 2005
Python #9 - Iterators and Generators
Iterators

"For" statements in Python internally create iterators that are used to step through the provided sequence.

Python exposes this iteration capability with the "iter()" function. You can pass any kind of collection to "iter" and it returns an iterator object, from which you can call "next()"…
331 views
okonomiyaki
April 22, 2005
Python #8 - Classes
And here we finally are. Classes!

Basics
I've read a couple different tutorials about classes in Python, as well as playing around with them myself. I must say, it's quite different than C++.

First, the syntax. It's similar to everything else in python, simply "def className: definitions."

I'm still…
361 views
okonomiyaki
April 21, 2005
Python #7 - Other data structures
I just read about 3 other data structures in Python: Tuples, Sets, and Dictionaries.

Sets and Dictionaries are pretty straightforward- a set is an unordered sequence of unique elements, and a dictionary is a sequence of key-value pairs.

But a tuple? What is the difference of a tuple and a list? The…
335 views
okonomiyaki
April 21, 2005
Python #6 - A functional language?
It's obvious that whoever designed Python liked functional languages.

Well, at least liked some of its features. Functional languages like ML and Lisp are really cool because of what can be done in small lines of code. However, I don't think I could seriously program in a functional language... I …
341 views
okonomiyaki
April 21, 2005
Python #5 - Functions
Functions

General
Functions are defined with the keyword 'def' following the function name and a list of formal parameters. You can also have a string literal as the first line of the function and Python takes it as the function's documentation string (docstring) which is a pretty neat feature.

Param…
531 views
okonomiyaki
April 20, 2005
Python #4 - Various syntax

I'll start posting some more interesting things once I learn all these basics. For now, I'm just posting what I learned when I read through another part of a tutorial. [grin]

I learned ML earlier this semester for the same class. ML has some cool pattern matching techniques. While it's not exactl…
402 views
okonomiyaki
April 20, 2005
Python #3 - Strings and Lists
I've been playing around with the String and List datatypes in python.

Strings

I must say, strings are pretty powerful especially with slicing. I know I've encountered this ability in at least one other language, but I forget which one it was. Anyway, slicing is basically a very elegant way to work…
369 views
okonomiyaki
April 20, 2005
Python #2
First off, for the extra 10 points towards this project, I'm documenting that I read this article: http://www.linuxjournal.com/article/3882.
I can directly identify with this guy because out of all the scripting languages, I probably know Perl the best. And I am well aware of how flexible it is- wa…
401 views
okonomiyaki
April 20, 2005
Python

Programming Languages P-language Assignment
----

I chose Python for my P-language assignment because I would learn the most. I already know Perl a fair bit, and I don't think I would learn a whole lot from PHP. Python seemed the most "different" from what I knew.

With that said, I've been playing ar…
569 views
Advertisement

Popular Blogs

shawnhar
Generalist
101 Entries
9 Followers
15 Entries
10 Followers
johnhattan
Programmer
1,277 Entries
47 Followers
ApochPiQ
Generalist
628 Entries
44 Followers
dgreen02
Generalist
338 Entries
56 Followers
Advertisement