Criticism versus Constructive Criticism
Xah Lee, 2003-01
A lot intelligent people are rather confused about criticism,
especially in our “free-speech” free-for-all internet age. When
they say “constructive criticisms are welcome” they mostly mean
“bitching and complaints not welcome”. Rarely do
welcome.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
# -*- coding: utf-8 -*-
# Python
# © 2006-04 by Xah Lee, ∑ http://xahlee.org/, 2006-04
# Given a webite gallery of photos with hundreds of photos, i want to
generate a thumbnail page so that viewers can get a bird's eye's view
images
The Python code is archived at:
http://xahlee.org/perl-python/tn_gen.html
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Xah Lee wrote:
The following is a program to generate thumbnail images for a website.
Useful, if you want to do that.
It is used to generate the thumbnails for my
A Lambda Logo Tour
(and why LISP languages using λ as logo should not be looked upon
kindly)
Xah Lee, 2002-02
Dear lispers,
The lambda character λ, always struck a awe in me, as with other
mathematical symbols. In my mind, i imagine that those obscure math
symbolism are etched in stone by god
Python has a new logo!
See http://python.org/
And it is a fantastic logo.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
is there larger versions of the logo?
and, any usage restrictions?
i also like to find out the the artist name. Any pointer is
appreciated. Thanks.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Felipe Almeida Lessa wrote:
Em Qui, 2006-03-23 às 07:43 -0800, Xah Lee escreveu:
Python has
What is Expressiveness in a Computer Language
Xah Lee, 200502, 200603.
In languages human or computer, there's a notion of expressiveness.
English for example, is very expressive in manifestation, witness all
the poetry and implications and allusions and connotations and
dictions
Xah Lee wrote:
« The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully
Functional Notations
http://xahlee.org/UnixResource_dir/writ/notations.html »
A side note: the terminology “Algebraic” Notation is a misnomer. It
seems to imply that such notations have something to do
The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully
Functional Notations
Xah Lee, 2006-03-15
Let me summarize: The LISP notation, is a functional notation, and is
not a so-called pre-fix notation or algebraic notation.
Algebraic notations have the concept of operators, meaning
I noticed, that in just about all emacs programs on the web (elisp
code), it comes with this template text as its preamble:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software
is there a module that lets me parse validated html files and store it
as a tree?
for example, i want to be able to easily, say, replace the following
hrpReferences/p
pre
• a href=aa.../a
...
/pre
to
hrpReferences/p
ul
lia href=aa.../a/li
...
/ul
Thanks.
Xah
[EMAIL PROTECTED]
∑
here's a site: http://www.longbets.org/bets that takes socially
important predictions. I might have to enter one or two.
i longed for such a accountable predictions for a long time. Usually,
some fucking fart will do predictions, but the problem is that it's not
accountable. So, lots fuckhead
http://en.wikipedia.org/wiki/X11_color_names
excerpt:
«
In computing, on the X Window System, X11 color names are represented
in a simple text file, which maps certain strings to RGB color values.
It is shipped with every X11 installation, hence the name, and is
usually located in
IT Industry Predicament
Xah Lee, 200207
As most of you agree, there are incredible wrongs in software industry.
Programs crash, injurious tools, uninformed programers, and decrepit
education system. Over the years of my computing industry experience
since 1995, i have recently gradually come
The Bug-Reporting Attitude
Xah Lee, 2005-02, 2006-01
People,
There is a common behavior among people in software geek forums, that
whenever a software is crashing or behaving badly, they respond by
“go file a bug report” as if it is the duty of software consumers.
When a software is ostensibly
,
necessary, functional layout feature as multi-columns is not there yet.
This is a indication of the fatuousness of the IT industry's
technologies and its people.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
Xah Lee wrote:
sometimes in the last few months
,
necessary, functional layout feature as multi-columns is not there yet.
This is a indication of the fatuousness of the IT industry's
technologies and its people.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
Xah Lee wrote:
sometimes in the last few months
«use bytes; # Larry can take Unicode and shove it up his ass
sideways.
# Perl 5.8.0 causes us to start getting incomprehensible
# errors about UTF-8 all over the place without this.»
From: the source code of WebCollage (1998)
http://www.jwz.org/webcollage/
by Jamie W.
://xahlee.org/
--
Xah Lee wrote:
sometimes in the last few months, apparently Microsoft made changes to
their JavaScript documentation website:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/scri...
so that, one has to goddamn press the expand
sometimes in the last few months, apparently Microsoft made changes to
their JavaScript documentation website:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/1e9b3876-3d38-4fd8-8596-1bbfe2330aa9.asp
so that, one has to goddamn press the expand button to view the
Responsible Software Licensing Free Software Foundation
Xah Lee, 2005-07
Dear Programers,
I have always respected the Free Software Foundation (FSF) and its
community.
when i wrote the article a couple years ago on Responsible Software
Licensing, i thought it might not be welcomed by the free
Responsible Software Licensing
Xah Lee, 200307
Software is a interesting invention. Software has this interesting
property, that it can be duplicated without cost, as if like copying
money. Never in history are goods duplicable without cost. But with the
invention of computer, the ephemeral non
recently i got a project that involves the use of php. In 2 days, i
read almost the entirety of the php doc. Finding it a breeze because it
is roughly based on Perl, of which i have mastery.
i felt a sensation of neatness, as if php = Perl Improved, for a
dedicated job of server-side scripting.
Post-modernism, Academia, and the Tech Geeking fuckheads
• the Sokal Affair
http://en.wikipedia.org/wiki/Sokal_Affair
• SCIGen and World Multi-Conference on Systemics, Cybernetics and
Informatics
http://pdos.csail.mit.edu/scigen/
• What are OOP's Jargons and Complexities, Xah Lee
http
i had the pleasure to read the PHP's manual today.
http://www.php.net/manual/en/
although Pretty Home Page is another criminal hack of the unix lineage,
but if we are here to judge the quality of its documentation, it is a
impeccability.
it has or possesses properties of:
• To the point and
Recommended:
Sophie's World, by Jostein Gaarder, 1995.
http://en.wikipedia.org/wiki/Sophie%27s_World
http://www.amazon.com/gp/product/0425152251/
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
«I want to read a little bit about sorting in Python (sorted() and
method sort()). But I can't seem to find anything in the documentation
at the homepage?»
if you want some detailed account on the sort method, see:
http://www.xahlee.org/perl-python/sort_list.html
Xah
Newsgroups: comp.lang.perl.misc
From: Veli-Pekka Tätilä
Date: Sat, 5 Nov 2005 17:25:35 +0200
Subject: Re: Python doc problem example: gzip module (reprise)
Xah Lee wrote:
Today i need to use Python to compress/decompress gzip files. snip
However, scanning the doc after 20 seconds there's
Python Doc Problem Example: gzip
Xah Lee, 20050831
Today i need to use Python to compress/decompress gzip files. Since
i've read the official Python tutorial 8 months ago, have spent 30
minutes with Python 3 times a week since, have 14 years of computing
experience, 8 years in mathematical
the Journey of Foreign Characters thru Internet
Xah Lee, 20051101
There's a bunch of confusions about the display of non-ascii characters
such as the bullet •. These confusions are justifiable, because the
underlying stuff is technology, computing technologies, are in a laymen
sense, extremely
well, in the past couple of days i started my own:
http://xahlee.org/emacs/notes.html
but i'm sure something like it exists.
Btw, the elisp intro by
Robert J Chassell. At:
http://www.gnu.org/software/emacs/emacs-lisp-intro/
is extremely well written.
(and so is the elisp reference)
Bravo to GNU
A Haskell A Day: Manifesto
This is my learning notes on Haskell. I call it a-Haskell-a-day. I've
been programing since 1992, and am a top expert at the Mathematica↗
language. I've long wanted to learn Haskell. It is my habit to write
down what i'm learning. I will send out a small tip of what i
in some online documentations, for examples:
http://perldoc.perl.org/perlref.html
http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-17.html
http://www.haskell.org/hawiki/HaskellDemo
the codes are syntax colored.
Is there a tool that produce codes in html with syntax coloring?
Thanks.
One-Liner Loop in Functional Style
Xah Lee, 200510
Today we show a example of a loop done as a one-liner of Functional
Programing style.
Suppose you have a list of file full paths of images:
/Users/t/t4/oh/DSCN2059m-s.jpg
/Users/t/t4/oh/DSCN2062m-s.jpg
/Users/t/t4/oh/DSCN2097m-s.jpg
/Users/t
Thomas Bellman wrote:
try:
os.makedirs(/tmp/trh/spam/norwegian/blue/parrot/cheese)
except os.error, e:
if e.errno != errno.EEXIST:
raise
This is what i want. Thanks.
(the doc needs quite some improvement...)
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
[EMAIL PROTECTED] wrote:
it will be added in 2.5 I beleve. At the moment, you can:
predicate and true expression or false expression
Ah, i see. Here's the full code again:
# -*- coding: utf-8 -*-
# python
import re, os.path
imgPaths=[u'/Users/t/t4/oh/DSCN2059m-s.jpg',
Thanks a lot for various notes. Bonono?
I will have to look at the itertools module. Just went to the doc
http://www.python.org/doc/2.4.1/lib/module-itertools.html
looks interesting.
But I believe Python is designed for easy to code and read and maintain
in mind.
One has to admit that
is there a way to condense the following loop into one line?
# -*- coding: utf-8 -*-
# python
import re, os.path
imgPaths=[u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2059m-s.jpg',
u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2062m-s.jpg',
Xah Lee wrote:
is there a way to condense the following loop into one line?
# -*- coding: utf-8 -*-
# python
import re, os.path
imgPaths=[u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2059m-s.jpg',
u'/Users/t/web/Periodic_dosage_dir/lanci/t4/oh/DSCN2062m-s.jpg',
u'/Users/t/web
Python doc problem:
http://python.org/doc/2.4.2/lib/os-file-dir.html
makedirs( path[, mode])
Recursive directory creation function. Like mkdir(), but makes all
intermediate-level directories needed to contain the leaf directory.
Throws an error exception if the leaf directory already
Peter Hansen wrote:
Xah Lee wrote:
If you think i have a point, ...
You have neither that, nor a clue.
Dear Peter Hansen,
My messages speak themselfs. You and your cohorts's stamping of it does
not change its nature. And if this is done with repetitiousness, it
gives away your nature
Xah Lee, on Aug 22, 2:43 pm wrote:
Unix, RFC, and Line Truncation
http://xahlee.org/UnixResource_dir/writ/truncate_line.html
Steve wrote:
I've seen this argument before. There's at least one VERY good reason
to hard-code linebreaks in text: to preserve a covert channel. It's
really easy
Thanks. Here's how the inner loop should be:
imgPaths2=map(lambda x: (x, re.sub( r^(.+?)-s(\.[^.]+)$,r\1\2, x)),
imgPaths)
though, now i just need something like
map( lambda x: os.path.exists(s)? x[1]:x[0],impPaths2)
but Pyhton doesn't support the
test ? trueResult : falseResult
construct.
Bryan wrote:
mr. xah... would you be willing to give a lecture at pycon 2006? i'm sure you
would draw a huge crowd and a lot of people would like to meet you in
person...
thanks.
I'd be delight to.
My requirements are: 1 cup of fat-free milk, free, and free pizza.
Xah
[EMAIL
Xah Lee wrote:
In Perl, spliting a full path into parts is done like this:
Dr.Ruud wrote:
And then follows Perl-code that only works with an optional .html
extension,
Thanks for the note. I've corrected it here:
http://xahlee.org/perl-python/split_fullpath.html
namely:
Note: the second
suppose i'm going to have a data structure like this:
[
[imgFullPath,(width, height)],
[imgFullPath,(width, height)],
[imgFullPath,(width, height)],
[imgFullPath,(width, height)],
...
]
should i use (width,height) or [width,height]?
what advantage i get to use n-tuple instead of the generic
Split File Fullpath Into Parts
Xah Lee, 20051016
Often, we are given a file fullpath and we need to split it into the
directory name and file name. The file name is often split into a core
part and a extension part. For example:
'/Users/t/web/perl-python/I_Love_You.html'
becomes
'/Users/t/web
Microsoft Hatred, FAQ
Xah Lee, 20020518
Question: U.S. Judges are not morons, and quite a few others are
not morons. They find MS guilty, so it must be true.
Answer: so did the German population thought Jews are morons by
heritage, to the point that Jews should be exterminated from earth
Lasse Vågsæther Karlsen wrote:
Like the sorted function in Python ?
li2 = sorted(li)
you can also specify a key and a cmp function if you need to.
Thanks. I didn't know there's also a sort function in Python (2.4),
besides the method. (i've mentioned your name as acknowledgement at my
Sorting in Perl
In Perl, to sort a list, do like this:
@li=(1,9,2,3);
@li2 = sort {$a = $b} @li;
print join(' ', @li2);
In Perl, sort is a function, not some Object Oriented thing. It returns
the sorted result as another list. This is very simple and nice.
It works like this: sort takes the
Python Doc Problem Example: sort()
Xah Lee, 200503
Exhibit: Incompletion Imprecision
Python doc “3.6.4 Mutable Sequence Types” at
http://python.org/doc/2.4/lib/typesseq-mutable.html
in which contains the documentation of the “sort” method of a list.
Quote:
«
Operation Result Notes
Addendum, 200510
Here's further example of Python's extreme low quality of
documentation. In particular, what follows focuses on the bad writing
skill aspect, and comments on some language design and quality issues
of Python.
From the Official Python documentation of the sort() method, at:
i'm trying to lookup on the detail of language Python's “lambda”
function feature. I've seen it before, but today i need to read about
it again since i'm writing. I quickly went to the index page:
http://python.org/doc/2.4.1/lib/genindex.html
but all i got is a LambdaType.
i'm thinking, maybe
Sort a List
Xah Lee, 200510
In this page, we show how to sort a list in Python Perl and also
discuss some math of sort.
To sort a list in Python, use the “sort” method. For example:
li=[1,9,2,3];
li.sort();
print li;
Note that sort is a method, and the list is changed in place.
Suppose you
there is a MacPerl program posted in 1998 that uses Mac's speech synth
to sing Daisy Bell.
See:
http://bumppo.net/lists/macperl/1998/11/msg00412.html
can anyone modify it so it runs out of the box on today's OS X?
PS i'm posting this also in python and lisp group, i hope it'd be some
general
Dear Michael Goettsche,
why don't you lead the pack to be on-topic for a change, huh?
Xah
Michael Goettsche wrote:
On Saturday 08 October 2005 22:10, Xah Lee wrote:
there is a MacPerl program posted in 1998 that uses Mac's speech synth
to sing Daisy Bell.
See:
http://bumppo.net
Xah Lee wrote: « would anyone like to translate the following perl
script to Python or Scheme (scsh)?»
Here's the Python version.
# -*- coding: utf-8 -*-
# Python
# Wed Oct 5 15:50:31 PDT 2005
# given a dir, report all html file's size. (counting inline images)
# XahLee.org
import re
would anyone like to translate the following perl script to Python or
Scheme (scsh)?
the file takes a inpath, and report all html files in it above certain
size. (counting inline images)
also print a sorted report of html files and their size.
(a copy of the script is here:
the programers in the industry, including bigwigs such as Guido or that
Larry Wall fuckhead, really don't know shit about computer languages.
Sometimes i get pissed by Stephen Wolfram's megalomaniac cries, but in
many ways, i think his statements about the fucking moronicities of the
academicians
A Moronicity of Guido van Rossum
Xah Lee, 200509
On Guido van Rossum's website:
http://www.artima.com/weblogs/viewpost.jsp?thread=98196
dated 20050826, he muses with the idea that he would like to remove
lambda, reduce(), filter() and map() constructs in a future version
Python 3000.
Guido
addendum:
reduce() in fact embodies a form of iteration/recursion on lists, very
suitable in a functional language environment. If Python's lambda and
other functional facilities are more powerful, reduce() would be a good
addition. For instance, in functional programing, it is a paradigm to
nest
Perl's documentation has come of age: http://perldoc.perl.org/
Python morons really need to learn:
• ample example codes.
• example codes are linked to the appropriate doc location for each
code word in the example.
• written in a task-oriented style, or manifest-functionality style.
That is,
is archived at:
http://xahlee.org/perl-python/python_doc_os_path_split.html
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Xah Lee wrote:
Python Doc Problem Example
Quote from:
http://docs.python.org/lib/module-os.path.html
--
split(path)
Split the pathname path into a pair
Python Doc Problem Example
Quote from:
http://docs.python.org/lib/module-os.path.html
--
split( path)
Split the pathname path into a pair, (head, tail) where tail is the
last pathname component and head is everything leading up to that. The
tail part will never contain a
in the regex module re:
Note: Match() is not exactly equivalent to Search() with ^. For
example:
re.search(r'^B', 'A\nB',re.M) # succeeds
re.match(r'B', 'A\nB',re.M) # fails
if without the re.M, would re.search and re.match be equivalent?
i wish to spruce up the rewritten
Martin Franklin wrote:
import gzip
log_file = gzip.open(access_log.4.gz)
last_line = log_file.readlines()[-1]
log_file.close()
does the
log_file.readlines()[-1]
actually read all the lines first?
i switched to system call with tail because originally i was using a
pure Python solution
isn't there a way to implement tail in python with the same class of
performance?
how's tail implemented?
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Fredrik Lundh wrote:
Fredrik Lundh wrote:
zcat|tail is a LOT faster.
and here's the right way to use that:
from subprocess import
Xah Lee wrote:
does anyone know why the folllowing prints to the screen?
# python
import os
os.system(rls)
Steve Holden wrote:
It only prints to the screen when standard output of the invoking
process is the screen. The sub-process forked by os.system inherits
stdin stdout and stderr from
Thanks all.
I found the answer, rather easily.
To make a system call and wait for it, do:
subprocess.Popen([r/sw/bin/gzip,-d,access_log.4.gz]).wait();
--
this post is archived at:
http://xahlee.org/perl-python/system_calls.html
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Xah Lee wrote
Steve Holden wrote:
This is all pretty basic stuff. Perhaps you should stop your verbal
assault on the computer science community and start to learn the
principles of what you are doing.
is this a supressed behavior that a human animal can finally
instinctively and justifiably release at
do you know what the Muses do when a mortal challenged them?
And, please tell me exactly what capacity you hold under the official
Python organization so that i can calculate to what degree i can kiss
your ass or feign mum of your ignorance.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Steve
Python Doc Problem Example: os.system
Xah Lee, 2005-09
today i'm trying to use Python to call shell commands. e.g. in Perl
something like
output=qx(ls)
in Python i quickly located the the function due to its
well-named-ness:
import os
os.system(ls)
however, according to the doc
http
i noticed that Python uses various logos:
http://python.org/pics/pythonHi.gif
http://python.org/pics/PyBanner038.gif
http://python.org/pics/PyBanner037.gif
http://python.org/pics/PythonPoweredSmall.gif
http://wiki.python.org/pics/PyBanner057.gif
is this some decision that python should use
as advertisement.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Steve Holden wrote:
Xah Lee wrote:
i noticed that Python uses various logos:
http://python.org/pics/pythonHi.gif
http://python.org/pics/PyBanner038.gif
http://python.org/pics/PyBanner037.gif
http://python.org/pics
does anyone know why the folllowing prints to the screen?
# python
import os
os.system(rls)
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
By the way, i have sent my criticisms to the proper python doc
maintainer or mailing list several months ago.
-
i'm very sorry to say, that the Python doc is one of the worst possible
in the industry. I'm very sick of Perl and its intentional obfuscation
and juvenile drivel style of
On Python's Documentation
Xah Lee, 20050831
I'm very sorry to say, that the Python doc is one of the worst possible
in the industry. I'm very sick of Perl and its intentional obfuscation
and juvenile drivel style of its docs. I always wanted to learn Python
as a replacement of Perl
nothing personal my friend. But just in case you are interested about
getting it:
the question here is about quality of documentation, not about whether
you got it.
http://xahlee.org/UnixResource_dir/writ/python_doc.html
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Sybren Stuvel wrote:
Xah
today i need to use Python to decompress gzip files.
since i'm familiar with Python doc and have 10 years of computing
experience with 4 years in unix admin and perl, i have quickly located
the official doc:
http://python.org/doc/2.4.1/lib/module-gzip.html
but after a minute of scanning,
Today i need to use Python to compress/decompress gzip files.
I quickly found the official doc:
http://python.org/doc/2.4.1/lib/module-gzip.html
I'd imagine it being a function something like
GzipFile(filePath, comprress/decompress, outputPath)
however, scanning the doc after 20 seconds there's
Apache by default uses the following format for date:
30/Aug/2005
is there a module that turn this directly into mmdd?
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
previously i've made serious criticisms on Python's documentations
problems.
(see http://xahlee.org/perl-python/re-write_notes.html )
I have indicated that a exemplary documentation is Wolfram Research
Incorporated's Mathematica language. (available online at
Unix, RFC, and Line Truncation
[Note: unix tradition requires that a return be inserted at every 70
characters in email messages or so so that each line are less than 80
characters. Unixers made this as a requirement into an RFC document.]
Xah Lee, 20020511
This truncation of lines business
Jargons of Info Tech industry
(A Love of Jargons)
Xah Lee, 2002 Feb
People in the computing field like to spur the use of spurious jargons.
The less educated they are, the more they like extraneous jargons, such
as in the Unix Perl community. Unlike mathematicians, where in
mathematics
by Xah Lee.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
Most participants in the computering industry should benefit in reading
this essay:
George Orwell's “Politics and the English Language”, 1946.
Annotated:
http://xahlee.org/p/george_orwell_english.html
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
--
What is Expresiveness in a Computer Language
20050207, Xah Lee.
In languages human or computer, there's a notion of expressiveness.
English for example, is very expressive in manifestation, witness all
the poetry and implications and allusions and connotations and
dictions. There are a myriad
i have a large number of lines i want to turn into a list.
In perl, i can do
@corenames=qw(
rb_basic_islamic
sq1_pentagonTile
sq_arc501Tile
sq_arc503Tile
);
use Data::Dumper;
print Dumper([EMAIL PROTECTED]);
--
is there some shortcut to turn lines into list in Python?
Xah
[EMAIL
Dear Andrea Griffini,
Thanks for explaning this tricky underneath stuff.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Andrea Griffini wrote:
On Sun, 19 Jun 2005 22:25:13 -0500, Terry Hancock
[EMAIL PROTECTED] wrote:
PS is there any difference between
t=t+[li]
t.append(li)
No, but
here's the Python spec for the Table function:
'''Table(f,[iStart,iEnd,iStep]) returns a list of f applied to the
range range(iStart,iEnd,iStep).
Example: Table(f,[3,10,2]) returns [f(3),f(5),f(7),f(9)]
Table(f,[iStart,iEnd,iStep], [jStart,jEnd,jStep], ...) returns a nested
list of f(i,j,...)
is it possible to eval a string like the following?
m='''
i0=[0,1]
i1=[2,3]
i2=[4,'a']
h0=[]
for j0 in i0:
h1=[]
for j1 in i1:
h2=[]
for j2 in i2:
h2.append(f(j0,j1,j2))
h1.append( h2[:] )
h0.append( h1[:] )
return h0'''
perhaps i'm tired, but why can't i run:
t='m=3'
the example in the spec of previous post is wrong. Here's corrected
version:
here's the Python spec for the Table function:
'''Table(f,[iStart,iEnd,iStep]) returns a list of f applied to the
range range(iStart,iEnd,iStep). Example: Table(f,[3,10,2]) returns
[f(3),f(5),f(7),f(9)]
it in a few days.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
David Van Horn wrote:
Xah Lee wrote:
here's the Python spec for the Table function:
...
References:
• for a context of this message, see: http://xahlee.org/tree/tree.htm
Here is a Scheme implementation of Table. As noted
Dear Chinook Lee,
Thank you very much. That seems a godsend. I'd like to also thank its
author Richard Gruet.
Xah
[EMAIL PROTECTED]
∑ http://xahlee.org/
Chinook wrote:
...
I don't get to the reference docs much. Mostly I use the quick reference
guide and it's noted there in an easy to
oops... it is in the tutorial... sorry.
though, where would one find it in the python reference?
i.e. the function def with variable/default parameters.
This is not a rhetorical question, but where would one start to look
for it in the python ref?
a language is used by programers. Subroutine
in coding Python yesterday, i was quite stung by the fact that lists
appened to another list goes by as some so-called reference. e.g.
t=range(5)
n=range(3)
n[0]='m'
t.append(n)
n[0]='h'
t.append(n)
print t
in the following code, after some 1 hour, finally i found the solution
of h[:]. (and
The Perl version of the Tree function is posted. It's a bit long.
Please see the code here:
http://xahlee.org/tree/Table.html
the choice of having a string as the first argument to Table is a bit
awkward in Perl. Possibly i'll have to rewrite it so that the first
argument is a function instead,
how can i define a function with variable parameters? For example,
f(a) would return [a]
f(a,b) would return [a,b]
f(a,b,...) would return [a,b,...]
One solution is of course to make the argument as a list. i.e.
f([a,b,...])
but are there other solutions?
Xah
[EMAIL PROTECTED]
Python documentation,
http://python.org/doc/2.4.1/lib/typesfunctions.html
-
2.3.10.3 Functions
Function objects are created by function definitions. The only
operation on a function object is to call it: func(argument-list).
There are really two flavors of function objects:
i wanted to find out if Python supports eval. e.g.
somecode='3+4'
print eval(somecode) # prints 7
in the 14 hundred pages of python doc, where am i supposed to find this
info?
Xah
[EMAIL PROTECTED]
http://xahlee.org/
--
http://mail.python.org/mailman/listinfo/python-list
301 - 400 of 510 matches
Mail list logo