Re: plain text parsing to html (newbie problem)

2009-12-09 Thread akean
On Dec 10, 3:59 am, João  wrote:
> I apologize for my newbiness but I'm banging my head making this work :
> (
...
> How can I see the output run in debug mode like in perl?
>


One method:  install ipython (another python shell, but with some
useful extra features)
and then run the program inside ipython in debug mode:
-
$ ipython


In [1]: run -d filename.py


Breakpoint 1 at /path/to/filename.py:3
NOTE: Enter 'c' at the ipdb>  prompt to start your script.
> (1)()

ipdb>

(You type c to continue)

ipdb> c
> /path/to/filename.py(3)()
  2
1---> 3 import sys, os
  4 import subprocess


and you can see you're now on line 3.
Press h for help to see what commands you can type.
Press n for next line if you want to step.
Press s to step into a function when it's being called.  Etc.

--
Anita
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: please help shrink this each_with_index() implementation

2010-01-05 Thread akean
On Jan 6, 8:58 am, Phlip  wrote:
> Hypo Nt:
>
> def each_with_index(seq):
>     index = 0
>     result = []
>
>     for item in seq:
>       result.append([item, index])
>       index += 1
>
>     return result
>
> My Pythonic sequencing skills are obviously feeble. Can anything think
> of a way to write that in fewer lines?
>
> --
>   Phlip
>  http://c2.com/cgi/wiki?MoreliaViridis

 y = [[seq[i],i] for i in range(len(seq))]  gives the same result.
The index is accessible without assigning it to another variable.
--
Anita
-- 
http://mail.python.org/mailman/listinfo/python-list