Re: What is Expressiveness in a Computer Language

2006-06-16 Thread Sacha

"Joachim Durchholz" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Raffael Cavallaro schrieb:
>> On 2006-06-14 15:04:34 -0400, Joachim Durchholz <[EMAIL PROTECTED]> said:
>>
>>> Um... heterogenous lists are not necessarily a sign of expressiveness. 
>>> The vast majority of cases can be transformed to homogenous lists 
>>> (though these might then contain closures or OO objects).
>>>
>>> As to references to nonexistent functions - heck, I never missed these, 
>>> not even in languages without type inference :-)
>>>
>>> [[snipped - doesn't seem to relate to your answer]]
>>
> Give a heterogenous list that would to too awkward to live in a 
> statically-typed language.

Many lists are heterogenous, even in statically typed languages.
For instance lisp code are lists, with several kinds of atoms and 
sub-lists..
A car dealer will sell cars, trucks and equipment..
In a statically typed language you would need to type the list on a common 
ancestor...
What would then be the point of statical typing , as you stilll need to type 
check
each element in order to process that list ? Sure you can do this in a 
statically-typed
language, you just need to make sure some relevant ancestor exists. In my 
experience
you'll end up with the base object-class more often than not, and that's 
what i call
dynamic typing.

> Give a case of calling nonexistent functions that's useful.

I might want to test some other parts of my program before writing this 
function.
Or maybe will my program compile that function depending on user input.
As long as i get a warning for calling a non-existing function, everything 
is fine.

Sacha 


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


python-forum

2012-11-02 Thread Sacha Rook
Hi does anyone know where the python-form.org site has gone?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python-forum

2012-11-02 Thread Sacha Rook
Thanks for the update and the invite don't mind if I do.

cheers

sachlar



On 2 November 2012 08:26, Chris Rebert  wrote:

> On Fri, Nov 2, 2012 at 1:19 AM, Sacha Rook  wrote:
> > Hi does anyone know where the python-form.org site has gone?
>
> Some googling suggests that it's under new management:
> http://mcompute.co.uk/showthread.php?tid=2161
>
> But comp.lang.python/python-list is better anyway [ ;-) ], and you're
> already here, so why not stay a while?
>
> Cheers,
> Chris
>
-- 
http://mail.python.org/mailman/listinfo/python-list


csv read clean up and write out to csv

2012-11-02 Thread Sacha Rook
Hi

I have a problem with a csv file from a supplier, so they export data to csv 
however the last column in the record is a description which is marked up with 
html.

trying to automate the processing of this csv to upload elsewhere in a useable 
format. If i open the csv with csved it looks like all the records aren't 
escaped correctly as after a while i find html tags and text on the next 
line/record.

If I 'openwith' excel the description stays on the correct line/record?

I want to use python to read these records in and output a valid csv with the 
descriptions intact preferably without the html tags so a string of text 
formatted with newline/CR where appropriate.

So far I have this but don't know where to go from here can someone help me?

import csv

infile = open('c:\data\input.csv', 'rb')
outfile = open('c:\data\output.csv', 'wb')

reader = csv.reader(infile)
writer = csv.writer(outfile)


for line in reader:
print line
writer.writerow(line)


The input.csv is set out as follows;
HEADER ROW 1st
"FileDate","ProductID","Name","StandardPrice","DropshipPrice","SRP","Brand","Xline","InStock","Stock","Barcode","Weight","CategoryID","Category","SmallImage","LargeImage","Description"

A COMPLETE RECORD LOOKS LIKE THIS WITH THE DESCRIPTION FIELD POPULATED SOME 
RECORDS DON'T HAVE THE DESCRIPTION FIELD POPULATED

"2012-11-01T18:28:45.25+00:00","10198","(Venom) PS2 DVD Remote Control 
(Black)","3.7800","4.3500","12.9800","Venom","true","In 
Stock","1","5031300025009","200","1339","PC/Games_Console / Playstation / PS2 / 
Remote 
Controls","http://www.atssitecentre.co.uk/images/products/1/10198.gif","http://www.atssitecentre.co.uk/images/products/1/10198f.jpg","Never
 have to unplug your joypad / DVD user friendly / Works up to 30 feet from PS/2 
/ IR wireless technology."

THIS IS AN EXAMPLE OF THE BAD RECORD CAUSING PROBLEMS, THE DESCRIPTION FIELD 
STARTS ""features:
AS YOU CAN SEE CONTAINS HTML BUT BECAUSE OF THIS FORMAT SUBSEQUENT HTML TAGS ARE
ADDED AS NEW RECORDS ON SUBSEQUENT LINES. 

"2012-11-01T18:28:45.25+00:00","6","3.5 inch Disk Drive 
Lock","2.9500","2.9500","9.9500","None","true","In 
Stock","3","077511994166","131","1332","PC/Games_Console / PC Security / 
General","http://www.atssitecentre.co.uk/images/products/11000/6.gif","http://www.atssitecentre.co.uk/images/products/11000/6f.jpg","features:

3 1/2" FDD Lock.
Die casting housing and cylinder chrome plated.
Lock Cover : PBT + GF 15%. (PLASTIC)
2 Keys supplied per lock. 
"

I know I am far from complete but don't know how to proceed :-)
As I said I want to reconstruct a clean record either strip out the html tags 
or 
at least escape the records appropriately..

Thanks all
-- 
http://mail.python.org/mailman/listinfo/python-list