[seqfan] Re: submitting a program, while preserving preformatted text
Alonso Del Arte
alonso.delarte at gmail.com
Sat Sep 4 21:24:39 CEST 2010
The attachment did go through, I'm looking at source code where I can
imagine exactly where the braces would go if this was C.
Does Python have some kind of preprocessor directive mechanism where you
could define an alternative tab character that would be replaced with the
proper indentation before compiling?
In the wiki we'll be able to take care of such details.
On Sat, Sep 4, 2010 at 3:03 PM, Donald Alan Morrison
<donmorrison at gmail.com>wrote:
> Did the attachment go through? One thing I forgot to mention is the
> program doesn't print the n column, only the a(n) column. Changing
> the format operation is easy enough though, as below:
> # python 2.6.X, sage 4.5.2, seq id:A100959
> from os.path import expanduser
> lo = 2
> hi = 14 * 10^3
> nonsemip = 
> for a in xrange(lo,hi+1):
> lst = list(factor(a))
> if len(lst)==1:
> if lst==2:
> elif len(lst)==2:
> if lst==1 and lst==1:
> with open(expanduser("~/B100959.txt"), 'w') as fp:
> for i in xrange(10^4):
> print >> fp, "%d %d" % (i+1, nonsemip[i])
> On Sat, Sep 4, 2010 at 11:52 AM, Donald Alan Morrison
> <donmorrison at gmail.com> wrote:
> > http://www.research.att.com/~njas/sequences/eishelp1.html
> > I submitted a python/sage program, which requires preservation of
> > indentation (because indents are implicit blocks, like curly braces in
> > C).
> > How do I preserve indentation, so it shows up correctly on the page?
> > http://www.research.att.com/~njas/sequences/A100959
> > Attached is a version with correct indentation and a fix to write the
> > file to the current user's home directory, it also only uses 'w' mode.
> > (Assuming the seqfan list lets small attachments through, please see
> > attached.)
> > If you want to try out sage: http://sagemath.org/download.html
> > Cheers,
> > Don
> Seqfan Mailing list - http://list.seqfan.eu/
More information about the SeqFan