Re: C API: Getting PyObject by name

2010-09-30 Thread Thomas Jollans
On Thursday 30 September 2010, it occurred to pbienst to exclaim: > Hi, > > I'm embedding Python in a C app. > > Say I do the following: > > PyRun_SimpleString("a = 1") > > Is there then a way to get access to the PyObject corresponding to a, > only making use in C of the fact that it's calle

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, Keith Thompson wrote: > Seebs writes: >> On 2010-09-30, Paul Rubin wrote: >>> int maximum(int a, int b); >>> int foo() { >>> int (*barf)() = maximum; >>> return barf(3); >>> } > That first line declare barf as an object of type "pointer to > function retu

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Ian Collins
On 10/ 1/10 02:57 AM, Pascal Bourguignon wrote: Nick Keighley writes: On 27 Sep, 20:29, p...@informatimago.com (Pascal J. Bourguignon) wrote: If you start with the mindset of static type checking, you will consider that your types are checked and if the types at the interface of two modules m

Re: Determine sockets in use by python

2010-09-30 Thread Jim Mellander
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 promote a c socket to a python socket object. Appreciate the info,

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Ian Collins
On 10/ 1/10 08:21 AM, Seebs wrote: On 2010-09-30, Keith Thompson wrote: IMHO it's better to use prototypes consistently than to figure out the rules for interactions between prototyped vs. non-prototyped function declarations. Yes. It's clearly undefined behavior to call a function through

Re: Re: Re: Problems with wsgi Python3

2010-09-30 Thread hidura
What mean this -743346150198628700241600224--\r? On Sep 30, 2010 2:38pm, hid...@gmail.com wrote: Sorry, for the last mail, here it's what you asked: {'CONTENT_LENGTH': '61', [Thu Sep 30 13:35:07 2010] [error] 'CONTENT_TYPE': [Thu Sep 30 13:35:07 2010] [error] 'mult

Re: Determine sockets in use by python

2010-09-30 Thread exarkun
On 07:32 pm, jmellan...@lbl.gov 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 promote a c socket to a py

Re: "Strong typing vs. strong testing"

2010-09-30 Thread RG
In article <7xr5gbxfry@ruckus.brouhaha.com>, Paul Rubin wrote: > RG writes: > > Yes, I know I could have used lint. But that misses the point. For any > > static analyzer, because of the halting problem, I can construct a > > program that either contains an error that the analyzer will

Re: "Strong typing vs. strong testing"

2010-09-30 Thread ImpalerCore
On Sep 29, 9:01 pm, RG wrote: > [...@mighty:~]$ cat foo.c > #include > > int maximum(int a, int b) { return a > b ? a : b; } > > int main() { >   long x = 8589934592; >   printf("Max of %ld and 1 is %d\n", x, maximum(x,1)); >   return 0;} > > [...@mighty:~]$ gcc -Wall foo.c > [...@mighty:~]$ .

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Keith Thompson
RG writes: > In article , > Seebs wrote: > >> On 2010-09-30, Lie Ryan wrote: >> > On 09/30/10 16:09, TheFlyingDutchman wrote: >> >> Dynamic typed languages like Python fail in this case on "Never blows >> >> up". >> >> > How do you define "Never blows up"? >> >> I would say "blow up" would be

Re: "Strong typing vs. strong testing"

2010-09-30 Thread RG
In article <0390e2b4-fa28-49b3-a867-39be6d668...@w19g2000yqb.googlegroups.com>, ImpalerCore wrote: > On Sep 29, 9:01 pm, RG wrote: > > > > > [...@mighty:~]$ cat foo.c > > #include > > > > int maximum(int a, int b) { return a > b ? a : b; } > > > > int main() { > >   long x = 8589934592; >

Re: "Strong typing vs. strong testing"

2010-09-30 Thread RG
In article , Seebs wrote: > On 2010-09-30, RG wrote: > > In article , > > Seebs wrote: > >> And that's the magic of static typing: It is not a false positive to > >> warn you that "2L" is not of type int. > > > We'll have to agree to disagree about that. > > No, we won't. It's the *defini

Re: Problems with wsgi Python3

2010-09-30 Thread Thomas Jollans
On Thursday 30 September 2010, it occurred to hid...@gmail.com to exclaim: > What mean this > -743346150198628700241600224--\r? it looks like a MIME boundary. In this context most likely from a multipart/form-data transmission. > > On Sep 30, 2010 2:38pm, hid...@gmai

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Gene
On Sep 30, 3:45 pm, RG wrote: > In article <7xr5gbxfry@ruckus.brouhaha.com>, >  Paul Rubin wrote: > > > > > > > RG writes: > > > Yes, I know I could have used lint.  But that misses the point.  For any > > > static analyzer, because of the halting problem, I can construct a > > > program tha

Re: "Strong typing vs. strong testing"

2010-09-30 Thread RG
In article , Keith Thompson wrote: > RG writes: > > In article , > > Seebs wrote: > > > >> On 2010-09-30, Lie Ryan wrote: > >> > On 09/30/10 16:09, TheFlyingDutchman wrote: > >> >> Dynamic typed languages like Python fail in this case on "Never blows > >> >> up". > >> > >> > How do you defi

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Pascal J. Bourguignon
RG writes: >> The main example of a sensible program that can't be written in a >> non-complete language is an interpreter for a Turing-complete language. >> But presumably a high-assurance application should never contain such a >> thing, since the interpreted programs themselves then wouldn't ha

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Pascal J. Bourguignon
Ian Collins writes: > On 10/ 1/10 02:57 AM, Pascal Bourguignon wrote: >> Nick Keighley writes: >> >>> On 27 Sep, 20:29, p...@informatimago.com (Pascal J. Bourguignon) >>> wrote: If you start with the mindset of static type checking, you will consider that your types are checked and if

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Paul Rubin
RG writes: > There are only two possibilities: either you have a finite-state > machine, or you have a Turning machine. (Well, OK, you could have a > pushdown automaton, but there are no programming languages that model a > PDA. The point is that the halting problem for general Turing machine

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Pascal J. Bourguignon
Keith Thompson writes: > const double pi = 2.71828182845904523526; > > To a human reader, it's obviously either a mistake or deliberate > obfuscation, but I'm not sure I'd *want* my compiler to warn me > about it just because I named the object "pi" rather than "e". > (And if I called it "x",

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Keith Thompson
Seebs writes: > On 2010-09-30, Keith Thompson wrote: >> Seebs writes: >>> On 2010-09-30, Paul Rubin wrote: int maximum(int a, int b); > int foo() { int (*barf)() = maximum; return barf(3); } > >> That first line declare barf as an object of type

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Paul Rubin
RG writes: > I don't want to quibble over terminology. Whatever label you choose to > put on it ("false positive", "not being able to express some things > without special extra effort") I consider it a deficiency. The costs > are greater than the benefits. Reasonable people can (and obvious

Re: Problems with wsgi Python3

2010-09-30 Thread Diez B. Roggisch
Thomas Jollans writes: > On Thursday 30 September 2010, it occurred to hid...@gmail.com to exclaim: >> What mean this >> -743346150198628700241600224--\r? > > it looks like a MIME boundary. In this context most likely from a > multipart/form-data transmission. yep, a

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Keith Thompson
RG writes: [...] > You're missing a lot of context. I'm not trying to criticize C, just to > refute a false claim that was made about it. Can you cite the article that made this false claim, and exactly what the false claim was? -- Keith Thompson (The_Other_Keith) ks...@mib.org

Re: Pyflakes and IPython does not work for Emacs on Windows?

2010-09-30 Thread Dsrt Egle
On Sep 24, 4:53 pm, David Robinow wrote: > On Fri, Sep 24, 2010 at 4:59 PM,DsrtEgle wrote: > > ... > > I can't invoke IPython by Emacs on Windows, either. Looks ipyhon.el > > only works for Linux? > > There don't appear to be a lot of ipython.el users on Windows. > You may have better look on an e

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Paul Rubin
TheFlyingDutchman writes: > With Tiny C on my system, your code does not cause maximum to give an > incorrect value, or to blow up: > > int maximum(int a, int b) > { > printf("entering maximum %d %d\n",a,b); > if ( a > b ) > return a; > else > return b; > } What did printf show as "

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
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 far, anyway, I am pretty sur

Re: gedit 'External Tools' plugin hashlib weirdness

2010-09-30 Thread Joel Hedlund
On Sep 30, 3:40 pm, Peter Otten <__pete...@web.de> wrote: > I'm surprised that /usr/lib/python2.4 doesn't appear in the traceback. That certainly would have been useful, wouldn't it? -- http://mail.python.org/mailman/listinfo/python-list

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
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 function ???main???: > foo.c:4: warning: passing argument 1 of ???foo??? wit

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
On 2010-09-30, RG wrote: > I don't want to quibble over terminology. May I suggest that, if you don't want to use words and terminology precisely, perhaps computer programming is not for you? > Whatever label you choose to > put on it ("false positive", "not being able to express some things >

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Ian Collins
On 10/ 1/10 10:27 AM, 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. :) Based on my experience

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Vend
On 30 Set, 01:47, RG wrote: > In article , >  Keith Thompson wrote: > > > > > RG writes: > > > In article > > > <07f75df3-778d-4e3d-8aa0-fbd4bd108...@k22g2000prb.googlegroups.com>, > > >  Squeamizh wrote: > > >> On Sep 29, 3:02 pm, RG wrote: > > [...] > > >> > This is a red herring.  You don't

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Vend
On 30 Set, 03:01, RG wrote: > In article , >  Keith Thompson wrote: > > > > > RG writes: > > > In article , > > >  Keith Thompson wrote: > > > >> RG writes: > > >> > In article > > >> > <07f75df3-778d-4e3d-8aa0-fbd4bd108...@k22g2000prb.googlegroups.com>, > > >> >  Squeamizh wrote: > > >> >> O

Re: Re: Problems with wsgi Python3

2010-09-30 Thread hidura
I still receive nothing, here it's the code of the form maybe there it's the problem: name="input" target="hidden-frm"> On Sep 30, 2010 4:55pm, "Diez B. Roggisch" wrote: Thomas Jollans tho...@jollybox.de> writes: > On Thursday 30 September 2010, it occurred to hid...@gmail.com to

Re: namespace hacking question

2010-09-30 Thread alex23
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', 'ham', 'eggs'): >  

Having problem with subclass

2010-09-30 Thread tekion
All, I have file name A.py with a class name Aclass. I have a file name B.py with sub class of Aclass, like import A class Bclass(Aclass) ...rest of code When I test it, calling B.py, I am getting: class Bclas(Aclass): NameError: name 'Aclass' is not defined When I move Bclass to A.py, it works.

Re: Having problem with subclass

2010-09-30 Thread Chris Rebert
On Thu, Sep 30, 2010 at 6:54 PM, tekion wrote: > All, > I have file name A.py with a class name Aclass. I have a file name > B.py with sub class of Aclass, like > import A > class Bclass(Aclass) > ...rest of code > When I test it, calling B.py, I am getting: > > class Bclas(Aclass): > NameError: n

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Don Geddis
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 false claim that was made about it. > Can you cite the article that made this false claim, and exactly what > the false claim was? http://groups.google.

Re: Having problem with subclass

2010-09-30 Thread Tim Chase
On 09/30/10 20:54, tekion wrote: All, I have file name A.py with a class name Aclass. I have a file name B.py with sub class of Aclass, like import A class Bclass(Aclass) ...rest of code When I test it, calling B.py, I am getting: class Bclas(Aclass): NameError: name 'Aclass' is not defined Whe

discussion

2010-09-30 Thread Geo_subodh
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. -- http://mail.python.org/mailman/listinfo/python-list

Re: Having problem with subclass

2010-09-30 Thread Bruce Pearson
Try: import A class Bclass(A.Aclass) ...rest of code On 1/10/2010 9:54 AM, tekion wrote: All, I have file name A.py with a class name Aclass. I have a file name B.py with sub class of Aclass, like import A class Bclass(Aclass) ...rest of code When I test it, calling B.py, I am getting: class

Re: discussion

2010-09-30 Thread Roy Smith
In article <31a08825-bb72-4e9f-8710-a39fe2bc9...@u31g2000pru.googlegroups.com>, 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. What class is this for? -- http://mail.pyth

Re: "Strong typing vs. strong testing"

2010-09-30 Thread Seebs
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 third sentence is arguably

Re: discussion

2010-09-30 Thread Chris Rebert
On Thu, Sep 30, 2010 at 7:12 PM, 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. Do your own homework; it's not like you're even paying us (not that we would have the moral tu

Re: discussion

2010-09-30 Thread John Nagle
On 9/30/2010 7:12 PM, 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 ispalin(s) : s = str(s) n = len(s) / 2 return(s[:n] == s[::-1][:n]) Please use a message sub

Re: discussion

2010-09-30 Thread Paul Rubin
John Nagle writes: > def ispalin(s) : > s = str(s) > n = len(s) / 2 > return(s[:n] == s[::-1][:n]) def ispalin(s): return (s == "You betcha!") ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Re: Re: Problems with wsgi Python3

2010-09-30 Thread hidura
Ppl, thankyou Diez and Thomas for your answers i did it, but it present me a problem with the solution what you give me Thomas this is the code: ValueError: Invalid boundary in multipart form: '' On Sep 30, 2010 6:16pm, hid...@gmail.com wrote: I still receive nothing, here it's the code of the

Re: Re: Re: Re: Problems with wsgi Python3

2010-09-30 Thread hidura
Now, i' m sure that the system it's uploading the file but still it's give me empty the information. I am considerating 2 crazy solutions what i want to share with you for listen your opinions: 1) Consist in translate to Python2.5 the area what receives the request and execute the area what

Re: "Strong typing vs. strong testing"

2010-09-30 Thread RG
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 false claim that was made about it. > > Can you cite the article that made this

Re: "Strong typing vs. strong testing"

2010-09-30 Thread rustom
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 than in C/C++ -- its very hard

Re: "Strong typing vs. strong testing"

2010-09-30 Thread RG
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 function ???main???: > > fo

Re: discussion

2010-09-30 Thread Arnaud Delobelle
John Nagle writes: > On 9/30/2010 7:12 PM, 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 ispalin(s) : > s = str(s) > n = len(s) / 2 > return(s[:n] ==

Re: "Strong typing vs. strong testing"

2010-09-30 Thread TheFlyingDutchman
> >         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 sentence is arguably wrong, simply > because

Re: "Strong typing vs. strong testing"

2010-09-30 Thread TheFlyingDutchman
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 false claim that was made a

<    1   2