Re: learning emacs lisp

2005-10-30 Thread Xah Lee
imer: all mention of real person are opinion only. Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ rgb wrote: > > i'm looking for something example based... for senior professional > > programers who may want to pickup some elisp for practical macro. > > Unfortunately the path

Xah's edu corner: the Journey of Foreign Characters thru Internet

2005-11-01 Thread Xah Lee
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 s

Python doc problem example: gzip module (reprise)

2005-11-05 Thread Xah Lee
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 mathema

Re: Sorting Documentation

2005-11-08 Thread Xah Lee
[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

Re: Python doc problem example: gzip module (reprise)

2005-11-08 Thread Xah Lee
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. > However, scanning the doc after 20 se

Xah's Edu Corner: Sophie's World

2005-11-24 Thread Xah Lee
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

Xah's Edu Corner: Examples of Quality Technical Writing

2005-12-05 Thread Xah Lee
Source Documentation is of Low Quality http://xahlee.org/UnixResource_dir/writ/gubni_papri.html Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Post-modernism, Academia, and the Tech Geeking fuckheads

2005-12-08 Thread Xah Lee
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

PHP = Perl Improved

2005-12-09 Thread Xah Lee
utionary outrageous $free$ lies, why should we fault Pretty Home Page? Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

20050111: list basics

2005-01-11 Thread Xah Lee
d list is', Dumper [EMAIL PROTECTED]; # to extrat element from nested list, $c = $b[2]->[1]; print '$b[2]=>[1] is', $c; # the syntax of nested lists in perl is quite arty, see # perldoc -t perldata Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050112 while statement

2005-01-13 Thread Xah Lee
# here's a while statement in python. a,b = 0,1 while b < 20: print b a,b = b,a+b --- # here's the same code in perl ($a,$b)=(0,1); while ($b<20) { print $b, "\n"; ($a,$b)= ($b, $a+$b); } Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html

how to stop google from messing Python code

2005-01-13 Thread Xah Lee
i'm using groups-beta.google.com to post python code. Is there a way to stop google from messing with my format? it seems to have eaten the spaces in my python code. thanks. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: how to stop google from messing Python code

2005-01-13 Thread Xah Lee
thing that prevents google from reformating the post. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050113 looking up syntax

2005-01-14 Thread Xah Lee
--- Note: this post is from the Perl-Python a-day mailing list at http://groups.yahoo.com/group/perl-python/ to subscribe, send an email to [EMAIL PROTECTED] if you are reading it on a web page, program examples may not run because they've been changed by yahoo.com or google.co

[perl-python] 20050114 if statement

2005-01-14 Thread Xah Lee
ython a-day mailing list at . http://groups.yahoo.com/group/perl-python/ . to subscribe, send an email to [EMAIL PROTECTED] . if you are reading it on a web page, program examples may not run . because html conversion often breaks the code. . . Xah . [EMAIL PROTECTED] . http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050115, for statement

2005-01-15 Thread Xah Lee
examples may not run because © groups.google.com changes the post slightly. © © Xah © [EMAIL PROTECTED] © http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

python mode indentation problem

2005-01-15 Thread Xah Lee
does anyone know why the Python mode in emacs uses spaces for first level indentation but one tab for second level? i'm using emacs 21.3.50.1. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: python mode indentation problem

2005-01-15 Thread Xah Lee
el, 2 tabs. © © who the fuck coded the python mode in emacs? fuckhead please peruse: © http://xahlee.org/UnixResource_dir/writ/responsible_license.html © © PS Thanks for the tip on (setq-default indent-tabs-mode nil). © © Xah © [EMAIL PROTECTED] © http://xahlee.org/PageTwo_dir/mor

[perl-python] 20050116 defining a function

2005-01-16 Thread Xah Lee
s of a copy of © # the list returned by fib(5), so that © # Dumper can print it. © # see Òperldoc -t perldataÓ or perlref © # for unix-styled technicalities. © © Xah © [EMAIL PROTECTED] © http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050117, filter, map

2005-01-16 Thread Xah Lee
ay mailing list at © http://groups.yahoo.com/group/perl-python/ © to subscribe, send an email to © [EMAIL PROTECTED] if © you are reading it on a web page, © program examples may not run because © html conversion often breaks the code. © © Xah © [EMAIL PROTECTED] © http://xahlee.org/PageT

Re: [perl-python] 20050116 defining a function

2005-01-17 Thread Xah Lee
errata: * the variables in the perl section should be declared inside the subroutine. * the @_[0] should've been $_[0] thanks for Dave Cross for pointing them out. * the Mathematica Apply should be Select... Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html --

Re: [perl-python] 20050117, filter, map

2005-01-17 Thread Xah Lee
erratum: the Mathematica Apply should've been Select. ... Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] 20050117, filter, map

2005-01-17 Thread Xah Lee
erratum: the Mathematica Apply should've been Select. ... Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050118 keyed list

2005-01-17 Thread Xah Lee
© use Data::Dumper qw(Dumper); © print Dumper \%a; © © # the syntax of keyed list in Perl is too complex © # to be covered in a short message. © # see "perldoc perldata" for an unix-styled course. © © Xah © [EMAIL PROTECTED] © http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050119 writing modules

2005-01-18 Thread Xah Lee
print Dumper [&mymodule::f1(7)]; © © # this is about the simplest way © # to write a modlue in perl and © # calling its function. © # for an inscrutable treatment, © # see "perldoc perlmod" © © Xah © [EMAIL PROTECTED] © http://xahlee.org/PageTwo_dir/more.html -- http://mail

iteritems() and enumerate()

2005-01-19 Thread Xah Lee
Python has iteritems() and enumerate() to be used in for loops. can anyone tell me what these are by themselves, if anything? are they just for idiom? thanks. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050120 find functions in modules

2005-01-19 Thread Xah Lee
erl-python-subscribe @ yahoogroups.com if © you are reading it on a web page, © program examples may not run because © html conversion often breaks the code. © © Xah © [EMAIL PROTECTED] © http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

how to write a tutorial

2005-01-21 Thread Xah Lee
its morons.) All it take is some simple principles outlined above. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050121 file reading & writing

2005-01-22 Thread Xah Lee
nically # depending on some predefined # variables...) The f they call "file handle". # ... see # perldoc -tf open # to begin understanding. Note: this post is from the Perl-Python a-day mailing list at http://groups.yahoo.com/group/perl-python/ to subscribe, send an ema

Re: how to write a tutorial

2005-01-23 Thread Xah Lee
my books are moronic because they assumed the general readers are morons. PS Another illustrative case is the official Java Tutorial. Python tutorial is to the point on the whole. The Java Tutorial is completely asinine. Chalking up to rocket sciences every chance with unhelpful and misleading driv

[perl-python] 20050124 classes & objects

2005-01-24 Thread Xah Lee
reference (or a package name, for class methods) as the first argument. Good luck. Note: this post is from the Perl-Python a-day mailing list at http://groups.yahoo.com/group/perl-python/ to subscribe, send an email to perl-python-subscribe @ yahoogroups.com if you are reading it on a web

[perl-python] 20050125 standard modules

2005-01-25 Thread Xah Lee
ml conversion often breaks the code. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: how to write a tutorial

2005-01-25 Thread Xah Lee
doc/2.3.4/tut/node11.html # in Python terminal, type help() then # topic CLASSES to read about existing # datatypes as classes, and classes in # Python # try to write a class with one data of # integer and two functions, one # increases it by 1, one decreases it by # 1. note: inside a class definiti

[perl-python] 20050126 find replace strings in file

2005-01-26 Thread Xah Lee
ext=$ARGV[0]; $rtext=$ARGV[1]; $infile = $ARGV[2]; $outfile = $ARGV[3]; open(F1, "<$infile") or die "Perl fucked up. Reason: $!"; open(F2, ">$outfile") or die "Perl fucked up. Reason: $!"; while ($line = ) { chomp($line); $line =~ s/$stext/$rtext/g; prin

how to comment out a block of code

2005-01-26 Thread Xah Lee
is there a syntax to comment out a block of code? i.e. like html's or perhaps put a marker so that all lines from there on are ignored? thanks. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050127 traverse a dir

2005-01-27 Thread Xah Lee
ter # function purely functional. (it relies # on the $_) And the filter function # must come in certain order. (for # example, the above program won't work # if g is moved to the bottom.) ... # the quality of modules in Perl are # all like that. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] daily tip website

2005-01-28 Thread Xah Lee
for those interested, i've created a webpage for these perl-python daily tips. The url is: http://xahlee.org/perl-python/python.html Thanks to those who have made useful comments. They will be assimilated. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html > Hey all, I have

what's OOP's jargons and complexities?

2005-01-28 Thread Xah Lee
ethods and other things. http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html Tomorrow i shall cover more manmade jargons and complexities arising out of the OOP hype, in particular Java. instantiation initializer, constructor, assessor access level specifier abstract class and abstract methods instance methods and class methods interface, inheritance, polymorphism. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] sending email

2005-01-29 Thread Xah Lee
me discussion of the plethora of Perl mail modules and their short-cummings, see http://alma.ch/perl/mail.htm Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Q: quoting string without escapes

2005-01-31 Thread Xah Lee
in Python, is there a way to quote a string as to avoid escaping ' or " inside the string? i.e. like Perl's q or qq. thanks. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] find & replace strings for all files in a dir

2005-01-31 Thread Xah Lee
ne fileFilterQ to set which file will be checked or skipped. to do: * in the report, print the strings that are changed, possibly with surrounding lines. * allow just find without replace. * add the GNU syntax for unix command prompt. * Report if backup directory exists already, or provide togg

[perl-python] string pattern matching

2005-02-01 Thread Xah Lee
no"} if ( $text =~ [EMAIL PROTECTED]@) { print 'yes'} else {print "no"} # for detail of its much ado about nothing nature, # see perldoc perlre this is perl-python a-day mailing list. To subscribe, see http://xahlee.org/perl-python/python.html Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: how to write a tutorial

2005-02-02 Thread Xah Lee
; server = smtplib.SMTP(smtpServer) server.set_debuglevel(1) server.sendmail(fromAddr, toAddr, text) server.quit() Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: how to write a tutorial

2005-02-02 Thread Xah Lee
st uses. Spending time to read this book of specialization, from economy perspective, is a waste of time. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] get web page programatically

2005-02-04 Thread Xah Lee
ve perl code. In many perl codes, they sport the Object Oriented syntax, often concomitantly with a normal syntax version as well. this post is from the perl-python a-day mailing list. Please see http://xahlee.org/perl-python/python.html Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: functions with unlimeted variable arguments...

2005-06-19 Thread Xah Lee
definition with variable/default parameters is a basic issue a programer wants to know, and different languages differs very much in how they handle this. This is what i mean that the language doc should be programing oriented, as opposed to computer-sciency or implementation oriented... Xah [EMAIL

references/addrresses in imperative languages

2005-06-19 Thread Xah Lee
) - References: for a analysis of the same situation in Java, see http://xahlee.org/java-a-day/assign_array_to_list.html How to write a tutorial http://xahlee.org/Periodic_dosage_dir/t2/xlali_skami_cukta.html Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: functions with unlimited variable arguments...

2005-06-20 Thread Xah Lee
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 n

Re: references/addrresses in imperative languages

2005-06-20 Thread Xah Lee
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 > &

Re: tree functions daily exercise: Table

2005-06-21 Thread Xah Lee
ces: • for a context of this message, see: http://xahlee.org/tree/tree.htm • for a exposition of syntax aspects of irregularity of Python's “list-comprehension”, see http://xahlee.org/perl-python/list_comprehension.html Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

eval() in python

2005-06-21 Thread Xah Lee
i'm tired, but why can't i run: t='m=3' print eval(t) the doc seems to suggest that eval is only for expressions... it says uses exec for statements, but i don't seem to see a exec function? Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: tree functions daily exercise: Table

2005-06-21 Thread Xah Lee
ction is more appropriate. anyhow, for simplicity, let's start with this simpler spec... Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: tree functions daily exercise: Table

2005-06-21 Thread Xah Lee
ge, so they share syntax form. Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ Duncan Booth wrote: > Xah Lee wrote: > > > '''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 &g

Re: tree functions daily exercise: Table

2005-06-21 Thread Xah Lee
der if i can even do 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/tre

turn text lines into a list

2005-06-27 Thread Xah Lee
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

What is Expresiveness in a Computer Language?

2005-07-10 Thread Xah Lee
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 m

Re: What is Expresiveness in a Computer Language?

2005-07-12 Thread Xah Lee
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/ -- http://mail.python.org/mailman/lis

Xah's edu corner: on Microsoft hatred

2005-07-18 Thread Xah Lee
oriented communist/socialist nations or sovereignly ruled kingdoms & queendoms. this post is archived at: http://xahlee.org/UnixResource_dir/writ/mshatred155.html © copyright 2003 by Xah Lee. Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Jargons of Info Tech industry

2005-08-11 Thread Xah Lee
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 t

Re: Jargons of Info Tech industry

2005-08-22 Thread Xah Lee
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 is

OpenSource documentation problems

2005-08-27 Thread Xah Lee
's docs, but do not exhibit jargon abuse, rambling, author masturbation, or hodgepodge as do the OpenSource ones mentioned above. Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Python doc problems example: gzip module

2005-08-31 Thread Xah Lee
nning, please someone tell me what the fuck is it talking about? Fuck the Python programing morons. Thanks. I just need to decompress files. Is it: import gzip; gzip.GzipFile("/Users/xah/access_log.1.gz"); can someone put a example into that fucking doc so that people don't have to wad

Re: Python doc problems example: gzip module

2005-08-31 Thread Xah Lee
dule really just want to compress or decompress a file. Fuck unix advocates and fuck Perlers and fuck Python morons. PS For more about Python doc, please see: http://xahlee.org/perl-python/re-write_notes.html Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

change date format

2005-08-31 Thread Xah Lee
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

Re: OpenSource documentation problems

2005-09-01 Thread Xah Lee
reduced to the general public.) this post is archived at http://xahlee.org/UnixResource_dir/writ/python_doc.html Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: OpenSource documentation problems

2005-09-01 Thread Xah Lee
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

Re: Python doc problems example: gzip module

2005-09-01 Thread Xah Lee
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: >

python logo

2005-09-02 Thread Xah Lee
various different logos? Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: python logo

2005-09-03 Thread Xah Lee
identity and as well 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://

os.system(r"ls") prints to screen??

2005-09-03 Thread Xah Lee
does anyone know why the folllowing prints to the screen? # python import os os.system(r"ls") Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system(r"ls") prints to screen??

2005-09-04 Thread Xah Lee
elease at another in a group frenzy? Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system(r"ls") prints to screen??

2005-09-04 Thread Xah Lee
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

2005-09-04 Thread Xah Lee
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

Re: os.system(r"ls") prints to screen??

2005-09-06 Thread Xah Lee
Xah Lee wrote: > does anyone know why the folllowing prints to the screen? > # python > import os > os.system(r"ls") 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

determine if os.system() is done

2005-09-07 Thread Xah Lee
bin/tail","-n 1","access_log.4"], stdout=subprocess.PIPE).communicate()[0] of course, i can try workarounds something like os.system("gzip -d thiss.gz && tail thiss"), but i wish to know if there's non-hack way to determine when a system process is

Re: determine if os.system() is done

2005-09-07 Thread Xah Lee
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]

reading the last line of a file

2005-09-08 Thread Xah Lee
a pure Python solution inF = gzip.GzipFile(ff, 'rb'); s=inF.readlines() inF.close() last_line=s[-1] and since the log file is 100 megabytes it takes a long time and hogs massive memory. Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.py

Re: reading the last line of a file

2005-09-08 Thread Xah Lee
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

regex re.search and re.match

2005-09-11 Thread Xah Lee
? i wish to spruce up the rewritten re-module doc http://xahlee.org/perl-python/python_re-write/lib/module-re.html with people's help. if at the end it is good, i hope it can find its way into the official doc. Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Python Doc Problem Example: os.path.split

2005-09-18 Thread Xah Lee
e: my use of OpenSource here does not include people of GNU community.) For more about Python Doc problems, see http://xahlee.org/Periodic_dosage_dir/t2/xlali_skami_cukta.html Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Doc Problem Example: os.path.split

2005-09-19 Thread Xah Lee
left out. --- This post 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 > -- > s

Perl's documentation come of age

2005-09-21 Thread Xah Lee
history, social sciences, and mathematics. Also, study functional programing or hang out in functional programing communities or hardcore GNU community many also improve vastly your critical thinking and doc writing abilities. More about documentation can be found here: http://www.xahlee.or

[perl-python] text pattern matching, and expressiveness

2005-02-07 Thread Xah Lee
ctical variation. These two contrasting ideas can be easily seen thru Perl vs Python languages, and as one specific example of their text pattern matching abilities. Perl is a language of syntactical variegations. Python on the other hand, does not even allow changes in code's indentation, bu

python code with indention

2005-02-07 Thread Xah Lee
is it possible to write python code without any indentation? Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: python code with indention

2005-02-09 Thread Xah Lee
i thought it is trivial for the Python parser to spit out a version with matching brackets. Similarly, perhaps some opensourcing student has modified a parser to read in a matching brackets delimited version of Python. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http

[perl-python] combinatorics fun

2005-02-10 Thread Xah Lee
bo ($) { my $max=$_[0]; my %hh=(); for (my $j=1; $j < $max; ++$j) { for (my $i=1; $i <= $max; ++$i) { my $m = (($i+$j)-1)%$max+1; if ($i < $m){ $hh{"$i,$m"}=[$i,$m];} } } return \%hh; } use Data::Dumper; $Data::Dumper::Indent=0; pr

Re: [perl-python] combinatorics fun

2005-02-10 Thread Xah Lee
range(1,n+1): ©m = ((i+j)-1) % n + 1 © if (i < m): ©result["%d,%d"%(i,m)]=(i,m) ©return result © ©print combo(4) So sweet. Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] 20050211 generating expression by nested loops

2005-02-12 Thread Xah Lee
athematica.html # look for the function named Table. his is Perl-Python a-day. To subscribe, see http://xahlee.org/perl-python/python.html Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] problem: reducing comparison

2005-02-14 Thread Xah Lee
should be. I'll post Perl and Python codes tomorrow for those interested. If you are a perl programer, try to code it in Python. (it's easy.) This is brought to you by the Perl-Python a-day community. To subscribe, see http://xahlee.org/perl-python/python.html Xah [EMAIL PROTECTED] http

Re: [perl-python] problem: reducing comparison

2005-02-15 Thread Xah Lee
on) One must make a copy first, and work with the copy. Note also that in Python there's already a function called reduce. (it is equivalent to Mathematica's Fold.) In Python, looks like user can over-ride default functions. This post is archived at http://xahlee.org/perl-python/pairing_redu

Re: problem: reducing comparison

2005-02-15 Thread Xah Lee
my Python coding is not experienced. In this case, is ps.pop("%d,%d"%(j[1],k[1]),0) out of ordinary? if i have long paragraphs of documentation for a function, do i still just attach it below the fun def? Xah Xah Lee wrote: > here are the answers: > > ©Python code. > ©

Re: problem: reducing comparison

2005-02-16 Thread Xah Lee
ps.pop("%d,%d"%(j[1],k[0]),0) ©return ps © ©is reduce2 more efficient? It works entirely differently. I'll have to think about it... besides algorithmic... onto the minute academic diddling, i wonder if it is faster to delete entries in dict or add entries... Xah [EMAIL

Re: [perl-python] problem: reducing comparison (correction)

2005-02-16 Thread Xah Lee
Xah Lee wrote: > In imperative languages such as Perl and Python and Java, in general it > is not safe to delete elements when looping thru a list-like entity. > (it screws up the iteration) One must make a copy first, and work with > the copy. Correction: When looping thru a list

Re: [perl-python] problem: reducing comparison (erratum)

2005-02-16 Thread Xah Lee
Xah Lee wrote: > In imperative languages such as Perl and Python > and Java, in general it is not safe to delete > elements when looping thru a list-like entity. > (it screws up the iteration) One must make a > copy first, and work with the copy. Correction: When looping thru a l

Re: [perl-python] problem: reducing comparison (erratum)

2005-02-16 Thread Xah Lee
Xah Lee wrote: > In imperative languages such as Perl and Python > and Java, in general it is not safe to delete > elements when looping thru a list-like entity. > (it screws up the iteration) One must make a > copy first, and work with the copy. Correction: When looping thru a l

[perl-python] exercise: partition a list by equivalence

2005-02-17 Thread Xah Lee
-python/python.html == Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

[perl-python] exercise: partition a list by equivalence

2005-02-19 Thread Xah Lee
version can also use some clean up, or even rewrite as a program in the Python language proper. Addenda or Errata will be added on this page. PS all together there are some 3 or so solutions posted on the newsgroups. (one by private email) I will have to filter them out and study them. Any interesting or important Addenda or Errata will be emailed out later. In addition to being archived here: http://xahlee.org/perl-python/partition_by_equiv.html Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailman/listinfo/python-list

Re: exercise: partition a list by equivalence

2005-02-19 Thread Xah Lee
break ©if (goto): ©goto=False ©break ©else: ©fin.append(group) comlete code is at: http://xahlee.org/perl-python/partition_by_equiv.html Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html -- http://mail.python.org/mailma

Re: exercise: partition a list by equivalence

2005-02-19 Thread Xah Lee
on, each number represent a computer file, there are up to tens of thousands of files, and much less than 0.1% is same as another, and for files that are same, each equivalent group number no more than 10 or so.) Xah [EMAIL PROTECTED] http://xahlee.org/PageTwo_dir/more.html John Machin wrote: &

[perl-python] exercise: partition a list by equivalence

2005-02-20 Thread Xah Lee
| sets.get(x2, frozenset([x2]))) ©for i in newset: ©sets[i] = newset © ©return [list(aset) for aset in set(sets.itervalues())] it would be nice if the two working programs do not use some package. This problem shouldn't need to. Xah [EMAIL PROTECTED]

<    1   2   3   4   5   6   >