Re: if the else short form

2010-10-01 Thread Arnaud Delobelle
Paul Rubin writes: > Steven D'Aprano writes: >> Incorrect. bools *are* ints in Python, beyond any doubt. > > Python 2.6.2 (r262:71600, Jun 4 2010, 18:28:58) > >>> type(3)==type(True) > False Of course, but it's the wrong thing to ask if you want know if bools are ints. To find ou

Re: Crummy BS Script

2010-10-01 Thread Steven D'Aprano
On Fri, 01 Oct 2010 21:05:09 -0700, flebber wrote: > On Oct 2, 9:27 am, MRAB wrote: >> On 01/10/2010 23:29, Burton Samograd wrote:> >> flebber  writes: >> >> >> But where is this saving the imported file and under what name? >> >> > Looks like samples.csv: >> >> >> f = open('samples.csv', 'w') >>

Re: if the else short form

2010-10-01 Thread Steven D'Aprano
On Fri, 01 Oct 2010 22:19:14 -0700, Paul Rubin wrote: > Steven D'Aprano writes: >> Incorrect. bools *are* ints in Python, beyond any doubt. > > Python 2.6.2 (r262:71600, Jun 4 2010, 18:28:58) > >>> type(3)==type(True) > False So? Instances of a subclasses are still instances of the

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Steven D'Aprano
On Fri, 01 Oct 2010 11:56:24 +0200, Pascal J. Bourguignon wrote: > Actually, it's hard to find a language that has no compiler generating > faster code than C... Perl. Python. Ruby. Applescript. Hypertalk. Tcl. RPL. Frink. Inform 7. ActionScript. Dylan. Emerald. And hundreds more serious languag

Re: Problem saving uploaded files in Python3

2010-10-01 Thread Chris Rebert
On Fri, Oct 1, 2010 at 11:13 PM, wrote: > Hello, i control the problem of the data what is uploaded by the POST > method, in the web if the file is a text theres no problem > but the trouble comes when it's an enconded file as a Picture or other what > the when the system insert the data into the

Problem saving uploaded files in Python3

2010-10-01 Thread hidura
Hello, i control the problem of the data what is uploaded by the POST method, in the web if the file is a text theres no problem but the trouble comes when it's an enconded file as a Picture or other what the when the system insert the data into the file well it doesn 't encoded in the write wa

Re: if the else short form

2010-10-01 Thread Paul Rubin
Steven D'Aprano writes: > Incorrect. bools *are* ints in Python, beyond any doubt. Python 2.6.2 (r262:71600, Jun 4 2010, 18:28:58) >>> type(3)==type(True) False -- http://mail.python.org/mailman/listinfo/python-list

Re: sequence multiplied by -1

2010-10-01 Thread Steven D'Aprano
On Fri, 01 Oct 2010 14:56:52 +0200, Antoon Pardon wrote: > Think about the following possibility. > > Someone provides you with a library of functions that act on sequences. > They rely on the fact that '+' concatenates. > > Someone else provides you with a library of functions that act on > num

Re: if the else short form

2010-10-01 Thread Steven D'Aprano
On Fri, 01 Oct 2010 11:23:25 -0700, John Nagle wrote: >> Why so ? The doc clearly states that booleans are integers with True == >> 1 and False == 0, so there's nothing implicit here. > > Python "bool" values are NOT integers. They can be coerced to > integers for historical reasons. Inc

Re: sequence multiplied by -1

2010-10-01 Thread Steven D'Aprano
On Fri, 01 Oct 2010 10:24:11 -0700, Carl Banks wrote: > On Sep 26, 8:20 am, Grant Edwards wrote: [..] >> So now I suppose "+" for string concatenation is a bad thing. > > Yes. It's not the end of the world, but a separate concatenation > operator would have been better. Then there's no temptat

Re: Crummy BS Script

2010-10-01 Thread flebber
On Oct 2, 9:27 am, MRAB wrote: > On 01/10/2010 23:29, Burton Samograd wrote:> flebber   > writes: > > >> But where is this saving the imported file and under what name? > > > Looks like samples.csv: > > >> f = open('samples.csv', 'w') > > It'll be in the current working directory, which is given b

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Paul Rubin
Raffael Cavallaro writes: >> prints appears to be the 2000th Fibonacci number rather than the 1000th. > I think you're mistaken. fib(0) = 0, fib(1) = 1, fib(2) = 1, fib(3) = > 2 ... fib(11)= 89 ... Whoops, you're right, I messed up my program while refactoring it. Sorry. > you like we can do i

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Raffael Cavallaro
On 2010-10-01 22:44:11 -0400, Paul Rubin said: I have no idea what that fancy algorithm is doing, but the number it prints appears to be the 2000th Fibonacci number rather than the 1000th. I think you're mistaken. fib(0) = 0, fib(1) = 1, fib(2) = 1, fib(3) = 2 ... fib(11)= 89 ... fib(1000) =

Regular Expression Skipping Match

2010-10-01 Thread AON LAZIO
Hi python pals, I need this help, say I have h = "Hello \n World" How would I create a regular expression that match only "Hello World"? (ignore \n in the middle) Thanks in advance -- Aonlazio 'Peace is always the way.' NW -- http://mail.python.org/mailman/listinfo/python-list

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Pascal J. Bourguignon
"BartC" writes: > "Pascal J. Bourguignon" wrote in message > news:877hi1iq2o@kuiper.lan.informatimago.com... >> "BartC" writes: > >>> (defun fib (n) >>> (if (< n 2) >>> n >>> (+ n (fib (- n 1)) (fib (- n 2)) ) >>> )) >>> >>> But it gave the wrong results and it took ages to fi

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Paul Rubin
Raffael Cavallaro writes: > CL-USER 119 > (defun fib (n) >(/ (loop for k from 1 to n by 2 > sum (/ (* (expt 5 (/ (1- k) 2)) (fact n)) >(fact k) (fact (- n k > (expt 2 (1- n > CL-USER 122 > (time (fib

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Raffael Cavallaro
On 2010-10-01 16:47:02 -0400, BartC said: I had a quick look at Lisp to see if your claims had any basis. I tried this program: (defun fib (n) (if (< n 2) n (+ n (fib (- n 1)) (fib (- n 2)) ) )) But it gave the wrong results and it took ages to figure out why. Even after dow

Re: "Strong typing vs. strong testing"

2010-10-01 Thread BartC
"Pascal J. Bourguignon" wrote in message news:877hi1iq2o@kuiper.lan.informatimago.com... "BartC" writes: (defun fib (n) (if (< n 2) n (+ n (fib (- n 1)) (fib (- n 2)) ) )) But it gave the wrong results and it took ages to figure out why. Even I thought you were saying t

Re: Crummy BS Script

2010-10-01 Thread MRAB
On 01/10/2010 23:29, Burton Samograd wrote: flebber writes: But where is this saving the imported file and under what name? Looks like samples.csv: f = open('samples.csv', 'w') It'll be in the current working directory, which is given by: os.getcwd() -- http://mail.python.org/mailm

Re: Crummy BS Script

2010-10-01 Thread Burton Samograd
flebber writes: > But where is this saving the imported file and under what name? Looks like samples.csv: > f = open('samples.csv', 'w') -- Burton Samograd -- http://mail.python.org/mailman/listinfo/python-list

Crummy BS Script

2010-10-01 Thread flebber
I have a simple question regarding the Beuatiful soup crummy script. The last line is f.write('%s, %s, %s, %s, %s \n' % (i, t[0], t[1], t[2], t[3])), But where is this saving the imported file and under what name? #!/usr/bin/env python # ogm-sampples.py # Author: Matt Mayes # March 11, 2008 """ --

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Pascal J. Bourguignon
"BartC" writes: > "Pascal J. Bourguignon" wrote in message > news:87sk0qkzhz@kuiper.lan.informatimago.com... > >> Nothing extraordinary here. Common Lisp is more efficient than C. >> http://www.lrde.epita.fr/~didier/research/verna.06.ecoop.pdf >> http://portal.acm.org/citation.cfm?id=114416

Re: difference between %s and %d

2010-10-01 Thread Arnaud Delobelle
Ethan Furman writes: > If I'm printing the number 735, or any other positive or negative > integer, is there any difference between %7s and %7d? > > ~Ethan~ To link with another thread: >>> "%s" % True 'True' >>> "%d" % True '1' -- Arnaud -- http://mail.python.org/mailman/listinfo/python-lis

Re: "Strong typing vs. strong testing"

2010-10-01 Thread BartC
"Pascal J. Bourguignon" wrote in message news:87sk0qkzhz@kuiper.lan.informatimago.com... Nothing extraordinary here. Common Lisp is more efficient than C. http://www.lrde.epita.fr/~didier/research/verna.06.ecoop.pdf http://portal.acm.org/citation.cfm?id=1144168 Actually, it's hard to fin

ElementTree handling nested tag

2010-10-01 Thread tekion
All, I have the following xml tag: httpRequest HTTP://cmd.wma.ibm.com:80/ GET 200 I am interested in: httpRequest HTTP://cmd.wma.ibm.com:80/ GET 200 as well as the upper layer tag. How do I get at the nest tag listed above? Thanks. -- http:

Re: difference between %s and %d

2010-10-01 Thread Ethan Furman
Ethan Furman wrote: If I'm printing the number 735, or any other positive or negative integer, is there any difference between %7s and %7d? Grant Edwards wrote: > Let's ask Python: > > --> [n for n in range(-,,123) if ("%7d" % n) > != ("%7s" % n)] > [] > > --> [n

Re: difference between %s and %d

2010-10-01 Thread MRAB
On 01/10/2010 20:15, Ethan Furman wrote: If I'm printing the number 735, or any other positive or negative integer, is there any difference between %7s and %7d? "%s" uses str(). In Python 2.7: >>> class MyInt(int): ... def __init__(self, value): ... int.__init__(self, value) ...

Re: difference between %s and %d

2010-10-01 Thread Grant Edwards
On 2010-10-01, Ethan Furman wrote: > If I'm printing the number 735, or any other positive or negative > integer, is there any difference between %7s and %7d? Let's ask Python: >>> [n for n in range(-,,123) if ("%7d" % n) != ("%7s" % n)] [] >>> [n for n in range(-9,99

Re: __file__ is sometimes absolute, sometimes relative

2010-10-01 Thread Antoine Pitrou
On Fri, 1 Oct 2010 21:00:02 +0200 Sébastien Barthélemy wrote: > Hi, > > Arnaud, Christian, thank you for your help. > > I'll use abspath, it's shorter. > > Any idea why it's sometimes absolute, sometimes not? AFAICT, that's because sys.path contains some absolute paths and some relative ones.

difference between %s and %d

2010-10-01 Thread Ethan Furman
If I'm printing the number 735, or any other positive or negative integer, is there any difference between %7s and %7d? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: if the else short form

2010-10-01 Thread Ethan Furman
John Nagle wrote: On 10/1/2010 12:42 AM, bruno.desthuilli...@gmail.com wrote: On 30 sep, 19:22, Andreas Waldenburger wrote: >>> But it does violate the "explicit is better than implicit" tenet, don't you think? Why so ? The doc clearly states that booleans are integers with True == 1 and Fal

IMAP support

2010-10-01 Thread pakalk
Hello, Can anyone help me find GOOD IMAP library for python? Imaplib is.. ekhm... nevermind... Is there any good library? -- http://mail.python.org/mailman/listinfo/python-list

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Keith Thompson
p...@informatimago.com (Pascal J. Bourguignon) writes: > Seebs writes: >> On 2010-10-01, Pascal J. Bourguignon wrote: >>> Seebs writes: On 2010-10-01, Pascal J. Bourguignon wrote: > compiler passes wrong type wrong resultfails at run-time >

Re: __file__ is sometimes absolute, sometimes relative

2010-10-01 Thread Sébastien Barthélemy
Hi, Arnaud, Christian, thank you for your help. I'll use abspath, it's shorter. Any idea why it's sometimes absolute, sometimes not? -- http://mail.python.org/mailman/listinfo/python-list

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Keith Thompson
RG writes: > In article , > Seebs wrote: > >> On 2010-09-30, RG wrote: >> > That gives (what I would consider to be) false positives, e.g.: >> >> > [...@mighty:~]$ cat foo.c >> >> > void foo(long x) {} >> >> > int main() { foo(1); } >> > [...@mighty:~]$ gcc -Wconversion foo.c >> > foo.c: In

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Keith Thompson
TheFlyingDutchman writes: > On Sep 30, 10:37 pm, RG wrote: >> In article <87tyl63cag@mail.geddis.org>, >>  Don Geddis wrote: >> > Keith Thompson wrote on Thu, 30 Sep 2010: >> > > RG writes: >> > >> You're missing a lot of context.  I'm not trying to criticize C, just to >> > >> refute a fa

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Keith Thompson
Seebs writes: > On 2010-10-01, TheFlyingDutchman wrote: >>> > ? ? ? ? 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 compile error. > >>> I would a

Re: "Strong typing vs. strong testing"

2010-10-01 Thread RG
In article , Seebs wrote: > On 2010-10-01, RG wrote: > > Again, you can't have it both ways. Either a warning is a "compiler > > error" according to the claim at issue (see below) or it is not. If it > > is, then this is a false positive. > > No, it isn't. It's a correctly identified type

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Ian Collins
On 10/ 2/10 05:18 AM, Pascal J. Bourguignon wrote: Seebs writes: On 2010-10-01, Pascal J. Bourguignon wrote: static dynamic compiler detects wrong type fail at compile fails at run-time

Re: if the else short form

2010-10-01 Thread John Nagle
On 10/1/2010 12:42 AM, bruno.desthuilli...@gmail.com wrote: On 30 sep, 19:22, Andreas Waldenburger wrote: On Thu, 30 Sep 2010 03:42:29 -0700 (PDT) "bruno.desthuilli...@gmail.com" wrote: On 29 sep, 19:20, Seebs wrote: On 2010-09-29, Tracubik wrote: button = gtk.Button(("False,", "True,")[f

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Pascal J. Bourguignon
Seebs writes: > On 2010-10-01, Pascal J. Bourguignon wrote: >> Seebs writes: >>> On 2010-10-01, Pascal J. Bourguignon wrote: compiler passes wrong type wrong resultfails at run-time (the programmer (with exception

Re: sequence multiplied by -1

2010-10-01 Thread Carl Banks
On Sep 26, 8:20 am, Grant Edwards wrote: > On 2010-09-26, Paul Rubin wrote: > > > Steven D'Aprano writes: > >> There's nothing obscure or unintuitive about "spam"*3 = "spamspamspam", > > Why would it not be ["spam","spam","spam"] or even "ssspppaaammm"? > > Because > > 3 * "spam" == "spam" + "sp

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Terry Reedy
On 10/1/2010 2:28 AM, TheFlyingDutchman wrote: 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 compile error. I would agree that the third senten

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, Pascal J. Bourguignon wrote: > Seebs writes: >> On 2010-10-01, Pascal J. Bourguignon wrote: >>> compiler passes wrong type wrong resultfails at run-time >>> (the programmer (with exception >>> spends

Re: sequence multiplied by -1

2010-10-01 Thread Emile van Sebille
On 10/1/2010 9:44 AM Emile van Sebille said... On 10/1/2010 5:56 AM Antoon Pardon said... Someone provides you with a library of functions that act on sequences. They rely on the fact that '+' concatenates. Someone else provides you with a library of functions that act on numbers. They rely on

Re: "Strong typing vs. strong testing"

2010-10-01 Thread John Nagle
On 10/1/2010 7:17 AM, Rui Maciel wrote: Pascal J. Bourguignon wrote: Nothing extraordinary here. Common Lisp is more efficient than C. http://www.lrde.epita.fr/~didier/research/verna.06.ecoop.pdf http://portal.acm.org/citation.cfm?id=1144168 I don't know if you are intentionally trying to be

Re: sequence multiplied by -1

2010-10-01 Thread Emile van Sebille
On 10/1/2010 5:56 AM Antoon Pardon said... Someone provides you with a library of functions that act on sequences. They rely on the fact that '+' concatenates. Someone else provides you with a library of functions that act on numbers. They rely on the fact that '+' provides addition. But you

Re: __file__ is sometimes absolute, sometimes relative

2010-10-01 Thread Arnaud Delobelle
Sébastien Barthélemy writes: > Hello, Hi! > I use a data file that lies on disk in the same directory that the > module which makes use of it. > > The data file is checked in the repository and gets installed by > the distutils ``package_data`` directive, so it is in place both > during develop

Re: discussion

2010-10-01 Thread Brian Curtin
On Thu, Sep 30, 2010 at 21:12, Geo_subodh wrote: > please send me the simple python code that uses input number greater > than3 digits(>3 digits) and checks whether the number is palindrome > or not. $ cat homework.py raise NotImplementedError -- http://mail.python.org/mailman/listinfo/python

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Pascal J. Bourguignon
Seebs writes: > On 2010-10-01, Pascal J. Bourguignon wrote: >> static dynamic >> >> compiler detects wrong type fail at compile fails at run-time >> (with exception >>

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Pascal J. Bourguignon
"BartC" writes: > "Pascal J. Bourguignon" wrote in message > news:87zkuyjawh@kuiper.lan.informatimago.com... >> "BartC" writes: >> >>> "Pascal J. Bourguignon" wrote in message > When Intel will realize that 99% of its users are running VM >>> >>> Which one? >> >> Any implementation of

Re: "Strong typing vs. strong testing"

2010-10-01 Thread rustom
On Oct 1, 7:17 pm, Rui Maciel wrote: > a) no language is inherently more or less efficient than any other language.   > The efficiency > aspect is only related to how those languages are implemented (i.e., the > investments made in > optimizing the compilers/interpreters) I used to believe the

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, Steven D'Aprano wrote: > Now can we (by which I mean *you*) stop cross-posting C talk to multiple > newsgroups that don't have anything to do with C? Fair enough. The original thread does seem to have been crossposted in an innovative way. -s -- Copyright 2010, all wrongs rever

Re: Python becoming orphaned over ssh

2010-10-01 Thread Jean-Paul Calderone
On Oct 1, 10:35 am, Antoine Pitrou wrote: > On Thu, 30 Sep 2010 07:01:09 -0700 (PDT) > > Jean-Paul Calderone wrote: > > > But signal dispositions are inherited by child processes.  So you run > > ping from your short Python program, and it inherits SIGPIPE being > > ignored.  And it's written in

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, RG wrote: > Again, you can't have it both ways. Either a warning is a "compiler > error" according to the claim at issue (see below) or it is not. If it > is, then this is a false positive. No, it isn't. It's a correctly identified type mismatch. You keep moving the goal post

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, Pascal J. Bourguignon wrote: > static dynamic > > compiler detects wrong type fail at compile fails at run-time > (with exception >

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, Pascal J. Bourguignon wrote: > Seebs writes: >> The obvious simple maximum() in C will not raise an exception nor return >> something which isn't an int in any program which is not on its face >> invalid in the call. This is by definite contrast with several of the >> interpreted

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Seebs
On 2010-10-01, TheFlyingDutchman wrote: >> > ? ? ? ? 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 compile error. >> I would agree that the third se

Re: namespace hacking question

2010-10-01 Thread bruno.desthuilli...@gmail.com
On 1 oct, 14:12, Fuzzyman wrote: > On Sep 30, 6:07 pm, kj wrote: > > > > > This is a recurrent situation: I want to initialize a whole bunch > > of local variables in a uniform way, but after initialization, I > > need to do different things with the various variables. > > > What I end up doing i

Re: Determine sockets in use by python

2010-10-01 Thread Antoine Pitrou
On Thu, 30 Sep 2010 12:32:45 -0700 Jim Mellander wrote: > Thanks, I realized that even if I found out relevant info on the > socket, I would probably need to use ctypes to provide a low level > interface to select, as the socket wouldn't be a python socket object, > unless there is some way to pr

Re: Python becoming orphaned over ssh

2010-10-01 Thread Antoine Pitrou
On Thu, 30 Sep 2010 07:01:09 -0700 (PDT) Jean-Paul Calderone wrote: > > But signal dispositions are inherited by child processes. So you run > ping from your short Python program, and it inherits SIGPIPE being > ignored. And it's written in C, not Python, so when it writes to the > pipe, there'

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Rui Maciel
Pascal J. Bourguignon wrote: > Nothing extraordinary here. Common Lisp is more efficient than C. > http://www.lrde.epita.fr/~didier/research/verna.06.ecoop.pdf > http://portal.acm.org/citation.cfm?id=1144168 I don't know if you are intentionally trying to be deceitful or if you honestly didn't

Re: "Strong typing vs. strong testing"

2010-10-01 Thread BartC
"Pascal J. Bourguignon" wrote in message news:87zkuyjawh@kuiper.lan.informatimago.com... "BartC" writes: "Pascal J. Bourguignon" wrote in message When Intel will realize that 99% of its users are running VM Which one? Any implementation of a controlled environment is a virtual m

Re: discussion

2010-10-01 Thread BartC
"Geo_subodh" wrote in message news:31a08825-bb72-4e9f-8710-a39fe2bc9...@u31g2000pru.googlegroups.com... please send me the simple python code that uses input number greater than3 digits(>3 digits) and checks whether the number is palindrome or not. The following works without using strings (a

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Rui Maciel
George Neuner wrote: > That's true. But it is a situation where the conversion to SI units > loses precision and therefore probably shouldn't be done. > I don't care to check it ... the fact that the SI unit involves 12 > decimal places whereas the imperial unit involves 3 tells me the > conve

Fwd: Python becoming orphaned over ssh

2010-10-01 Thread David
(Sending again to the list, I mailed Jean-Paul off-list by mistake, sorry). On Thu, Sep 30, 2010 at 4:01 PM, Jean-Paul Calderone wrote: > You can fix this by resetting the signal disposition of SIGPIPE for > the ping process: > >    #!/usr/bin/python >    import signal > >    def reset(): >      

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Pascal J. Bourguignon
"BartC" writes: > "Pascal J. Bourguignon" wrote in message > news:87sk0qkzhz@kuiper.lan.informatimago.com... >> rustom writes: > >>> Much more mainstream, C# is almost as 'managed' as dynamic languages >>> and has efficiency comparable to C. >> >> Nothing extraordinary here. Common Lisp is

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Rui Maciel
namekuseijin wrote: >> 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 compile error. >> In a dynamic typed language maximum(a, b) can be called with incorrect >> datatype

Re: sequence multiplied by -1

2010-10-01 Thread Antoon Pardon
On Thu, Sep 30, 2010 at 07:02:40AM -0700, Emile van Sebille wrote: > On 9/30/2010 5:10 AM Antoon Pardon said... > >On Sun, Sep 26, 2010 at 03:20:18PM +, Grant Edwards wrote: > >>On 2010-09-26, Paul Rubin wrote: > >>>Steven D'Aprano writes: > There's nothing obscure or unintuitive about "s

Re: "Strong typing vs. strong testing"

2010-10-01 Thread BartC
"Pascal J. Bourguignon" wrote in message news:87sk0qkzhz@kuiper.lan.informatimago.com... rustom writes: Much more mainstream, C# is almost as 'managed' as dynamic languages and has efficiency comparable to C. Nothing extraordinary here. Common Lisp is more efficient than C. http://www

Re: namespace hacking question

2010-10-01 Thread Fuzzyman
On Sep 30, 6:07 pm, kj wrote: > This is a recurrent situation: I want to initialize a whole bunch > of local variables in a uniform way, but after initialization, I > need to do different things with the various variables. > > What I end up doing is using a dict: > > d = dict() > for v in ('spam',

Re: __file__ is sometimes absolute, sometimes relative

2010-10-01 Thread Christian Heimes
Am 01.10.2010 13:00, schrieb Sébastien Barthélemy: > Hello, > > I use a data file that lies on disk in the same directory that the > module which makes use of it. > > The data file is checked in the repository and gets installed by > the distutils ``package_data`` directive, so it is in place bot

__file__ is sometimes absolute, sometimes relative

2010-10-01 Thread Sébastien Barthélemy
Hello, I use a data file that lies on disk in the same directory that the module which makes use of it. The data file is checked in the repository and gets installed by the distutils ``package_data`` directive, so it is in place both during development and after and install. In my program, I nee

ANNOUNCE - NHI1 / PLMK / libmsgque - Work-Package-II

2010-10-01 Thread Andreas Otto
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dear User, ANNOUNCE:Work-Package-II libmsgque: Application-Server-Toolkit for C, C++, JAVA, C#, TCL, PERL, PYTHON, VB.NET PLMK: Programming-Language-Microkernel NHI1: Non-Human-Intelligen

Re: C API: Getting PyObject by name

2010-10-01 Thread pbienst
Here is what I tried, but it prints out '-1': PyObject* obj = PyRun_String("1", Py_single_input, PyEval_GetGlobals(), PyEval_GetLocals()); long d = PyLong_AsLong(obj); printf("long:%ld\n", d); Py_DECREF(obj); Peter On Sep 30, 9:24 pm, Thomas Jollans wrote: > On Thursday 30 September 2010, it oc

Re: if the else short form

2010-10-01 Thread Antoon Pardon
On Wed, Sep 29, 2010 at 05:58:16AM -0700, bruno.desthuilli...@gmail.com wrote: > On 29 sep, 13:38, Hrvoje Niksic wrote: > > Tracubik writes: > > > > > button = gtk.Button(("False,", "True,")[fill==True]) > > (snip) > > > BTW adding "==True" to a boolean value is redundant and can even break > >

Re: if the else short form

2010-10-01 Thread Antoon Pardon
On Wed, Sep 29, 2010 at 01:38:48PM +0200, Hrvoje Niksic wrote: > Tracubik writes: > > > Hi all, > > I'm studying PyGTK tutorial and i've found this strange form: > > > > button = gtk.Button(("False,", "True,")[fill==True]) > > > > the label of button is True if fill==True, is False otherwise. >

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Pascal J. Bourguignon
Seebs writes: > On 2010-09-30, Ian Collins wrote: >> Which is why agile practices such as TDD have an edge. If it compiles >> *and* passes all its tests, it must be right. > > So far as I know, that actually just means that the test suite is > insufficient. :) > > Based on my experience thus

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Pascal J. Bourguignon
rustom writes: > Some points that seem to be missed (or Ive missed them?) > > 1. A dichotomy is being made between 'static' languages like C and > 'dynamic' languages like python/lisp. This dichotomy was valid 30 > years ago, not today. In Haskell for example > > - static checking is stronger th

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Pascal J. Bourguignon
Seebs writes: > On 2010-10-01, Don Geddis wrote: >> 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 compile error. > > I would agree that the thi

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Nick Keighley
On 27 Sep, 18:46, namekuseijin 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... snobol? -- http://mail.python.org/mailman/listinfo/python-list

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Steven D'Aprano
On Thu, 30 Sep 2010 21:27:03 +, Seebs wrote: > On 2010-09-30, Ian Collins wrote: >> Which is why agile practices such as TDD have an edge. If it compiles >> *and* passes all its tests, it must be right. > > So far as I know, that actually just means that the test suite is > insufficient. +

Re: Having problem with subclass

2010-10-01 Thread Steven D'Aprano
On Thu, 30 Sep 2010 18:54:00 -0700, tekion wrote: > When I move Bclass to A.py, it works. Is there some restriction in > python that sub classing a class has be in the same file as the class > you're are sub classing? Thanks. Others have already solved your main problem (you need to refer to A

Re: discussion

2010-10-01 Thread Steven D'Aprano
On Thu, 30 Sep 2010 19:12:06 -0700, Geo_subodh wrote: > please send me the simple python code that uses input number greater > than3 digits(>3 digits) and checks whether the number is palindrome or > not. def is_palindrome_or_not(n): """Checks whether the input number n is a palindrome or no

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Pascal J. Bourguignon
Gene writes: > The FA or TM dichotomy is more painful to contemplate than you say. > Making appropriate simplifications for input, any modern computer is a > FA with 2^(a few trillion) states. Consequently, the gestalt of > computer science seems to be to take it on faith that at some very > lar

Re: gedit 'External Tools' plugin hashlib weirdness

2010-10-01 Thread Joel Hedlund
I apparently replied to soon. Removing /usr/lib/python2.4 from PYTHONPATH did not solve the problem. I think I may have had a launcher-started gedit running somewhere in the background while testing. Any subsequent terminal-launches would then just create new windows for the existing (non-bugged)

Re: if the else short form

2010-10-01 Thread bruno.desthuilli...@gmail.com
On 30 sep, 19:22, Andreas Waldenburger wrote: > On Thu, 30 Sep 2010 03:42:29 -0700 (PDT) > > "bruno.desthuilli...@gmail.com" wrote: > > On 29 sep, 19:20, Seebs wrote: > > > On 2010-09-29, Tracubik wrote: > > > > button = gtk.Button(("False,", "True,")[fill==True]) > > > > Oh, what a nasty idiom

Re: "Strong typing vs. strong testing"

2010-10-01 Thread Antony
On 9/30/2010 9:06 AM, Seebs wrote: At $dayjob, they give us months between feature complete and shipping, Lucky you -Antony -- http://mail.python.org/mailman/listinfo/python-list