Re: "Strong typing vs. strong testing"

2010-09-28 Thread rustom
On Sep 29, 5:32 am, Chris Rebert wrote: > On Tue, Sep 28, 2010 at 2:55 AM, Malcolm McLean > > > > wrote: > > On Sep 27, 9:29 pm, p...@informatimago.com (Pascal J. Bourguignon) > > wrote: > >> On the other hand, with the dynamic typing mindset, you might even wrap > >> your values (of whatever num

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Erik Max Francis
Keith Thompson wrote: Erik Max Francis writes: [...] >>> print c # floating point accuracy aside 299792458.0 m/s Actually, the speed of light is exactly 299792458.0 m/s by definition. (The meter and the second are defined in terms of the same wavelength of light; this was changed relatively

Re: Example or recomendation of a webserver

2010-09-28 Thread Seebs
On 2010-09-29, Hidura wrote: > I am working on a web project written on Py3k and using mod_wsgi on > the Apache that have to recibes the request client via a xml structure > and i am facing a lot of troubles with the upload files mainly because > i can' t see where they are, so i' ve decide to wri

Example or recomendation of a webserver

2010-09-28 Thread Hidura
I am working on a web project written on Py3k and using mod_wsgi on the Apache that have to recibes the request client via a xml structure and i am facing a lot of troubles with the upload files mainly because i can' t see where they are, so i' ve decide to write my own web server-django and the ot

Re: "Strong typing vs. strong testing"

2010-09-28 Thread George Neuner
On Tue, 28 Sep 2010 12:15:07 -0700, Keith Thompson wrote: >George Neuner writes: >> On 28 Sep 2010 12:42:40 GMT, Albert van der Horst >> wrote: >>>I would say the dimensional checking is underrated. It must be >>>complemented with a hard and fast rule about only using standard >>>(SI) units int

Re: Request For Comments: Learn Python The Hard Way

2010-09-28 Thread Matty Sarro
Cool idea! I'll gladly take a look and get back to you. -Matthew On Tue, Sep 28, 2010 at 9:18 PM, Zed Shaw wrote: > Hi Everyone, > > I rarely post to the list, but I'm getting near the end of the book I > wrote to help people learn Python and I would like some feedback on it > if you please: > >

Re: About __class__ of an int literal

2010-09-28 Thread MRAB
On 29/09/2010 01:19, Terry Reedy wrote: On 9/28/2010 5:27 AM, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok.

Request For Comments: Learn Python The Hard Way

2010-09-28 Thread Zed Shaw
Hi Everyone, I rarely post to the list, but I'm getting near the end of the book I wrote to help people learn Python and I would like some feedback on it if you please: * Web: http://learnpythonthehardway.org/ * PDF: http://learnpythonthehardway.org/static/LearnPythonTheHardWay.pdf The book so f

Re: partial sums problem

2010-09-28 Thread Terry Reedy
On 9/28/2010 6:57 PM, kj wrote: The following attempt to get a list of partial sums fails: s = 0 [((s += t) and s) for t in range(1, 10)] File "", line 1 [((s += t) and s) for t in range(1, 10)] ^ SyntaxError: invalid syntax What's the best way to get a list of partial su

Re: function decorators

2010-09-28 Thread Terry Reedy
On 9/28/2010 6:02 PM, Nick Donohue wrote: I came across this code just now: def time_me(function): def wrap(*arg): start = time.time() r = function(*arg) end = time.time() print "%s (%0.3f ms)" %(function.func_name, (end-start)*1000) return wrap @time_me def some_funct

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Chris Rebert
On Tue, Sep 28, 2010 at 2:55 AM, Malcolm McLean wrote: > On Sep 27, 9:29 pm, p...@informatimago.com (Pascal J. Bourguignon) > wrote: >> On the other hand, with the dynamic typing mindset, you might even wrap >> your values (of whatever numerical type) in a symbolic expression >> mentionning the un

Re: About __class__ of an int literal

2010-09-28 Thread Terry Reedy
On 9/28/2010 5:27 AM, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. Third solution: >>> type(0) is 0 .__clas

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Rob Warnock
EXECUTIVE SUMMARY: 1 inch + 1 second = ~4.03e38 grams. GORY DETAILS: Tim Bradshaw wrote: +--- | Malcolm McLean said: | > he problem is that if you allow expressions rather than terms then | > the experssions can get arbitrarily complex. sqrt(1 inch + 1 Second), | > for instance

Re: partial sums problem

2010-09-28 Thread Ian Kelly
On Tue, Sep 28, 2010 at 4:57 PM, kj wrote: > > > The following attempt to get a list of partial sums fails: > > >>> s = 0 > >>> [((s += t) and s) for t in range(1, 10)] > File "", line 1 >[((s += t) and s) for t in range(1, 10)] > ^ > SyntaxError: invalid syntax > Because in Python

Re: partial sums problem

2010-09-28 Thread Seebs
On 2010-09-28, Gary Herron wrote: > Python does have "s+=t" as a statement, and it does have list > comprehensions [... for ...] as expressions, but you cannot put a > statement inside an expression. I've inferred that, in Python, all assignments are by definition statements, rather than expre

Re: partial sums problem

2010-09-28 Thread MRAB
On 28/09/2010 23:57, kj wrote: The following attempt to get a list of partial sums fails: s = 0 [((s += t) and s) for t in range(1, 10)] File "", line 1 [((s += t) and s) for t in range(1, 10)] ^ SyntaxError: invalid syntax What's the best way to get a list of partial sum

Re: partial sums problem

2010-09-28 Thread Emile van Sebille
On 9/28/2010 3:57 PM kj said... The following attempt to get a list of partial sums fails: s = 0 [((s += t) and s) for t in range(1, 10)] File "", line 1 [((s += t) and s) for t in range(1, 10)] ^ SyntaxError: invalid syntax What's the best way to get a list of partial su

Re: utf-8 and ctypes

2010-09-28 Thread MRAB
On 28/09/2010 23:54, Brendan Miller wrote: I'm using python 2.5. Currently I have some python bindings written in ctypes. On the C side, my strings are in utf-8. On the python side I use ctypes.c_char_p to convert my strings to python strings. However, this seems to break for non-ascii character

Re: Upload files with wsgi

2010-09-28 Thread Hidura
I am trying to upload any type of file ext to an app written in Py3k, using Apache+mod_wsgi i can't use django or cherryPy because i manage the data in the request creating an xml to store the data from selected areas and send it to the server. I am using the wsgiref library to handle the request a

Re: partial sums problem

2010-09-28 Thread Gary Herron
On 09/28/2010 03:57 PM, kj wrote: The following attempt to get a list of partial sums fails: s = 0 [((s += t) and s) for t in range(1, 10)] File "", line 1 [((s += t) and s) for t in range(1, 10)] ^ SyntaxError: invalid syntax What's the best way to get a lis

partial sums problem

2010-09-28 Thread kj
The following attempt to get a list of partial sums fails: >>> s = 0 >>> [((s += t) and s) for t in range(1, 10)] File "", line 1 [((s += t) and s) for t in range(1, 10)] ^ SyntaxError: invalid syntax What's the best way to get a list of partial sums? TIA! kj -- http://mail.p

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Keith Thompson
Erik Max Francis writes: [...] > >>> print c # floating point accuracy aside > 299792458.0 m/s Actually, the speed of light is exactly 299792458.0 m/s by definition. (The meter and the second are defined in terms of the same wavelength of light; this was changed relatively recently.) -- Keith

utf-8 and ctypes

2010-09-28 Thread Brendan Miller
I'm using python 2.5. Currently I have some python bindings written in ctypes. On the C side, my strings are in utf-8. On the python side I use ctypes.c_char_p to convert my strings to python strings. However, this seems to break for non-ascii characters. It seems that characters not in the ascii

Re: Upload files with wsgi

2010-09-28 Thread John Nagle
On 9/28/2010 3:31 PM, Hidura wrote: Hello, i have a project on Python3k, and i have a very big problem i don' t find how take an upload file i am using the wsgiref lib, and or theres any way to connect to the client in order to get the file by myself? Thank you Diego Hidalgo. This is not cl

Re: (and scheme lisp) x Python and modern langs [was Re: gossip, Guy Steel, Lojban, Racket]

2010-09-28 Thread Xah Lee
2010-09-28 On Sep 28, 12:07 pm, namekuseijin wrote: > On 28 set, 14:56, Xah Lee wrote: > > > ultimately, all lang gets transformed at the compiler level to become > > machine instructions, which is imperative programing in the ultimate > > sense. > > > You say that “do” is merely macro and ultim

Upload files with wsgi

2010-09-28 Thread Hidura
Hello, i have a project on Python3k, and i have a very big problem i don' t find how take an upload file i am using the wsgiref lib, and or theres any way to connect to the client in order to get the file by myself? Thank you Diego Hidalgo. -- Enviado desde mi dispositivo móvil Diego I. Hidalgo

Re: function decorators

2010-09-28 Thread Ian Kelly
On Tue, Sep 28, 2010 at 4:02 PM, Nick Donohue wrote: > I came across this code just now: > > def time_me(function): > def wrap(*arg): >start = time.time() >r = function(*arg) >end = time.time() >print "%s (%0.3f ms)" %(function.func_name, (end-start)*1000) > return wrap > > @tim

Re: function decorators

2010-09-28 Thread Diez B. Roggisch
Nick Donohue writes: > I came across this code just now: > > def time_me(function): > def wrap(*arg): > start = time.time() > r = function(*arg) > end = time.time() > print "%s (%0.3f ms)" %(function.func_name, (end-start)*1000) > return wrap > > @time_me > def some_function(s

Re: function decorators

2010-09-28 Thread Seebs
On 2010-09-28, Nick Donohue wrote: > why would I use these? wouldn't it be more flexible to not write the > decorator before the function definition, so I could choose to wrap it > or not? The utility is that it lets you modify all calls to a function at once, without changing all the instances i

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Erik Max Francis
Malcolm McLean wrote: On Sep 27, 9:29 pm, p...@informatimago.com (Pascal J. Bourguignon) wrote: On the other hand, with the dynamic typing mindset, you might even wrap your values (of whatever numerical type) in a symbolic expression mentionning the unit and perhaps other meta data, so that when

function decorators

2010-09-28 Thread Nick Donohue
I came across this code just now: def time_me(function): def wrap(*arg): start = time.time() r = function(*arg) end = time.time() print "%s (%0.3f ms)" %(function.func_name, (end-start)*1000) return wrap @time_me def some_function(somearg) some_function(arg) I've been lookin

JSONBOT 0.4 RELEASED

2010-09-28 Thread Bart Thate
Yesterday i pushed version 0.4 of JSONBOT to pypi and googlecode. This version has a rewritten core that makes it easier to develop bots for and has lots of bugs fixed. A karma plugin was added as well as a silent mode that forwards bot responses to /msg. You can grab a copy on http://jsonbot.goog

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Tim Rowe
On 27 September 2010 18:46, namekuseijin wrote: > Fact is:  almost all user data from the external words comes into > programs as strings. Sorry, sent this to the individual, not the group. I'd be very surprised if that were true. I suspect the majority of programs are in embedded systems, and

Pyro 4.2 released

2010-09-28 Thread Irmen de Jong
Pyro 4.2 - I'm pleased to announce the release of Pyro 4.2! Detailed info here: http://www.razorvine.net/python/Pyro Download here: http://www.xs4all.nl/~irmen/pyro4/download/ Python package index entry: http://pypi.python.org/pypi/Pyro4 License: MIT software license. Note: Pyro 4 is not

Re: toy list processing problem: collect similar terms

2010-09-28 Thread John Bokma
Paul Rubin writes: > John Bokma writes: >> Xah Lee writes: ... >> Can you stop crossposting? > > John, can you ALSO stop crossposting? Since the issue is on-topic in all groups: no. I did set a follow-up header, which you ignored and on top of that redirected the thing to comp.lang.python. S

Re: list problem...

2010-09-28 Thread Shashwat Anand
On Wed, Sep 29, 2010 at 1:15 AM, rog wrote: > Shashwat Anand wrote: > > >> >> On Wed, Sep 29, 2010 at 12:14 AM, Rog > r...@pynguins.com>> wrote: >> >>Hi all, >>Have been grappling with a list problem for hours... >>a = [2, 3, 4, 5,.] >>b = [4, 8, 2, 6,.] >>Basicly I am

Re: About __class__ of an int literal

2010-09-28 Thread Hans Mulder
Tim Golden wrote: On 28/09/2010 10:27, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. I searched the pyth

Re: About __class__ of an int literal

2010-09-28 Thread Stefan Schwarzer
Hello Alex, On 2010-09-28 11:27, AlexWalk wrote: > In python 3.1.2(I'm using windows edition, 32bit), > accessing __class__ of an int literal will raise a > SyntaxException, while other literals will not. For > example. 1.__class__ is an error, while 1.1.__class__ runs > ok. > > I searched the p

Re: Reoedering indexes in list of list

2010-09-28 Thread Arnaud Delobelle
Toto writes: >> If your "alias" can be read-only: >> alias = zip(*myList) > > > > a=[['00','01'],['10','11']] > l=zip(*a) > print(l) > > returns... [('00', '10'), ('01', '11')] > > IS NOT AT ALL WHAT I WANT ;-) > > What I want is > > print a[1][0] > '10' > but print l[1][0] > '01' > > notice the

Re: [ctpug] Introducing Kids to Programming: 2 or 3?

2010-09-28 Thread Piet Delport
On Mon, Sep 27, 2010 at 5:48 PM, Marco Gallotta wrote: > > > We received a grant from Google to reach 1,000 kids in South Africa > with our course in 2011. People have also shown interest in running > the course in Croatia, Poland and Egypt. We're also eyeing developing > African countries in the l

Re: Reoedering indexes in list of list

2010-09-28 Thread Toto
heu the zip trick actually works... my mistake! -- http://mail.python.org/mailman/listinfo/python-list

Re: Reoedering indexes in list of list

2010-09-28 Thread Toto
again I want: alias[y][x] returns myList[x][y] > print a[1][0] > '10' > but print l[1][0] > '01' > > notice the indexes  of the list l are inverted... -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.7 installation problem

2010-09-28 Thread Ned Deily
In article , Ronald Guida wrote: > Sorry, I have one additional piece of information that might be helpful to > others. I have discovered that the *.so files that were not installed, were > actually installed to the ~/lib/python2.6/ folder instead of the > ~/lib/python2.7/ folder where they be

Re: Reoedering indexes in list of list

2010-09-28 Thread Toto
> If your "alias" can be read-only: > alias = zip(*myList) a=[['00','01'],['10','11']] l=zip(*a) print(l) returns... [('00', '10'), ('01', '11')] IS NOT AT ALL WHAT I WANT ;-) What I want is print a[1][0] '10' but print l[1][0] '01' notice the indexes of the list l are inverted... -- h

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Keith Thompson
George Neuner writes: > On 28 Sep 2010 12:42:40 GMT, Albert van der Horst > wrote: >>I would say the dimensional checking is underrated. It must be >>complemented with a hard and fast rule about only using standard >>(SI) units internally. >> >>Oil output internal : m^3/sec >>Oil output printed:

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Nick
t...@sevak.isi.edu (Thomas A. Russ) writes: > Malcolm McLean writes: > >> I'd like to design a language like this. If you add a quantity in >> inches to a quantity in centimetres you get a quantity in (say) >> metres. If you multiply them together you get an area, if you divide >> them you get a

Re: list problem...

2010-09-28 Thread Rog
On Tue, 28 Sep 2010 11:59:08 -0700, geremy condra wrote: > On Tue, Sep 28, 2010 at 11:44 AM, Rog wrote: >> Hi all, >> Have been grappling with a list problem for hours... a = [2, 3, 4, >> 5,.] >> b = [4, 8, 2, 6,.] >> Basicly I am trying to place a[0], b[0] in a seperate list IF a[2] and

Re: toy list processing problem: collect similar terms

2010-09-28 Thread Paul Rubin
John Bokma writes: > Xah Lee writes: ... > Can you stop crossposting? John, can you ALSO stop crossposting? -- http://mail.python.org/mailman/listinfo/python-list

Re: Reoedering indexes in list of list

2010-09-28 Thread Chris Rebert
On Tue, Sep 28, 2010 at 11:55 AM, Toto wrote: > Hello, > > I have a list of list > assume myList[x][y] is integer > I would like to create an alias to that list which I could call this > way: > alias[y][x] returns myList[x][y] If your "alias" can be read-only: alias = zip(*myList) Cheers, Chris

Reoedering indexes in list of list

2010-09-28 Thread Toto
Hello, I have a list of list assume myList[x][y] is integer I would like to create an alias to that list which I could call this way: alias[y][x] returns myList[x][y] how can I do that ? (python 2.6) (I have a feeling I should use 'property' ;) Thanks, -- -- http://mail.python.org/mailman/list

Re: list problem...

2010-09-28 Thread geremy condra
On Tue, Sep 28, 2010 at 11:44 AM, Rog wrote: > Hi all, > Have been grappling with a list problem for hours... > a = [2, 3, 4, 5,.] > b = [4, 8, 2, 6,.] > Basicly I am trying to place a[0], b[0] in a seperate list > IF a[2] and b[2] is present. > I have tried sets, zip etc with no success.

Re: list problem...

2010-09-28 Thread Shashwat Anand
On Wed, Sep 29, 2010 at 12:14 AM, Rog wrote: > Hi all, > Have been grappling with a list problem for hours... > a = [2, 3, 4, 5,.] > b = [4, 8, 2, 6,.] > Basicly I am trying to place a[0], b[0] in a seperate list > IF a[2] and b[2] is present. > You are not exactly clear with your proble

list problem...

2010-09-28 Thread Rog
Hi all, Have been grappling with a list problem for hours... a = [2, 3, 4, 5,.] b = [4, 8, 2, 6,.] Basicly I am trying to place a[0], b[0] in a seperate list IF a[2] and b[2] is present. I have tried sets, zip etc with no success. I am tackling Euler projects with Python 3.1, with minimal k

Re: "Strong typing vs. strong testing"

2010-09-28 Thread MRAB
On 28/09/2010 19:21, George Neuner wrote: On 28 Sep 2010 12:42:40 GMT, Albert van der Horst wrote: I would say the dimensional checking is underrated. It must be complemented with a hard and fast rule about only using standard (SI) units internally. Oil output internal : m^3/sec Oil output p

Re: "Strong typing vs. strong testing"

2010-09-28 Thread George Neuner
On 28 Sep 2010 12:42:40 GMT, Albert van der Horst wrote: >I would say the dimensional checking is underrated. It must be >complemented with a hard and fast rule about only using standard >(SI) units internally. > >Oil output internal : m^3/sec >Oil output printed: kbarrels/day "barrel" is not a

Re: toy list processing problem: collect similar terms

2010-09-28 Thread John Bokma
Xah Lee writes: > can you stop this? Can you stop crossposting? And if there is really, really a need to crosspost, can you please set the follow-up to? > doesn't seems fruitful to keep on this. > > if you don't like my posts, ignore them? i don't post in > comp.lang.python or comp.lang.perl.mi

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Thomas A. Russ
Malcolm McLean writes: > I'd like to design a language like this. If you add a quantity in > inches to a quantity in centimetres you get a quantity in (say) > metres. If you multiply them together you get an area, if you divide > them you get a dimeionless scalar. If you divide a quantity in metr

Re: (and scheme lisp) x Python and modern langs [was Re: gossip, Guy Steel, Lojban, Racket]

2010-09-28 Thread Xah Lee
xah wrote: > in anycase, how's “do” not imperative? On Sep 28, 6:27 am, namekuseijin wrote: > > how's “do” a “named let”? can you show example or reference of that > > proposal? (is it worthwhile?) > > I'll post it again in the hope you'll read this time: > > " > (do ((i 0 (+ 1 i))  ; i initially

Re: How to match where the search started?

2010-09-28 Thread MRAB
On 28/09/2010 17:32, Florian Kaufmann wrote: If you want to anchor the regex at the start position 'pos' then use the 'match' method instead. The wickedly problem is that matching at position 'pos' is not a requirement, its an option. Look again at my 2nd example, the r'(\=|.)...' part, which (

Re: toy list processing problem: collect similar terms

2010-09-28 Thread Xah Lee
On Sep 27, 9:34 pm, John Bokma wrote: > Seebs writes: > > fup set to poster > > > On 2010-09-28, John Bokma wrote: > >> Seebs writes: > >>> On 2010-09-26, J?rgen Exner wrote: > It was livibetter who without any motivation or reasoning posted Python > code in CLPM. > > >>> Not exactly

[ANN] (probably) last version of Pylint supporting python 2.3 released

2010-09-28 Thread Sylvain Thénault
Hi there! As someone stuck with python 2.3 tried to use pylint, we made some fixes to get python 2.3 supports back. This resulted in the release of pylint 0.21.3, logilab-astng 0.20.3 and logilab-common 0.52 today. At the time of porting pylint to py3k, this will much probably be the latest set

Re: tix problem in ubuntu karmic

2010-09-28 Thread Jeff Hobbs
On Sep 27, 11:30 pm, harryos wrote: > I had been using  jaunty as o.s and was coding in python 2.6. While > using Tix widgets in my code I came across a bug as mentioned in > > https://bugs.launchpad.net/ubuntu/+source/tix/+bug/371720 ... > So ,I  thought upgrading to karmic would help .But even a

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Niklas Holsti
Albert van der Horst wrote: In article <87fwwvrnmf@kuiper.lan.informatimago.com>, ... I would even go further. Types are only part of the story. You may distinguish between integers and floating points, fine. But what about distinguishing between floating points representing lengths and

Re: How to match where the search started?

2010-09-28 Thread Florian Kaufmann
> If you want to anchor the regex at the start position 'pos' then use > the 'match' method instead. The wickedly problem is that matching at position 'pos' is not a requirement, its an option. Look again at my 2nd example, the r'(\=|.)...' part, which (of course wrongly) assumes that \= means 'ma

Re: minimal D: need software testers

2010-09-28 Thread Brian Curtin
On Mon, Sep 27, 2010 at 10:07, Kruptein wrote: > Hey, > > I've released the second alpha for minimal-D a program I've written in > python which should make developing easier. > I need people to test the app on bugs and give ideas. > > It is written in python using the wxPython toolkit and is linu

Re: relative imports and sub-module execution

2010-09-28 Thread Diez B. Roggisch
King writes: > Hi, > > After reading couple of docs and articles, I have implemented a simple > test package with nested modules. > When running "main.py", everything is working fine. Some of my sub- > modules has some small test routines for debug purpose. > It's because I am using relative pack

Re: How to match where the search started?

2010-09-28 Thread MRAB
On 28/09/2010 09:10, Florian Kaufmann wrote: From the documentation: 7.2.4. Regular Expression Objects, search(string[, pos[, endpos]]) ... the '^' pattern character matches at the real beginning of the string and at positions just after a newline, but not necessarily at the index where the sea

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Tim Bradshaw
On 2010-09-28 14:39:27 +0100, Malcolm McLean said: he problem is that if you allow expressions rather than terms then the experssions can get arbitrarily complex. sqrt(1 inch + 1 Second), for instance. I can't imagine a context where 1 inch + 1 second would not be an error, so this is a sligh

Re: How to match where the search started?

2010-09-28 Thread Thomas Jollans
On Tuesday 28 September 2010, it occurred to Florian Kaufmann to exclaim: > >From the documentation: > 7.2.4. Regular Expression Objects, search(string[, pos[, endpos]]) > ... the '^' pattern character matches at the real beginning of the > string and at positions just after a newline, but not nece

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Malcolm McLean
On Sep 28, 12:19 pm, Tim Bradshaw wrote: > > There are several existing systems which do this.  The HP48 (and > descendants I expect) support "units" which are essentially dimensions. >  I don't remember if it signals errors for incoherent dimensions.   > Mathematica also has some units support, a

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Albert van der Horst
In article <87fwwvrnmf@kuiper.lan.informatimago.com>, Pascal J. Bourguignon wrote: >namekuseijin writes: > >>> in C I can have a function maximum(int a, int b) that will always >>> work. Never blow up, and never give an invalid answer. If someone >>> tries to call it incorrectly it is a compi

Re: "Strong typing vs. strong testing"

2010-09-28 Thread BartC
"Malcolm McLean" wrote in message news:1d6e115c-cada-46fc-9444-01e80e0af...@c10g2000yqh.googlegroups.com... On Sep 27, 9:29 pm, p...@informatimago.com (Pascal J. Bourguignon) wrote: On the other hand, with the dynamic typing mindset, you might even wrap your values (of whatever numerical ty

Re: About __class__ of an int literal

2010-09-28 Thread Tim Golden
On 28/09/2010 10:27, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. I searched the python issue tracker but

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Tim Bradshaw
On 2010-09-28 10:55:19 +0100, Malcolm McLean said: I'd like to design a language like this. If you add a quantity in inches to a quantity in centimetres you get a quantity in (say) metres. If you multiply them together you get an area, if you divide them you get a dimeionless scalar. If you divi

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Richard
Malcolm McLean writes: > On Sep 27, 9:29 pm, p...@informatimago.com (Pascal J. Bourguignon) > wrote: >> >> On the other hand, with the dynamic typing mindset, you might even wrap >> your values (of whatever numerical type) in a symbolic expression >> mentionning the unit and perhaps other meta da

About __class__ of an int literal

2010-09-28 Thread AlexWalk
In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. I searched the python issue tracker but failed to find relevant reports. I w

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Malcolm McLean
On Sep 27, 9:29 pm, p...@informatimago.com (Pascal J. Bourguignon) wrote: > > On the other hand, with the dynamic typing mindset, you might even wrap > your values (of whatever numerical type) in a symbolic expression > mentionning the unit and perhaps other meta data, so that when the other > modu

Re: "Strong typing vs. strong testing"

2010-09-28 Thread Malcolm McLean
On Sep 27, 7:46 pm, namekuseijin wrote: > On 27 set, 05:46, TheFlyingDutchman wrote: > > Fact is: almost all user data from the external words comes into > programs as strings. No typesystem or compiler handles this fact all > that graceful...- Hide quoted text - > You're right. C should have a

Re: How to match where the search started?

2010-09-28 Thread Florian Kaufmann
The thing is that the (\=|...) group is not really part of the match. I think this gives you more the idea what I want reo = re.compile( r'(\=|.)...' ); while True mo = reo.search(text,pos) if not mo: break if text[mo.start()] == '\\' # a pseudo match. continue after the backslash else

Re: How to match where the search started?

2010-09-28 Thread Florian Kaufmann
The thing is that the (\=|...) group is not really part of the match. I think this gives you more the idea what I want reo = re.compile( r'(\=|.)...' ); while True mo = reo.search(text,pos) if not mo: break if text[mo.start()] == '\\' # a pseudo match. continue after the backslash else

How to match where the search started?

2010-09-28 Thread Florian Kaufmann
>From the documentation: 7.2.4. Regular Expression Objects, search(string[, pos[, endpos]]) ... the '^' pattern character matches at the real beginning of the string and at positions just after a newline, but not necessarily at the index where the search is to start But I'd like to do just th

Re: Introducing Kids to Programming: 2 or 3?

2010-09-28 Thread Wayne Brehaut
On Mon, 27 Sep 2010 12:45:44 -0400, Andreas Waldenburger wrote: >On Mon, 27 Sep 2010 17:48:06 +0200 Marco Gallotta > wrote: > >> Since these are kids, we feel the nice changes in 3 such as removing >> integer division will help in teaching. It will also remove confusion >> when they go to downloa