login
Holden Web
What you'll need to know tomorrow

Comments on What Matters About Python?, page 1 of 2

Re: What Matters About Python?

James Watson · 2007-08-07T07:09:00

> Is there enough documentation?

I find it hard to get at what I am looking for. For example, trying to find out what all the expected methods for emulating a list took a while. It seems like there should be a central location for this kind of thing given that duck-typing is such a big deal in Python. Maybe there is and I just don't know where.

> What are the warts,

self.Well, self.I self.can't self.think self.of self.any self.at self.the self.moment.

> and what
> have you found Python to be especially good or bad
> for?

I really like it for code generation. Yield and literal strings simplify things greatly.

Re: What Matters About Python?

Daniel Jimenez · 2007-08-07T07:29:00

Python's "executable pseudocode" is beautiful. After years of reading (and writing :( ) curly braces and long strings of modifiers it's a pleasure to read and write code that doesn't make you go far around everything you're trying to say.

Please, include plenty of code examples.

Re: What Matters About Python?

Larry Bugbee · 2007-08-07T11:37:00

I like several things...
- economy of expression without being terse (just right)
- the natural blending of procedural and object code
- a really friendly community

Warts?
- lack of optional typing
- interpreter not natively installed on ALL platforms making program distribution problematic
- really easy-to-use GUI tools (yeah, true of most/all languages)

Re: What Matters About Python?

Keith Ray · 2007-08-09T06:20:00

There is no "average" user. We are all individuals. (Repeat after me: "we are all individuals").

I would be interested in learning how to use Python to parse and process a complex languages like C++ or Objective-C for (1) gathering metrics, (2) implementing pre-parsers [turning a few "new" keywords into several lines of output code, in context], or (3) implementing editor-independent editing and refactoring tools.

Re: What Matters About Python?

Eli Courtwright · 2007-08-10T06:14:00

Whatever you do, make sure to provide code examples. What got me hooked on Python was being able to read small code snippets and see how much more expressive it was than most other languages.

When evaluating a new Python module/framework/etc I always look for small code snippets that demonstrate how it's used. I love websites like CherryPy.org which put a code snippet front and center on the home page to show what your programs will look like.

So whatever topics you cover, make sure to show some code.

Re: What Matters About Python?

Merriodoc Brandybuck · 2007-08-13T14:21:00

> <p>I return to this forum after a lengthy absence because
> it offers access to a community of well-informed, not to
> say opinionated, software technologists. I have just
> accepted an invitation to write a monthly column for the
> forthcoming <em>Python Magazine</em>, and I don't want to
> write only for existing Python users.</p>
> <p>Other writers will doubtless handle the technical side
> of the language, though I expect I will have a hand in
> that area as well. But I am interested in providing a
> rounded source of information to a broad readership, and
> would like to address philosophical and social as well as
> technical issues.</p>
> <p>So, what information about Python is the average reader
> looking for? Are Python users smug or self-effacing? Is
> there enough documentation? What are the warts, and what
> have you found Python to be especially good or bad
> for?</p>

I think if you are going to be talking about things other than the technical side, a big thing to think about is "why do I like this language?" or "why would somebody want to pick up yet another language and if they do, why python?"

Personally, I have several comments or observations with no particular theme. I do like the language and it is the one I hack in at home most of the time.

1. I really, really like the array slicing and list comprehensions. I miss them in other languages. These two things make working with collections of data pretty simple. One I threw together the other day for comparing files in two directories was the following. Assume the file names are loaded in two arrays and that the path names have been lopped off


import string

[x.lower() for x in linesSource if x.lower() not in map(string.lower, linesTarget)]


2. self has already been pointed out. I see the reason for it, it makes things painfully obvious, but it is, at times, ugly and having to spend plenty of time in C++, C#, VB(pick a flavor) and a couple other languages, I, along with others, sometimes for get to type self since just about every other language does not require self's equivalent.

3. I have found the community generally helpful. Lots of smart people and many of them are willing to answer questions and not sound too much like pedantic windbags.

4. Lots of libraries and interfaces into almost everything. If you have something to write, there is probably a python interface available for it at this point.

5. I think the whinging about the GIL is overdone. Yes it is a problem in some instances. There are also many solutions to the problem. And if massive performance and parallelism on a single processor is your goal, python probably isn't what you are writing in anyway. http://www.parallelpython.com/ is one such solution that offers an erlang like method of handling the problem.

6. Variable scoping and the 'global' keyword have caused me some annoyances in the past. In general practice it doesn't seem to be a problem, but when it bites you, it really bites you.

7. Array slicing and python's list based approach to strings makes it real handy for crunching strings. It may not be perl-powerful because regex is not built into the language, but I find it very handy for a multitude of file handling problems with logs, source code, etc.

8. cross platform support is good and I think, generally speaking, python users are, as a group, the most platform agnostic bunch. As a group I see much less of the windows vs. linux vs. OSX idiocy that seems to be more pervasive in other language communities. As a group I think pythonistas are a rather pragmatic bunch.

9. It would be nice to hear more about some commercial successes of python. python.org has the success page and bittorrent gets a bit of press, but I would imagine there are other instances where the language is used that would make people go 'wow' that we just don't know about.

Re: What Matters About Python?

John M Camara · 2007-08-14T11:28:00

Keith - Take a look at the ply module http://www.dabeaz.com/ply/. It's an implementation of Lex and Yacc in Python.

Re: What Matters About Python?

Joe Cheng · 2007-08-15T15:11:00

Merriodoc, sorry to be a code pedant, but...

[x.lower() for x in linesSource if x.lower() not in map(string.lower, linesTarget)]

Will that execute map(string.lower, linesTarget) once per line in linesSource? If so... yuck!

Here's what I would do in Ruby (I can't find the Python function for list subtraction, and the - operator doesn't seem to work):

linesSource.map{|x|x.downcase} - linesTarget.map{|x|x.downcase}

Re: What Matters About Python?

Merriodoc Brandybuck · 2007-08-16T07:04:00

> Merriodoc, sorry to be a code pedant, but...
>
> [x.lower() for x in linesSource if x.lower() not in
> map(string.lower, linesTarget)]

>
> Will that execute map(string.lower, linesTarget) once per
> line in linesSource? If so... yuck!
>

I hope not. Hadn't even thought of that. That would be, well, not good.


> Here's what I would do in Ruby (I can't find the Python
> function for list subtraction, and the - operator doesn't
> seem to work):
>
> linesSource.map{|x|x.downcase} -
> linesTarget.map{|x|x.downcase}


There isn't a list subtraction function or operator I'm aware of. Mathematically speaking, that is treating an array like a set (with the exception that duplicates are allowed) and if you want to do something like that, you can use the set data type in python


>>> a = set(['a','b','c'])
>>> b = set(['a','f','x'])
>>> a - b
set(['c', 'b'])
>>>

Re: What Matters About Python?

James Watson · 2007-08-16T07:15:00

> > Merriodoc, sorry to be a code pedant, but...
> >
> > [x.lower() for x in linesSource if x.lower() not
> in
> > map(string.lower, linesTarget)]

> >
> > Will that execute map(string.lower, linesTarget) once
> per
> > line in linesSource? If so... yuck!
> >
>
> I hope not. Hadn't even thought of that. That would be,
> well, not good.

It does not:

>>> def list():
... print "in list"
... return [1,2,3]
...
>>> for i in [x for x in list()]:
... print i
...
in list
1
2
3
>>>

Page 1 of 2 · Newer comments

Back to post