Re: reverse dict lookup & Relation class

2009-01-17 Thread Aaron Brady
On Jan 16, 5:03 am, Steven D'Aprano wrote: > On Wed, 14 Jan 2009 16:30:36 -0800, Aaron Brady wrote: > > Hi, this is a continuation of something that comes up now and again > > about reverse lookups on dictionaries, as well as a follow-up to my > > pursuit of a Relation class from earlier. > > [...

Re: multiprocessing question/error

2009-01-17 Thread Aaron Brady
On Jan 16, 11:39 pm, Eduardo Lenz wrote: > Hi, > > I was using the former processing package with python 2.5 with no problems. > After switching to python 2.6.1 I am having some problems with the same code. > The problem seems to be related to the fact that I am using Pool.map > with a bounded met

Pythonic way to handle coordinates

2009-01-17 Thread Pierre-Alain Dorange
Hi, I'm used python for 3 months now to develop small arcade games (with pygame module). I just got a question about coordinates handling. My games are in 2D so i deal with x,y coordinates for sprites (but woudl be the same u-issue in 3D). At the beginning i simply use x and y to pass to my metho

Re: English-like Python

2009-01-17 Thread Aaron Brady
On Jan 15, 7:02 pm, The Music Guy wrote: > Just out of curiousity, have there been any attempts to make a version > of Python that looks like actual English text? I mean, so much of Python > is already based on the English language that it seems like the next > natural step would be to make a prog

Re: FileCookieJar has not attribute "_self_load"

2009-01-17 Thread Dragos
On Jan 16, 9:19 pm, Dragos wrote: > I am trying to make a testing script to load/save cookies to a file > with FileCookieJar, but it results in this error: FileCookieJar has > not attribute "_self_load" > > This is my script: > > import urllib.request, urllib.parse,http.cookiejar > url="http://loc

Re: FileCookieJar has not attribute "_self_load"

2009-01-17 Thread Gabriel Genellina
En Fri, 16 Jan 2009 17:19:47 -0200, escribiste en el grupo gmane.comp.python.general I am trying to make a testing script to load/save cookies to a file with FileCookieJar, but it results in this error: FileCookieJar has not attribute "_self_load" FileCookieJar is an abstract class, although i

Re: Pythonic way to handle coordinates

2009-01-17 Thread The Music Guy
On Jan 17, 2:48 am, pdora...@pas-de-pub-merci.mac.com (Pierre-Alain Dorange) wrote: > Hi, > I'm used python for 3 months now to develop small arcade games (with > pygame module). > > I just got a question about coordinates handling. > My games are in 2D so i deal with x,y coordinates for sprites (b

Re: Finding the full path of an executable

2009-01-17 Thread Gabriel Genellina
En Fri, 16 Jan 2009 23:08:27 -0200, escribiste en el grupo gmane.comp.python.general Unknown wrote: On 2009-01-16, Michael Hoffman <9qobl2...@sneakemail.com> wrote: Is there a portable way to find the full path of a filename that would be called by os.execvp()? The correct answer would be "/

Re: vb2py status?

2009-01-17 Thread Vito De Tullio
axtens wrote: > So is vb2py dead? If not, any idea when it'll support python 3? I don't know this vb2py, but you can do a 2 pass conversion [vb] -> (vb2py) -> [py2] -> (2to3) -> [py3] -- By ZeD -- http://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing question/error

2009-01-17 Thread Eduardo Lenz
On Saturday 17 January 2009 00:43:35 Aaron Brady wrote: > On Jan 16, 11:39 pm, Eduardo Lenz wrote: > > Hi, > > > > I was using the former processing package with python 2.5 with no > > problems. After switching to python 2.6.1 I am having some problems with > > the same code. The problem seems to

Re: FileCookieJar has not attribute "_self_load"

2009-01-17 Thread Dragos
On Jan 17, 11:48 am, "Gabriel Genellina" wrote: > En Fri, 16 Jan 2009 17:19:47 -0200, escribiste en el grupo > gmane.comp.python.general > > > I am trying to make a testing script to load/save cookies to a file > > with FileCookieJar, but it results in this error: FileCookieJar has > > not attribu

Re: English-like Python

2009-01-17 Thread Kay Schluehr
On 16 Jan., 02:02, The Music Guy wrote: > Just out of curiousity, have there been any attempts to make a version > of Python that looks like actual English text? No, but I've once written a Python dialect that uses German text. Just look at how amazing this result is !!! But be warned it requires

Re: Python 2.6's multiprocessing lock not working on second use?

2009-01-17 Thread Gabriel Genellina
En Fri, 16 Jan 2009 14:41:21 -0200, escribiste en el grupo gmane.comp.python.general I ran a few tests on the new Python 2.6 multiprocessing module before migrating a threading code, and found out the locking code is not working well. In this case, a pool of 5 processes is running, each trying t

Re: multiprocessing question/error

2009-01-17 Thread Gabriel Genellina
En Sat, 17 Jan 2009 14:14:37 -0200, Eduardo Lenz escribió: Another question: is it possible to change a bound method to a function on the fly ? I was wondering if something like class.__dict__["function_name"] could do the job. Exactly. Or, if you already have the method, use its im_func

Re: Need help with os.system in linux

2009-01-17 Thread Thomas Bellman
akshay bhat writes: > i am calling a program using os.system in python on Linux. > However in i found that program being executed and soon returned 256. > but when i ran it using terminal i got proper results. Under Linux (but unfortunately not generally under Unix), you can interpret return cod

Re: Python Startup file

2009-01-17 Thread Gabriel Genellina
En Sat, 17 Jan 2009 02:23:40 -0200, Gary Smith escribió: I've never been able to get ActiveState Python's PythonWin to observe the file referenced in the Windows PYTHONSTARTUP environment variable. Many thanks for pointing out the obvious to me AFAIK, PythonWin doesn't honor the PYTHONSTAR

Re: FileCookieJar has not attribute "_self_load"

2009-01-17 Thread Gabriel Genellina
En Sat, 17 Jan 2009 08:16:14 -0200, Dragos escribió: On Jan 17, 11:48 am, "Gabriel Genellina" wrote: En Fri, 16 Jan 2009 17:19:47 -0200, escribiste en el grupo gmane.comp.python.general > I am trying to make a testing script to load/save cookies to a file > with FileCookieJar, but it resul

Re: Pythonic way to handle coordinates

2009-01-17 Thread James Stroud
Pierre-Alain Dorange wrote: What is the elegant way to handle coordinates ? Do i need to continue using tuples or do i need to write a Point class. I feel a point class would be nice, because i could implement operators with it ? But i think Point class must exist allready ? My instinctive adv

Re: Pythonic way to handle coordinates

2009-01-17 Thread andrew cooke
although james's idea is quite neat (especially the idea of heritable classes), my initial reaction was that it's too over-engineered. so here's a different approach. there are two "tricks" that can help make using tuples easier: (1) unpacking the return value. (x, y) = returns_a_point() x +

Re: FileCookieJar has not attribute "_self_load"

2009-01-17 Thread Dragos
On Jan 17, 1:33 pm, "Gabriel Genellina" wrote: > En Sat, 17 Jan 2009 08:16:14 -0200, Dragos   > escribió: > > > > > On Jan 17, 11:48 am, "Gabriel Genellina" > > wrote: > >> En Fri, 16 Jan 2009 17:19:47 -0200, escribiste en el grupo > >> gmane.comp.python.general > > >> > I am trying to make a te

Re: *Advanced* Python book?

2009-01-17 Thread Luis M . González
On Jan 16, 5:27 pm, mk wrote: > Hello everyone, > > I looked for it I swear, but just can't find it. > > Most Python books seem to focus on examples of how to call functions > from standard library. I don't need that, I have online Python > documentation for that. > > I mean really advanced mental

Re: English-like Python

2009-01-17 Thread Dotan Cohen
2009/1/17 Kay Schluehr : > On 16 Jan., 02:02, The Music Guy wrote: >> Just out of curiousity, have there been any attempts to make a version >> of Python that looks like actual English text? > > No, but I've once written a Python dialect that uses German text. Just > look at how amazing this resul

Re: LGPL license for Qt 4.5

2009-01-17 Thread Ville Vainio
On Jan 14, 2:57 pm, sturlamolden wrote: > According to a Norwegian publication, Nokia will release Qt under LGPL > as of version 4.5. > > If I had stocks in Riverbank Computing ltd., I would sell them now... Isn't that a tad thankless and premature? It may be that the "support" aspect needs to

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-17 Thread mario ruggier
On Jan 17, 12:04 am, ajaksu wrote: > On Jan 16, 3:45 pm, mario ruggier wrote: > > > > '(x for x in ()).throw("bork")' > > > What is the potential security risk with this one? > > I don't see a concrete issue, just found it tempting... raising hand- > crafted objects :) OK, I can think of no good

Re: Totally confused by the str/bytes/unicode differences introduced in Pythyon 3.x

2009-01-17 Thread Giampaolo Rodola'
On 17 Gen, 05:26, John Machin wrote: > On Jan 17, 3:08 pm, Steve Holden wrote: > > > Giampaolo Rodola' wrote: > > > On 17 Gen, 04:43, Terry Reedy wrote: > > >> Giampaolo Rodola' wrote: > > >>> That would help to avoid replacing "" with b"" almost everywhere in my > > >>> code. > > >> Won't 2to3

Re: Noob question: Is all this typecasting normal?

2009-01-17 Thread Aahz
[following up late] In article <2b3c916e-6908-4b12-933f-8f7bfa86c...@i20g2000prf.googlegroups.com>, Russ P. wrote: > >Fair enough, but for code that is not intended for general public >usage (i.e., most code) so-called camelCase is every bit as good if >not better than using underscores to divide

Re: vb2py status?

2009-01-17 Thread Giampaolo Rodola'
On 17 Gen, 11:05, Vito De Tullio wrote: > axtens wrote: > > So is vb2py dead? If not, any idea when it'll support python 3? > > I don't know this vb2py, but you can do a 2 pass conversion > > [vb] -> (vb2py) -> [py2] -> (2to3) -> [py3] > > -- > By ZeD ...and presumibly get something which doesn't

Re: LGPL license for Qt 4.5

2009-01-17 Thread eliben
On Jan 14, 2:57 pm, sturlamolden wrote: > According to a Norwegian publication, Nokia will release Qt under LGPL > as of version 4.5. > > If I had stocks in Riverbank Computing ltd., I would sell them now... > Unlikely... The switch of Qt to LGPL will almost certainly vastly increase the Qt user

Re: Totally confused by the str/bytes/unicode differences introduced in Pythyon 3.x

2009-01-17 Thread Martin v. Löwis
>> Does he intend to maintain two separate codebases, one 2.x and the >> other 3.x? > > I think I have no other choice. > Why? Is theoretically possible to maintain an unique code base for > both 2.x and 3.x? That is certainly possible! One might have to make tradeoffs wrt. readability sometimes,

Re: pep-8 vs. external interfaces?

2009-01-17 Thread Aahz
In article <27c6b149-3a5f-478d-a6fc-da87a66b9...@r36g2000prf.googlegroups.com>, Carl Banks wrote: >On Jan 4, 1:47=A0pm, Roy Smith wrote: >> >> Or, I could draw a line in the sand and say, "If it's a protocol >> primitive, it stays as written. =A0Otherwise, it's pep-8". =A0That's a >> little ugli

Re: braces fixed '#{' and '#}'

2009-01-17 Thread Roy Smith
In article <6264e675-ddd4-446a-822a-cc82e8f87...@w1g2000prk.googlegroups.com>, v4vijayakumar wrote: > I saw some code where someone is really managed to import braces from > __future__. ;) > > def test(): > #{ > print "hello" > #} That usage is obsolete. Current best practice is: def

Re: braces fixed '#{' and '#}'

2009-01-17 Thread Steve Holden
Roy Smith wrote: > In article > <6264e675-ddd4-446a-822a-cc82e8f87...@w1g2000prk.googlegroups.com>, > v4vijayakumar wrote: > >> I saw some code where someone is really managed to import braces from >> __future__. ;) >> >> def test(): >> #{ >> print "hello" >> #} > > That usage is obsolete

tp_base, ob_type, and tp_bases

2009-01-17 Thread Jeff McNeil
Hi all, In an effort to get (much) better at writing Python code, I've been trying to follow and document what the interpreter does from main in Modules/python.c up through the execution of byte code. Mostly for my own consumption and benefit, but I may blog it if it turns out half way decent. An

Pyro deadlock

2009-01-17 Thread MatthewS
I'd like to know if the following behavior is expected and can be avoided: I have a Pyro server object that maintains a queue of work, and multiple Pyro worker objects that take work off the queue by calling a method on the server (get_work) and then return the work to the server by calling another

Re: vb2py status?

2009-01-17 Thread Vito De Tullio
Giampaolo Rodola' wrote: >> > So is vb2py dead? If not, any idea when it'll support python 3? >> I don't know this vb2py, but you can do a 2 pass conversion >> [vb] -> (vb2py) -> [py2] -> (2to3) -> [py3] > ...and presumibly get something which doesn't work at all. =) why? AFAIK there aren't probl

Re: tp_base, ob_type, and tp_bases

2009-01-17 Thread Martin v. Löwis
> So, the documentation states that ob_type is a pointer to the type's > type, or metatype. Rather, this is a pointer to the new type's > metaclass? That's actually the same. *Every* ob_type field points to the object's type, e.g. for strings, integers, tuples, etc. That includes type objects, whe

Re: tp_base, ob_type, and tp_bases

2009-01-17 Thread Jeff McNeil
On Jan 17, 10:50 am, "Martin v. Löwis" wrote: > > So, the documentation states that ob_type is a pointer to the type's > > type, or metatype. Rather, this is a pointer to the new type's > > metaclass? > > That's actually the same. *Every* ob_type field points to the object's > type, e.g. for strin

Re: tp_base, ob_type, and tp_bases

2009-01-17 Thread Jeff McNeil
On Jan 17, 11:09 am, Jeff McNeil wrote: > On Jan 17, 10:50 am, "Martin v. Löwis" wrote: > > > > > > So, the documentation states that ob_type is a pointer to the type's > > > type, or metatype. Rather, this is a pointer to the new type's > > > metaclass? > > > That's actually the same. *Every* ob

Re: vb2py status?

2009-01-17 Thread Fuzzyman
On Jan 17, 3:52 pm, Vito De Tullio wrote: > Giampaolo Rodola' wrote: > >> > So is vb2py dead? If not, any idea when it'll support python 3? > >> I don't know this vb2py, but you can do a 2 pass conversion > >> [vb] -> (vb2py) -> [py2] -> (2to3) -> [py3] > > ...and presumibly get something which do

Re: tuple methods: documentation missing

2009-01-17 Thread Alan G Isaac
On 1/16/2009 6:44 PM Terry Reedy apparently wrote: http://bugs.python.org/issue4966 Is this another lacuna or am I overlooking it? I cannot find the 3.0 documentation of string formatting with the ``%`` operator. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: reverse dict lookup & Relation class

2009-01-17 Thread Steven D'Aprano
On Sat, 17 Jan 2009 00:24:21 -0800, Aaron Brady wrote: > Can you make it work for a 3-way lookup? What do you mean "3-way lookup"? I'm going to take a guess... A maps to B, B maps to C, and C maps to A. Is that what you mean? -- Steven -- http://mail.python.org/mailman/listinfo/python-lis

Re: Noob question: Is all this typecasting normal?

2009-01-17 Thread Steven D'Aprano
On Sat, 17 Jan 2009 06:09:29 -0800, Aahz wrote: > You are missing the point: suppose you write a useful library in your > air traffic management application, maybe one that does a good job of > handling user input. If you have done a proper job of abstracting it > from your application as a whole

Re: List comprehension - NameError: name '_[1]' is not defined ?

2009-01-17 Thread mario ruggier
Just to add that a further potential subversion possibility could have been to build the expr in some way from within a template, and then dynamically setting that string as the source of a new template with from_string=True. This is precisely the reason why **from within a template** evoque has ne

Re: reading file to list

2009-01-17 Thread Xah Lee
comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby Here's a interesting toy problem posted by Drew Krause to comp.lang.lisp: On Jan 16, 2:29 pm, Drew Krause wrote [paraphrased a bit]: OK, I want to create a nested list in Lisp (always of

Re: Noob question: Is all this typecasting normal?

2009-01-17 Thread Tim Rowe
2009/1/3 Russ P. : > So unless you think the standard library will someday include code for > air traffic management, I'll stick with camelCase, and I'll thank you > for not making an issue of it. Another late comment, sorry, but as an air traffic management safety consultant, I'm quite intereste

Re: figuring week of the day....

2009-01-17 Thread tekion
On Jan 9, 6:05 am, Tim Chase wrote: > Tim Chase wrote: > > tekion wrote: > >> Is there a module where you could figure week of the day, like where > >> it starts and end. I need to do this for a whole year. Thanks. > > > the monthcalendar() call returns the whole month's calendar which > > may be

Re: reading file to list

2009-01-17 Thread Tino Wildenhain
Xah Lee wrote: comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby ... OK, I want to create a nested list in Lisp (always of only integers) from a text file, such that each line in the text file would be represented as a sublist in the 'imported' list. example

Re: reading file to list

2009-01-17 Thread Xah Lee
On Jan 17, 9:16 am, Xah Lee wrote: > Here's a interesting toy problem posted by Drew Krause to > comp.lang.lisp: > ... The code in my previous elisp code got a bump. It should be: (defun read-lines (file) "Return a list of lines in FILE." (with-temp-buffer (insert-file-contents file)

Re: reading file to list

2009-01-17 Thread MRAB
Tino Wildenhain wrote: Xah Lee wrote: comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby ... OK, I want to create a nested list in Lisp (always of only integers) from a text file, such that each line in the text file would be represented as a sublist in the

Jerry Pournelle gives award to Python and Guido for 2008

2009-01-17 Thread Richard Hanson
[NB: Blatant Python advocacy (and OP self-promotion).] Jerry Pournelle commends Python and Guido in "The Annual Orchid and Onions Parade" portion of his Chaos Manor Reviews column: > A reader [full-disclosure: that reader was me] nomina

psycopg2 weirdness

2009-01-17 Thread Neha Gupta
Hey, I only have little experience with web.py and psycopg2 and am running into a weird problem, I'd appreciate any help I can get with debugging it. I wrote a simple program that works and I don't see any crash: import psycopg2 try: database_conn = psycopg2.connect("dbname='dbname'

Re: reading file to list

2009-01-17 Thread Xah Lee
On Jan 17, 9:34 am, Xah Lee wrote: > The code in my previous elisp code got a bump. It should be: > ... > • A Ruby Illustration of Lisp Problems > http://xahlee.org/UnixResource_dir/writ/lisp_problems_by_ruby.html Sorry again. More correction: (defun read-lines (file) "Return a list of lines

Re: reading file to list

2009-01-17 Thread Tino Wildenhain
MRAB wrote: Tino Wildenhain wrote: Xah Lee wrote: comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby ... OK, I want to create a nested list in Lisp (always of only integers) from a text file, such that each line in the text file would be represented as a s

python3.0 base64 error

2009-01-17 Thread yang michael
I use base64 module on python3.0 like: import base64 b="hello world" a=base64.b64encode(b) print(a) but when i run it,it catch a error: Traceback (most recent call last): File "/home/jackie-yang/yd5m19/pythonstudy/test.py", line 4, in a=base64.b64encode(b) File "/usr/local/lib/python3.0/

Re: psycopg2 weirdness

2009-01-17 Thread Tino Wildenhain
Neha Gupta wrote: Hey, ... crs_dep_hour, origin from flightdata where date = '" + date + "' group ^^^ never ever do that! Even more when input comes from user. The correct form is cur.exec("... date = %s group by ...",(date,)) ple

Re: psycopg2 weirdness

2009-01-17 Thread Philip Semanchuk
On Jan 17, 2009, at 12:48 PM, Neha Gupta wrote: Hey, I only have little experience with web.py and psycopg2 and am running into a weird problem, I'd appreciate any help I can get with debugging it. Hi Neha, There's a lot of pieces involved here and your subject implies you've isolated the

Re: python3.0 base64 error

2009-01-17 Thread MRAB
yang michael wrote: I use base64 module on python3.0 like: import base64 b="hello world" Try: b = b"hello world" instead. a=base64.b64encode(b) print(a) but when i run it,it catch a error: Traceback (most recent call last): File "/home/jackie-yang/yd5m19/pythonstudy/test.py", line 4

import urllib2 fails with Python 2.6.1 on Vista

2009-01-17 Thread Scott MacDonald
I googled a bit this morning search for an answer to this problem but have come up empty so far. Can anyone help? Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import urllib2 Traceba

Python 3: exec arg 1

2009-01-17 Thread Alan G Isaac
In Python 3, you can no longer ``exec(open(filename))``. I guess the reason is that in 3.0 ``open`` returns a stream, instead of open file, and exec wants "a string, bytes, or code object" and not a "TextIOWrapper". So it returns an error. Is it intentional that ``exec`` cannot handle a TextIOWr

Re: English-like Python

2009-01-17 Thread Tim Rowe
2009/1/16 has : > http://www.alice.org/ Ooh, "JavaLikeSyntax.py" indeed! Why not "PythonLikeSyntax", since that's apparently what they used! -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: braces fixed '#{' and '#}'

2009-01-17 Thread Roy Smith
In article , Steve Holden wrote: > Roy Smith wrote: > > In article > > <6264e675-ddd4-446a-822a-cc82e8f87...@w1g2000prk.googlegroups.com>, > > v4vijayakumar wrote: > > > >> I saw some code where someone is really managed to import braces from > >> __future__. ;) > >> > >> def test(): > >> #{

Re: braces fixed '#{' and '#}'

2009-01-17 Thread Martin P. Hellwig
Roy Smith wrote: In article , Steve Holden wrote: Roy Smith wrote: In article <6264e675-ddd4-446a-822a-cc82e8f87...@w1g2000prk.googlegroups.com>, v4vijayakumar wrote: I saw some code where someone is really managed to import braces from __future__. ;) def test(): #{ print "hell

Re: s=ascii(hexlify(urandom(10)))

2009-01-17 Thread Martin v. Löwis
> I expected that py3 did not converted the b'...' indication too ? > > b'afc76815e3fc429fa9d7' You mean, just because you invoked the ascii() builtin, the b prefix should disappear? Re-read the documentation of the ascii() builtin - it probably does something completely different from what you e

Socket issues

2009-01-17 Thread twistedduck9
Hi all I've been trying to set up sockets on my server (running Apache/2.2.3) using python and I'm confused as to why it doesn't work. I set up a simple listening script which runs without error, and works if a connecting script is run on the same server. However, if I try to connect using Telnet

Re: reading file to list

2009-01-17 Thread André Thieme
Xah Lee schrieb: comp.lang.lisp,comp.lang.scheme,comp.lang.functional,comp.lang.python,comp.lang.ruby Here's a interesting toy problem posted by Drew Krause to comp.lang.lisp: On Jan 16, 2:29 pm, Drew Krause wrote [paraphrased a bit]: OK, I want to create a nested list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-17 Thread Bruno Desthuilliers
Russ P. a écrit : On Jan 15, 12:21 pm, Bruno Desthuilliers wrote: Once again, the important point is that there's a *clear* distinction between interface and implementation, and that you *shouldn't* mess with implementation. If you "*shouldn't* mess with the implementation", then what is wro

Re: tuple methods: documentation missing

2009-01-17 Thread Ned Deily
In article <8rncl.212$aw2@nwrddc02.gnilink.net>, Alan G Isaac wrote: > Is this another lacuna or am I overlooking it? > I cannot find the 3.0 documentation of string > formatting with the ``%`` operator. --

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-17 Thread Bruno Desthuilliers
Russ P. a écrit : On Jan 16, 5:22 am, Steve Holden wrote: Russ P. wrote: [...] I spent *way* too much time on that post. I really need to quit spending my time refuting the baloney that passes for wisdom here. He who cannot ignore baloney is doomed to refute it. Yeah, and I should reall

Re: Socket issues

2009-01-17 Thread Gary M. Josack
twistedduck9 wrote: Hi all I've been trying to set up sockets on my server (running Apache/2.2.3) using python and I'm confused as to why it doesn't work. I set up a simple listening script which runs without error, and works if a connecting script is run on the same server. However, if I try t

Re: Socket issues

2009-01-17 Thread twistedduck9
My hosting provider (Streamline) have said that there is no firewall (it's a dedicated server). Either way the code I'm using is: Listening socket: import socket mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mysock.bind (('79.99.43.58', 2727)) mysock.listen(1) while True: channel,

Re: Python 3: exec arg 1

2009-01-17 Thread Terry Reedy
Alan G Isaac wrote: In Python 3, you can no longer ``exec(open(filename))``. I guess the reason is that in 3.0 ``open`` returns a stream, instead of open file, and exec wants "a string, bytes, or code object" and not a "TextIOWrapper". So it returns an error. Is it intentional that ``exec`` can

process command line parameter

2009-01-17 Thread asit
Recently I was coding a link extractor. It's a command line stuff and takes parameter as argument. I found that the in operator is not always helpful. eg. if "--all" in sys.argv: print "all links will be printed" its not helpful when some attribute value is sent in command line paramete

Re: Socket issues

2009-01-17 Thread Jeff McNeil
On Jan 17, 4:11 pm, twistedduck9 wrote: > My hosting provider (Streamline) have said that there is no firewall > (it's a dedicated server). Either way the code I'm using is: > > Listening socket: > import socket > mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > mysock.bind (('79.99.43

Re: s=ascii(hexlify(urandom(10)))

2009-01-17 Thread gert
On Jan 17, 9:08 pm, "Martin v. Löwis" wrote: > > I expected that py3 did not converted the b'...' indication too ? > > > b'afc76815e3fc429fa9d7' > > You mean, just because you invoked the ascii() builtin, the b > prefix should disappear? Re-read the documentation of the > ascii() builtin - it prob

Re: python3.0 base64 error

2009-01-17 Thread Terry Reedy
yang michael wrote: I use base64 module on python3.0 like: import base64 b="hello world" a=base64.b64encode(b) print(a) but when i run it,it catch a error: Traceback (most recent call last): File "/home/jackie-yang/yd5m19/pythonstudy/test.py", line 4, in a=base64.b64encode(b) File "/us

Re: process command line parameter

2009-01-17 Thread Cameron Simpson
On 17Jan2009 13:28, asit wrote: | Recently I was coding a link extractor. It's a command line stuff and | takes parameter as argument. | I found that the in operator is not always helpful. | eg. if "--all" in sys.argv: |print "all links will be printed" Indeed. While I can't speak for

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-17 Thread Paul Rubin
Bruno Desthuilliers writes: > Once again, there's quite a lot to learn from > the story of Ariane 5. Do you know what actually happened with Ariane 5? The failure was because "smart" humans overrode the language enforced protection by casting a floating point number down to a 16-bit integer, whi

Re: Jerry Pournelle gives award to Python and Guido for 2008

2009-01-17 Thread Terry Reedy
Richard Hanson wrote: [NB: Blatant Python advocacy (and OP self-promotion).] Jerry Pournelle commends Python and Guido in "The Annual Orchid and Onions Parade" portion of his Chaos Manor Reviews column: A reader [full-disclosure: t

Re: Socket issues

2009-01-17 Thread twistedduck9
On 17 Jan, 21:32, Jeff McNeil wrote: > On Jan 17, 4:11 pm, twistedduck9 > wrote: > > > > > My hosting provider (Streamline) have said that there is no firewall > > (it's a dedicated server). Either way the code I'm using is: > > > Listening socket: > > import socket > > mysock = socket.socket(soc

Re: tp_base, ob_type, and tp_bases

2009-01-17 Thread Terry Reedy
Martin v. Löwis wrote: So, the documentation states that ob_type is a pointer to the type's Next, we have tp_base. That's defined as "an optional pointer to a base type from which type properties are inherited." The value of tp_base is then added to the tp_bases tuple. This is confusing me.

Re: Python 3: exec arg 1

2009-01-17 Thread Alan G Isaac
Alan G Isaac wrote: Is it intentional that ``exec`` cannot handle a TextIOWrapper? Bottom line: has ``execfile(filename)`` really become ``exec(open(filename).read())``? Is this a good thing? On 1/17/2009 4:20 PM Terry Reedy apparently wrote: Yes. Yes. OK. Why? Alan Isaac -- http://ma

Windows Tablet RealTimeStylus in Python

2009-01-17 Thread Damon
I have a Windows Tablet machine, running XP Tablet Edition, and I want to access the stylus data from Python. If anyone has done this themselves, I'd be very grateful for a description of what worked. Otherwise, I'd be grateful for advice. I'm in way over my head, so what I describe below is prob

Re: Totally confused by the str/bytes/unicode differences introduced in Pythyon 3.x

2009-01-17 Thread Terry Reedy
Martin v. Löwis wrote: Does he intend to maintain two separate codebases, one 2.x and the other 3.x? I think I have no other choice. Why? Is theoretically possible to maintain an unique code base for both 2.x and 3.x? That is certainly possible! One might have to make tradeoffs wrt. readabilit

Re: tp_base, ob_type, and tp_bases

2009-01-17 Thread Ned Deily
In article , Terry Reedy wrote: > Martin v. Löwis wrote: > > (I don't understand the English "one in the same" - interpreting it > > as "as though they should be the same") > Martin, you are not alone! I do not really understand that either. It's a non-standard reshaping of the idiom "one and th

Re: Incorrect title case?

2009-01-17 Thread Terry Reedy
John Machin wrote: On Jan 17, 9:07 am, MRAB wrote: Python 2.6.1 I've just found that the following 4 Unicode characters/codepoints don't behave as I'd expect: Dž (U+01C5), Lj (U+01C8), Nj (U+01CB), Dz (U+01F2). For example, u"\u01C5".istitle() returns True and unicodedata.category(u"\u01C5") retu

Re: Incorrect title case?

2009-01-17 Thread MRAB
Terry Reedy wrote: John Machin wrote: On Jan 17, 9:07 am, MRAB wrote: Python 2.6.1 I've just found that the following 4 Unicode characters/codepoints don't behave as I'd expect: Dž (U+01C5), Lj (U+01C8), Nj (U+01CB), Dz (U+01F2). For example, u"\u01C5".istitle() returns True and unicodedata.cate

Re: s=ascii(hexlify(urandom(10)))

2009-01-17 Thread Martin v. Löwis
gert wrote: > On Jan 17, 9:08 pm, "Martin v. Löwis" wrote: >>> I expected that py3 did not converted the b'...' indication too ? >>> b'afc76815e3fc429fa9d7' >> You mean, just because you invoked the ascii() builtin, the b >> prefix should disappear? Re-read the documentation of the >> ascii() buil

Re: s=ascii(hexlify(urandom(10)))

2009-01-17 Thread gert
On Jan 18, 12:05 am, "Martin v. Löwis" wrote: > gert wrote: > > On Jan 17, 9:08 pm, "Martin v. Löwis" wrote: > >>> I expected that py3 did not converted the b'...' indication too ? > >>> b'afc76815e3fc429fa9d7' > >> You mean, just because you invoked the ascii() builtin, the b > >> prefix should

Re: s=ascii(hexlify(urandom(10)))

2009-01-17 Thread Pierre-Alain Dorange
"Martin v. Löwis" wrote: > > On Jan 17, 9:08 pm, "Martin v. Löwis" wrote: > >>> I expected that py3 did not converted the b'...' indication too ? > >>> b'afc76815e3fc429fa9d7' > >> You mean, just because you invoked the ascii() builtin, the b > >> prefix should disappear? Re-read the documentati

Re: Incorrect title case?

2009-01-17 Thread Martin v. Löwis
> A value of zero for ctype->title should be interpreted simply as the > offset to add to the ordinal, as it is in the sibling _PyUnicode_To > (Upper|Lower)case functions. Interestingly enough, according to the spec of UnicodeData.txt, these should *not* be siblings. Refer to http://www.unicode.

Re: s=ascii(hexlify(urandom(10)))

2009-01-17 Thread Martin v. Löwis
>>> s = str(hexlify(urandom(8)))[2:18] >> And your question is? > > No question just solution to get rit of b'' :) Ah. hexlify(urandom(8)).decode('ascii') Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: s=ascii(hexlify(urandom(10)))

2009-01-17 Thread gert
On Jan 18, 12:20 am, "Martin v. Löwis" wrote: > >>> s = str(hexlify(urandom(8)))[2:18] > >> And your question is? > > > No question just solution to get rit of b'' :) > > Ah. hexlify(urandom(8)).decode('ascii') Ok that one looks better then mine :) -- http://mail.python.org/mailman/listinfo/pytho

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-17 Thread Russ P.
No one ever claimed that a programming language, no matter how rigorous, can eliminate all bugs. All a language can do is to reduce their rate of occurrence. The Ariane fiasco was not a failure of Ada per se but rather a failure of people using Ada. They attempted to re-use software written for on

Re: what's the point of rpython?

2009-01-17 Thread Brendan Miller
>> The goals of the pypy project seems to be to create a fast python >> implementation. I may be wrong about this, as the goals seem a little >> amorphous if you look at their home page. > > The home page itself is ambiguous, and does oversell the performance > aspect. The *actual* goal as outlined

Re: Windows Tablet RealTimeStylus in Python

2009-01-17 Thread M�ta-MCI (MVP)
Hi! I use Internet-Explorer like (as?) GUI. Then, I insert Active-X components (from Tablet-PC, native or SDK). Another solution: create a .HTA, and use PythonScript (version "ActiveScripting" of Python, who become with pyWin32). @-salutations -- Michel Claveau -- http://mail.python.org/ma

Re: reading file to list

2009-01-17 Thread Xah Lee
Xah Lee wrote: > • A Ruby Illustration of Lisp Problems > http://xahlee.org/UnixResource_dir/writ/lisp_problems_by_ruby.html On Jan 17, 12:30 pm, André Thieme wrote: > In the Lisp style Clojure for example one does exactly the same as > Jillian James (JJ) did in Ruby: > (map #(map (fn [s] (I

Re: Incorrect title case?

2009-01-17 Thread John Machin
On Jan 18, 10:15 am, "Martin v. Löwis" wrote: > > A value of zero for ctype->title should be interpreted simply as the > > offset to add to the ordinal, as it is in the sibling _PyUnicode_To > > (Upper|Lower)case functions. > > Interestingly enough, according to the spec of UnicodeData.txt, > thes

Re: Possible bug in Tkinter - Python 2.6

2009-01-17 Thread José Matos
On Friday 16 January 2009 09:47:36 Eric Brunel wrote: > What do you mean by 'works'...? The usual meaning, I think. :-) Click "Yes" and the program prints True, click "No" and the programs prints "False". > You don't have the problem? It doesn't   > change a thing for me... Notice that I am ru

A java hobbyist programmer learning python

2009-01-17 Thread elhombre
Hello, below is my first fragment of working python code. As you can see it is very java like as that is all I know. Is this the right approach to be taking? Should I be taking a different approach? Thanks in advance. import sys class Calculator(): def __init__(self): self.operator

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-17 Thread Russ P.
On Jan 17, 11:49 am, Bruno Desthuilliers wrote: > Please educate yourself and learn about why Ariane 5 crashed on it's > first flight, due to an error in a module written in ADA (which is such > a psychorigid language that C++ and Java are even looser than Javascript > in comparison). Perhaps wil

  1   2   >