Re: Using try-catch to handle multiple possible file types?

2013-11-18 Thread Amit Saha
On Tue, Nov 19, 2013 at 5:13 PM, Victor Hooi wrote: > Hi, > > I have a script that needs to handle input files of different types > (uncompressed, gzipped etc.). > > My question is regarding how I should handle the different cases. > > My first thought was to use a try-catch block and attempt to

Re: Using try-catch to handle multiple possible file types?

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 6:13 PM, Victor Hooi wrote: > My first thought was to use a try-catch block and attempt to open it using > the most common filetype, then if that failed, try the next most common type > etc. before finally erroring out. > > So basically, using exception handling for flow-

Re: Oh look, another language (ceylon)

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 6:00 PM, Steven D'Aprano wrote: >> py> "a" * "4" >> '' >> >> Okay, that makes sense, but what about: >> >> py> "a" * "" >> >> That will haunt your nightmares! > > You're easily terrified if you have nightmares about that. I can't > imagine what you would

Using try-catch to handle multiple possible file types?

2013-11-18 Thread Victor Hooi
Hi, I have a script that needs to handle input files of different types (uncompressed, gzipped etc.). My question is regarding how I should handle the different cases. My first thought was to use a try-catch block and attempt to open it using the most common filetype, then if that failed, try

Re: HTTP Header Capitalization in urllib.request.AbstractHTTPHandler (Python 3.3)

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 1:25 AM, Logan Owen wrote: > Hello everyone, > > I was hoping for some advice in dealing with an edge case related to > Python's HTTP Header handling. Python is correctly assuming that the > HTTP header field name (eg Content-Type) is case insensitive, but I have > a webse

Re: Automation

2013-11-18 Thread Steven D'Aprano
On Tue, 19 Nov 2013 19:23:11 +1300, Gregory Ewing wrote: > Neil Cerutti wrote: >> Written English probably changes much slower than spoken English, and >> we have the curmudgeon's to thank. > > The curmudgeon's what? :-) The curmudgeon's cudgel of course. *wack* "Will you speak proper now or wo

Re: Why do only callable objects get a __name__?

2013-11-18 Thread Steven D'Aprano
On Mon, 18 Nov 2013 22:36:34 -0800, John Ladasky wrote: > I just had a look at the namedtuple source code. Part of my conceptual > problem stems from the fact that namedtuple() is what I think people > call a "class factory" function, rather than a proper class constructor. > I'll read through t

Re: Oh look, another language (ceylon)

2013-11-18 Thread Steven D'Aprano
On Mon, 18 Nov 2013 19:33:01 -0800, Rick Johnson wrote: > I've never *really* been crazy about the plus operator concatenating > strings anyhow, however, the semantics of "+" seem to navigate the > "perilous waters of intuition" far better than "*". > > Addition of numeric types is well defin

[RELEASED] Python 3.3.3 final

2013-11-18 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I'm very happy to announce the release of Python 3.3.3. Python 3.3.3 includes several security fixes and over 150 bug fixes compared to the Python 3.3.2 release. Importantly, a security bug in CGIHTTPServer wa

Re: Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
Thanks for your replies, Steven. Between this post and your other post, you wrote a lot. On Monday, November 18, 2013 3:21:15 PM UTC-8, Steven D'Aprano wrote (and I quote, edited, and sometimes out of order): > So if you have any > thought that "the name of an object" should be the name of th

Re: Cannot connect to Mysql database

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 5:26 PM, Himanshu Garg wrote: > I did: > > import MySQLdb as mdb > from MySQLdb import * > from MySQLdb.constants import * > > and now it works. Thanks! again Looks good! Glad it works. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Cannot connect to Mysql database

2013-11-18 Thread Himanshu Garg
I did: import MySQLdb as mdb from MySQLdb import * from MySQLdb.constants import * and now it works. Thanks! again -- https://mail.python.org/mailman/listinfo/python-list

Re: Automation

2013-11-18 Thread Gregory Ewing
Neil Cerutti wrote: Written English probably changes much slower than spoken English, and we have the curmudgeon's to thank. The curmudgeon's what? :-) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
On Monday, November 18, 2013 3:37:03 PM UTC-8, Steven D'Aprano wrote: > On Mon, 18 Nov 2013 13:02:26 -0800, John Ladasky wrote: > > > I am implementing a state machine. The outputs of the various states in > > the machine have variable contents. I started by making dictionaries > > for each stat

Re: Cannot connect to Mysql database

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 5:10 PM, Chris Angelico wrote: > For a guess, I would try: > > import MySQLdb.connections > > above your chroot, and see if that helps. And possibly also converters, cursors, release, times, and maybe constants. I just peeked at the MySQLdb source code to see what's in the

Re: Cannot connect to Mysql database

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 5:03 PM, Himanshu Garg wrote: > I have written the script as: > > import os > import MySQLdb as mdb > > os.chroot("/lxc/rootfs") > os.chdir("/") > con = mdb.connect(host="192.168.1.7", user="root", passwd="password") > print "opened" > con.close() > > But when I execute, I

Cannot connect to Mysql database

2013-11-18 Thread Himanshu Garg
I have written the script as: import os import MySQLdb as mdb os.chroot("/lxc/rootfs") os.chdir("/") con = mdb.connect(host="192.168.1.7", user="root", passwd="password") print "opened" con.close() But when I execute, I get the following error: "File "/usr/lib/python2.7/dist-packages/MySQLdb/__

Re: [Python-ideas] Unicode stdin/stdout

2013-11-18 Thread Andrew Barnert
From: "random...@fastmail.us" > On Mon, Nov 18, 2013, at 7:33, Robin Becker wrote: >> UTF-8 stuff > > This doesn't really solve the issue I was referring to, which is that > windows _console_ (i.e. not redirected file or pipe) I/O can only > support unicode via wide character (UTF-16) I/O wit

Re: Python Beginner

2013-11-18 Thread Gregory Ewing
On Monday, November 18, 2013 5:42:22 AM UTC+1, Terry Reedy wrote: On 11/17/2013 11:02 PM, ngangsia akumbo wrote: We don't even have a University that offer a full flesh computer science course The phrase you are looking for is 'full-fledged'. He might have meant "fully fleshed-out", i.e.

Re: Glade Survey

2013-11-18 Thread Gene Heskett
On Monday 18 November 2013 20:43:24 Chris Angelico did opine: > On Tue, Nov 19, 2013 at 8:04 AM, Gene Heskett wrote: > > On Monday 18 November 2013 16:04:14 Juan Pablo Ugarte did opine: > >> Hello everybody! > >> > >> We (Glade Developers) are conducting a user survey which will help us > >> tak

Re: Glade Survey

2013-11-18 Thread Juan Pablo Ugarte
On Mon, 2013-11-18 at 16:04 -0500, Gene Heskett wrote: > On Monday 18 November 2013 16:04:14 Juan Pablo Ugarte did opine: > > > Hello everybody! > > > > We (Glade Developers) are conducting a user survey which will help us > > take informed decisions to improve the overall developer experience. >

Re: grammar (was Re: Automation)

2013-11-18 Thread Mark Lawrence
On 16/11/2013 17:02, Paul Smith wrote: On Sat, 2013-11-16 at 10:11 -0500, Roy Smith wrote: In article , William Ray Wing wrote: And my personal peeve - using it's (contraction) when its (possessive) should have been used; occasionally vice-versa. And one of mine is when people write, "H

Re: Automation

2013-11-18 Thread David Robinow
On Mon, Nov 18, 2013 at 11:49 AM, Grant Edwards wrote: > ... > I don't make those mistakes typing on a phone (where I have to > actually think about the act of typing), but I do make them with a > regular keyboard, where I don't have to think about mechanics of > typing the words. > > OTOH, maybe

Re: Oh look, another language (ceylon)

2013-11-18 Thread Rick Johnson
I've never *really* been crazy about the plus operator concatenating strings anyhow, however, the semantics of "+" seem to navigate the "perilous waters of intuition" far better than "*". Addition of numeric types is well defined in maths: Take N inputs values and *reduce* them into a sing

Re: Oh look, another language (ceylon)

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 1:13 PM, Steven D'Aprano wrote: > Still, given that Pike and Python have already solved this problem, and > have O(1) string indexing operations and length for any Unicode string, > SMP and BMP, it is a major disappointment that Ceylon doesn't. And of course, the part that

Re: Oh look, another language (ceylon)

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 1:13 PM, Steven D'Aprano wrote: > On Tue, 19 Nov 2013 10:25:00 +1100, Chris Angelico wrote: > >> But the problem is also with strings coming back from JS. > > Just because you call it a "string" in Ceylon, doesn't mean you have to > use the native Javascript string type unc

Re: Oh look, another language (ceylon)

2013-11-18 Thread Steven D'Aprano
On Mon, 18 Nov 2013 15:37:12 -0500, Dave Angel wrote: > If you use nearly all of the possible 2 byte values then adding 2 more > bytes won't give you anywhere near 4 bI'll ion characters. You're > perhaps thinking of bringing in four more bytes when the length exceeds > 32k. Yep, I screwed up. Th

Re: Oh look, another language (ceylon)

2013-11-18 Thread Steven D'Aprano
On Tue, 19 Nov 2013 10:25:00 +1100, Chris Angelico wrote: > But the problem is also with strings coming back from JS. Just because you call it a "string" in Ceylon, doesn't mean you have to use the native Javascript string type unchanged. Since the Ceylon compiler controls what Javascript oper

Re: How can I get the variable to subtract the input please?

2013-11-18 Thread Amit Saha
On Tue, Nov 19, 2013 at 9:56 AM, Ed Taylor wrote: > This will be very simple to most of you I guess but it's killing me! > > print ("Please type in your age") > age = input () > leave = 16 > print ("You have" + leave - age + "years left at school") > > I want to have an input where the users age

Re: Building a tree-based readline completer

2013-11-18 Thread roey . katz
> On Mon, 18 Nov 2013 08:55:05 -0800 (PST), roey.k...@gmail.com wrote: > > On Monday, November 18, 2013 11:54:43 AM UTC-5, roey wrote: > > > Thank you. In looking over these classes, I see though that even > them, I would run against the same limitations, though. > Please don't double space your

Re: Oh look, another language (ceylon)

2013-11-18 Thread Tim Daneliuk
On 11/18/2013 05:51 PM, Mark Lawrence wrote: can I safely assume that we'll be seeing a PEP fairly shortly? For Immediate Press Release: We at TundraWare are now entering our 10th year of debate in the YAPDL design as to what ought to be a statement and what ought to be a function. The State

Re: How can I get the variable to subtract the input please?

2013-11-18 Thread alex23
On 19/11/2013 9:56 AM, Ed Taylor wrote: This will be very simple to most of you I guess but it's killing me! print ("Please type in your age") age = input () leave = 16 print ("You have" + leave - age + "years left at school") I want to have an input where the users age is inserted and then su

Re: How can I get the variable to subtract the input please?

2013-11-18 Thread Andrew Berg
On 2013.11.18 17:56, Ed Taylor wrote: > This will be very simple to most of you I guess but it's killing me! > > print ("Please type in your age") > age = input () > leave = 16 > print ("You have" + leave - age + "years left at school") > > I want to have an input where the users age is inserted

Re: sendmail library ?!

2013-11-18 Thread Dan Stromberg
On Tue, Nov 12, 2013 at 8:52 PM, Tamer Higazi wrote: > Hi people! > > I am looking for a python library that does mailing directly through > "sendmail". > I use: http://stromberg.dnsalias.org/svn/mailer/trunk/mailer.py -- https://mail.python.org/mailman/listinfo/python-list

How can I get the variable to subtract the input please?

2013-11-18 Thread Ed Taylor
This will be very simple to most of you I guess but it's killing me! print ("Please type in your age") age = input () leave = 16 print ("You have" + leave - age + "years left at school") I want to have an input where the users age is inserted and then subtracted from the variable age which is s

Re: RapydScript : Python to Javascript translator

2013-11-18 Thread Dan Stromberg
On Sun, Nov 17, 2013 at 11:16 AM, Salvatore DI DIO < salvatore.di...@gmail.com> wrote: > Hello, > > If someone is interested about a fast Python to Javascript translator > (not a compiler like Brython which is another beast) > RapydScript is interesting. Here's a comparison of several Python-in-

Re: Oh look, another language (ceylon)

2013-11-18 Thread Mark Lawrence
On 17/11/2013 22:48, Tim Daneliuk wrote: On 11/17/2013 04:33 PM, Gregory Ewing wrote: Mark Lawrence wrote: As a rule of thumb people don't like change? This obviously assumes that language designers are people :) That's probably true (on both counts). I guess this means we need to encourag

Re: Why do only callable objects get a __name__?

2013-11-18 Thread Steven D'Aprano
On Mon, 18 Nov 2013 13:02:26 -0800, John Ladasky wrote: > I am implementing a state machine. The outputs of the various states in > the machine have variable contents. I started by making dictionaries > for each state output, but I soon tired of the bracket-and-quote-mark > syntax for referring

Re: Glade Survey

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 8:04 AM, Gene Heskett wrote: > On Monday 18 November 2013 16:04:14 Juan Pablo Ugarte did opine: > >> Hello everybody! >> >> We (Glade Developers) are conducting a user survey which will help us >> take informed decisions to improve the overall developer experience. >> >> So

Re: Oh look, another language (ceylon)

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 1:30 AM, Steven D'Aprano wrote: > I suppose that's not terrible, except for the O(n) string operations > which is just dumb. Yes, it's better than buggy, broken strings. But > still dumb, because those aren't the only choices. For example, for the > sake of an extra two byt

Re: Oh look, another language (ceylon)

2013-11-18 Thread Tim Daneliuk
On 11/17/2013 04:33 PM, Gregory Ewing wrote: Mark Lawrence wrote: As a rule of thumb people don't like change? This obviously assumes that language designers are people :) That's probably true (on both counts). I guess this means we need to encourage more Pythoneers to become language desi

Re: Why do only callable objects get a __name__?

2013-11-18 Thread Steven D'Aprano
On Mon, 18 Nov 2013 12:13:42 -0800, John Ladasky wrote: > I just created an object using collections.namedtuple, and was surprised > to discover that it didn't have a __name__ I'm not sure why you're surprised. Most objects don't have names, including regular tuples: py> some_tuple = (23, 42) p

Re: Doc generation from annotated source code

2013-11-18 Thread Ned Batchelder
On Monday, November 18, 2013 8:46:46 AM UTC-5, Laszlo Nagy wrote: > I just started rewritting my project from python 2 to python 3. I > noticed that there are these new parameter and return value annotations. > I have docstrings everywhere in my project, but I plan to convert many > of them into

Re: understanding someone else's program

2013-11-18 Thread Laurent Pointal
C. Ng wrote: > Hi all, > > Please suggest how I can understand someone else's program where > - documentation is sparse > - in function A, there will be calls to function B, C, D and in those > functions will be calls to functions R,S,T and so on so forth... > making it difficult to trace

Re: [Python-ideas] Unicode stdin/stdout

2013-11-18 Thread random832
On Mon, Nov 18, 2013, at 7:33, Robin Becker wrote: > UTF-8 stuff This doesn't really solve the issue I was referring to, which is that windows _console_ (i.e. not redirected file or pipe) I/O can only support unicode via wide character (UTF-16) I/O with a special function, not via using byte-based

Re: [ANN] Pythonium Core 0.2.5

2013-11-18 Thread Amirouche Boubekki
2013/11/18 Amirouche Boubekki > > 2013/11/17 Salvatore DI DIO > >> Are lists comprehensions are featured in Veloce ? >> > > Ah! Good question, I did not think about it can probably add it to Core. > Thanks > It's done in last release, dubbed 0.3.0 just use pip to install it. Also: - fixed the

Re: Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
On Monday, November 18, 2013 1:11:08 PM UTC-8, Terry Reedy wrote: > On 11/18/2013 3:13 PM, John Ladasky wrote: > > > Of course, I have used __name__ for years in the common expression "if > > __name__ == '__main__'") to determine whether a particular module is being > > run or merely imported. >

Re: Why do only callable objects get a __name__?

2013-11-18 Thread Terry Reedy
On 11/18/2013 3:13 PM, John Ladasky wrote: Of course, I have used __name__ for years in the common expression "if __name__ == "__main__") to determine whether a particular module is being run or merely imported. This true statement invalidates your subject line ;-). All modules have a __name

Re: Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
On Monday, November 18, 2013 12:43:28 PM UTC-8, Ian wrote: > Classes and functions are frequently kept in module namespaces, where > they are known by a specific name. The intent is that the __name__ > attribute should match that name by which it is commonly referred. > > > > Specific instanc

Re: Glade Survey

2013-11-18 Thread Gene Heskett
On Monday 18 November 2013 16:04:14 Juan Pablo Ugarte did opine: > Hello everybody! > > We (Glade Developers) are conducting a user survey which will help us > take informed decisions to improve the overall developer experience. > > So please take a few minutes to complete the survey, we appreci

Re: Building a tree-based readline completer

2013-11-18 Thread Dave Angel
On Mon, 18 Nov 2013 08:55:05 -0800 (PST), roey.k...@gmail.com wrote: On Monday, November 18, 2013 11:54:43 AM UTC-5, roey wrote: > Thank you. In looking over these classes, I see though that even them, I would run against the same limitations, though. Please don't double space your quotes. A

Re: Why do only callable objects get a __name__?

2013-11-18 Thread Ian Kelly
On Mon, Nov 18, 2013 at 1:13 PM, John Ladasky wrote: > A few days ago, I asked about getting the original declared name of a > function or method, and learned about the __name__ attribute. > > https://groups.google.com/forum/#!topic/comp.lang.python/bHvcuXgvdfA > > Of course, I have used __name__

Re: Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
On Monday, November 18, 2013 12:13:42 PM UTC-8, I wrote: > 2. If I created a superclass of namedtuple which exposed > type(namedtuple).__name__ in the namespace of the namedtuple itself, would I > be doing anything harmful? Sigh. Of course, that should read "subclass", not "superclass." Becau

Re: Oh look, another language (ceylon)

2013-11-18 Thread Dave Angel
On 18 Nov 2013 14:30:54 GMT, Steven D'Aprano wrote: - 15 bits for a length. 15 bits give you a maximum length of 32767. There are ways around that. E.g. a length of 0 through 32766 means exactly what it says; a length of 32767 means that the next two bytes are part of the length too, givi

Re: Doc generation from annotated source code

2013-11-18 Thread Johannes Findeisen
On Mon, 18 Nov 2013 14:46:46 +0100 Laszlo Nagy wrote: > I just started rewritting my project from python 2 to python 3. I > noticed that there are these new parameter and return value annotations. > I have docstrings everywhere in my project, but I plan to convert many > of them into annotation

Why do only callable objects get a __name__?

2013-11-18 Thread John Ladasky
A few days ago, I asked about getting the original declared name of a function or method, and learned about the __name__ attribute. https://groups.google.com/forum/#!topic/comp.lang.python/bHvcuXgvdfA Of course, I have used __name__ for years in the common expression "if __name__ == "__main__")

ANN: Wing IDE 5.0 released

2013-11-18 Thread Wingware
Hi, Wingware has released version 5.0 of Wing IDE, our integrated development environment designed specifically for the Python programming language. Wing IDE provides a professional quality code editor with vi, emacs, and other key bindings, auto-completion, call tips, refactoring, context-awar

Re: The Name of Our Religion Is Islam

2013-11-18 Thread John Ladasky
On Monday, November 18, 2013 8:52:06 AM UTC-8, BV BV wrote: > The Name of Our Religion Is Islam Incorrect. The name of YOUR religion is apparently "Spam." I have been flagging your posts. They do not belong in comp.lang.python. Please find a forum which discusses religion. Thank you. -- htt

Re: Byteorder of audioop functions

2013-11-18 Thread Serhiy Storchaka
18.11.13 18:51, Michael Schwarz написав(ла): Is the byteorder (or endianness) of the functions in the audioop module somewhere specified or does anyone know how it behaves on different systems? On my little-endian system it matches the system's endianness: It always matches the system's endia

Glade Survey

2013-11-18 Thread Juan Pablo Ugarte
Hello everybody! We (Glade Developers) are conducting a user survey which will help us take informed decisions to improve the overall developer experience. So please take a few minutes to complete the survey, we appreciate it! https://glade.gnome.org/registration.html Cheers Juan Pa

Re: sendmail library ?!

2013-11-18 Thread Grant Edwards
On 2013-11-18, Tim Roberts wrote: > Tamer Higazi wrote: >> >>I am looking for a python library that does mailing directly through >>"sendmail". >> >>When I look into the docs, I see only an "smtlip" library but nothing >>that could serve with sendmail or postfix. >> >>Any ideas ?! > > Remember th

Re: Building a tree-based readline completer

2013-11-18 Thread xDog Walker
On Monday 2013 November 18 09:13, Mark Lawrence wrote: > On 18/11/2013 16:55, roey.k...@gmail.com wrote: > > On Monday, November 18, 2013 11:54:43 AM UTC-5, roey wrote: > >> Thank you. In looking over these classes, I see though that even them, [snip] > Would you please read and action this > ht

Re: Program Translation - Nov. 14, 2013

2013-11-18 Thread Joel Goldstick
On Mon, Nov 18, 2013 at 12:15 PM, E.D.G. wrote: > "Terry Reedy" wrote in message > news:mailman.2820.1384745298.18130.python-l...@python.org... > > >> A couple of sentences of follow-up would have been sufficient. > > > The experience that I have had over the years with Newsgroup posting >

Re: Program Translation - Nov. 14, 2013

2013-11-18 Thread E.D.G.
"Joel Goldstick" wrote in message news:mailman.2792.1384709379.18130.python-l...@python.org... That being said, I'm guessing that this thing is used in some academic setting. If that's true, why not get a student (who will be much more versed in modern programming languages and techniques) to

Re: Program Translation - Nov. 14, 2013

2013-11-18 Thread E.D.G.
"Terry Reedy" wrote in message news:mailman.2820.1384745298.18130.python-l...@python.org... A couple of sentences of follow-up would have been sufficient. The experience that I have had over the years with Newsgroup posting is that it is generally better to try to be polite and answer

Re: Building a tree-based readline completer

2013-11-18 Thread Mark Lawrence
On 18/11/2013 16:55, roey.k...@gmail.com wrote: On Monday, November 18, 2013 11:54:43 AM UTC-5, roey wrote: Thank you. In looking over these classes, I see though that even them, I would run against the same limitations, though. - Roey On Monday, November 18, 2013 11:41:20 AM UTC-5, xDo

Re: Building a tree-based readline completer

2013-11-18 Thread roey . katz
On Monday, November 18, 2013 11:54:43 AM UTC-5, roey wrote: > Thank you. In looking over these classes, I see though that even them, I > would run against the same limitations, though. > > > > - Roey > > > > On Monday, November 18, 2013 11:41:20 AM UTC-5, xDog Walker wrote: > > > On Mo

Re: Building a tree-based readline completer

2013-11-18 Thread roey . katz
Thank you. In looking over these classes, I see though that even them, I would run against the same limitations, though. - Roey On Monday, November 18, 2013 11:41:20 AM UTC-5, xDog Walker wrote: > On Monday 2013 November 18 07:47, roey wrote: > > > I am trying to build a replacement complet

Byteorder of audioop functions

2013-11-18 Thread Michael Schwarz
Hi Is the byteorder (or endianness) of the functions in the audioop module somewhere specified or does anyone know how it behaves on different systems? On my little-endian system it matches the system's endianness: >>> import sys, audioop >>> sys.byteorder 'little' >>> audioop.lin2lin(b'\xff',

Re: Automation

2013-11-18 Thread Grant Edwards
On 2013-11-16, Larry Hudson wrote: >> And yes, people can _easily_ tell the difference between errors >> caused by being lazy/sloppy and errors caused by writing in a second >> language. >> > Not to start another flame-war (I hope), but our Greek friend is a > good example of that. It's not surp

Re: Building a tree-based readline completer

2013-11-18 Thread xDog Walker
On Monday 2013 November 18 07:47, roey.k...@gmail.com wrote: > I am trying to build a replacement completer for python's Cmd class These related packages may be of interest: http://pypi.python.org/pypi/rl http://pypi.python.org/pypi/kmd -- Yonder nor sorghum stenches shut ladle gulls stopper

Is curses module thread-safe?

2013-11-18 Thread Grant Edwards
I'm working on a program that uses the curses module, and I'd like to use multiple threads (using the threading module). Is the curses module in the standard library usable from multile threads? I found a discussion from about 15 years ago that indicated it wasn't at that time. The example being

Re: Unicode stdin/stdout

2013-11-18 Thread Robin Becker
On 18/11/2013 15:25, Victor Stinner wrote: Why do you need to force the UTF-8 encoding? Your locale is not correctly configured? It's better to set PYTHONIOENCODING rather than replacing sys.stdout/stderr at runtime. There is an open issue to add a TextIOWrapper.set_encoding() method: http://bu

Building a tree-based readline completer

2013-11-18 Thread roey . katz
Hello all, for my project[1] I am trying to build a replacement completer for python's Cmd class which accepts a tree of command and option names[2]. I've been trying all sorts of approaches (like the ARLCompleter mention here: https://sites.google.com/site/xiangyangsite/home/technical-tips/sof

Re: [Python-ideas] Unicode stdin/stdout

2013-11-18 Thread Victor Stinner
Why do you need to force the UTF-8 encoding? Your locale is not correctly configured? It's better to set PYTHONIOENCODING rather than replacing sys.stdout/stderr at runtime. There is an open issue to add a TextIOWrapper.set_encoding() method: http://bugs.python.org/issue15216 Victor -- https://

Re: Oh look, another language (ceylon)

2013-11-18 Thread Mark Lawrence
On 18/11/2013 14:31, Piet van Oostrum wrote: Chris Angelico writes: On Mon, Nov 18, 2013 at 11:29 PM, Ian Kelly wrote: On Nov 18, 2013 3:06 AM, "Chris Angelico" wrote: I'm trying to figure this out. Reading the docs hasn't answered this. If each character in a string is a 32-bit Unicode

Re: Oh look, another language (ceylon)

2013-11-18 Thread Steven D'Aprano
On Wed, 13 Nov 2013 14:33:27 -0500, Neal Becker wrote: > http://ceylon-lang.org/documentation/1.0/introduction/ I must say there are a few questionable design choices, in my opinion, but I am absolutely in love with the following two features: 1) variables are constant by default; 2) the fat

Re: Setting longer default decimal precision

2013-11-18 Thread Steven D'Aprano
On Mon, 18 Nov 2013 14:14:33 +, Kay Y. Jheallee wrote: > Using 1/3 as an example, [snip examples] > which seems to mean real (at least default) decimal precision is limited > to "double", 16 digit precision (with rounding error). That's because Python floats actually are implemented as C do

Re: If you continue being rude i will continue doing this

2013-11-18 Thread Piet van Oostrum
Ferrous Cranus writes: > No i haven't broke it at all. > Everything work as they should. > > The refusal of 'pygeoip' to install turned out to be the local setting in my > new VPS. > > So i have changes it to: > > export LANG = en_US.UTF-8 > > and then 'pip install pygeoip' was successful. > >

Re: Oh look, another language (ceylon)

2013-11-18 Thread Steven D'Aprano
On Mon, 18 Nov 2013 13:31:33 +, Steven D'Aprano wrote: > On Mon, 18 Nov 2013 21:04:41 +1100, Chris Angelico wrote: > >> On Mon, Nov 18, 2013 at 8:44 PM, wrote: >>> string >>> Satisfied Interfaces: Category, Cloneable>, >>> Collection, Comparable, >>> Correspondence, Iterable, >>> List, Rang

Re: Oh look, another language (ceylon)

2013-11-18 Thread Piet van Oostrum
Chris Angelico writes: > On Mon, Nov 18, 2013 at 11:29 PM, Ian Kelly wrote: >> >> On Nov 18, 2013 3:06 AM, "Chris Angelico" wrote: >>> >>> I'm trying to figure this out. Reading the docs hasn't answered this. >>> If each character in a string is a 32-bit Unicode character, and (as >>> can be se

HTTP Header Capitalization in urllib.request.AbstractHTTPHandler (Python 3.3)

2013-11-18 Thread Logan Owen
Hello everyone, I was hoping for some advice in dealing with an edge case related to Python's HTTP Header handling. Python is correctly assuming that the HTTP header field name (eg Content-Type) is case insensitive, but I have a webservice I am interacting with that does not follow the standards.

Setting longer default decimal precision

2013-11-18 Thread Kay Y. Jheallee
Using 1/3 as an example, >>> 1./3 0. >>> print "%.50f" % (1./3) 0.1482961625624739099293947219848633 >>> print "%.50f" % (10./3) 3.33348136306995002087205648422241210938 >>> print "%.50f" % (100./3) 33.33570180911920033395290374755859375000

Doc generation from annotated source code

2013-11-18 Thread Laszlo Nagy
I just started rewritting my project from python 2 to python 3. I noticed that there are these new parameter and return value annotations. I have docstrings everywhere in my project, but I plan to convert many of them into annotations. The question is: what kind of auto documenting system shoul

Re: If you continue being rude i will continue doing this

2013-11-18 Thread Antoon Pardon
Please try to restrain yourself. I understand the urge to vent your frustration but it will accomplish nothing. We are all frustrated by Nikos's behaviour but we all rely on each other not to increase that frustration through responding to his threads and thus prolonging their duration. -- Antoo

Re: Source code of Python to Javascsript translator

2013-11-18 Thread Mark Lawrence
On 18/11/2013 11:45, Salvatore DI DIO wrote: I don't know about other people here, but I'm a bit leery of just downloading Windows binaries from people and running them. Is your source code available? Is this an open source / free project? ChrisA You are completly right :-) Here is the

Re: Oh look, another language (ceylon)

2013-11-18 Thread Chris Angelico
On Tue, Nov 19, 2013 at 12:31 AM, Steven D'Aprano wrote: > Unless they have done something *really* clever, the language designers > lose a hundred million points for screwing up text strings. There is > *absolutely no excuse* for a new, modern language with no backwards > compatibility concerns t

Re: Python Beginner

2013-11-18 Thread Mark Lawrence
On 18/11/2013 10:18, ngangsia akumbo wrote: On Saturday, November 16, 2013 11:41:31 PM UTC+1, Chris Angelico wrote: On Sun, Nov 17, 2013 at 9:25 AM, ngangsia akumbo wrote: I am called Richard m from western Africa, Cameroon. It was a pleasure for me to join this group. Hi! Welcome! s

Re: Oh look, another language (ceylon)

2013-11-18 Thread Steven D'Aprano
On Mon, 18 Nov 2013 21:04:41 +1100, Chris Angelico wrote: > On Mon, Nov 18, 2013 at 8:44 PM, wrote: >> string >> Satisfied Interfaces: Category, Cloneable>, >> Collection, Comparable, >> Correspondence, Iterable, >> List, Ranged, Summable A string of >> characters. Each character in the string i

Re: UnicodeDecodeError: 'ascii' codec can't decodee byte 0xff in position 0: ordinal not in range(128)

2013-11-18 Thread Colin J. Williams
On 17/11/2013 11:55 PM, Hoàng Tuấn Việt wrote: Hi all, I use Python telnetlib on Windows 7 32 bit. Here is my code: def*telnet*(/self/, host, os, username, password): connection = telnetlib.Telnet(host) connection.read_until(/'login: '/) connection.write(username + /'\r'/)

Re: [Python-ideas] Unicode stdin/stdout

2013-11-18 Thread Nick Coghlan
On 18 Nov 2013 22:36, "Robin Becker" wrote: > > On 18/11/2013 11:47, Robin Becker wrote: > ... >> >> #c:\python33\lib\site-packages\sitecustomize.py >> import sys, codecs >> sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) >> sys.stderr = codecs.getwriter("utf-8")(sys.stderr.det

Re: Oh look, another language (ceylon)

2013-11-18 Thread Chris Angelico
On Mon, Nov 18, 2013 at 11:29 PM, Ian Kelly wrote: > > On Nov 18, 2013 3:06 AM, "Chris Angelico" wrote: >> >> I'm trying to figure this out. Reading the docs hasn't answered this. >> If each character in a string is a 32-bit Unicode character, and (as >> can be seen in the examples) string indexi

Re: Unicode stdin/stdout

2013-11-18 Thread Robin Becker
On 18/11/2013 11:47, Robin Becker wrote: ... #c:\python33\lib\site-packages\sitecustomize.py import sys, codecs sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach()) it seems that the above needs extra stuff to ma

Re: Oh look, another language (ceylon)

2013-11-18 Thread Ian Kelly
On Nov 18, 2013 3:06 AM, "Chris Angelico" wrote: > > I'm trying to figure this out. Reading the docs hasn't answered this. > If each character in a string is a 32-bit Unicode character, and (as > can be seen in the examples) string indexing and slicing are > supported, then does string indexing me

Re: Automation

2013-11-18 Thread Neil Cerutti
On 2013-11-16, Larry Hudson wrote: > However, that's just a side comment. I wanted to mention my > personal peeve... > > I notice it's surprisingly common for people who are native > English-speakers to use 'to' in place of 'too' (to little, to > late.), "your" in place of "you're" (Your an idiot

Re: If you continue being rude i will continue doing this

2013-11-18 Thread YBM
You are the one being rude, Nikos. Moreover you are a nut, installing pygeoip works fine for me: # pip install pygeoip Downloading/unpacking pygeoip Downloading pygeoip-0.3.0.tar.gz (97Kb): 97Kb downloaded Running setup.py egg_info for package pygeoip Installing collected packages: pygeoip

Source code of Python to Javascsript translator

2013-11-18 Thread Salvatore DI DIO
> > I don't know about other people here, but I'm a bit leery of just > > downloading Windows binaries from people and running them. Is your > > source code available? Is this an open source / free project? > > > > ChrisA You are completly right :-) Here is the source code : https://github.com/c

Re: Unicode stdin/stdout

2013-11-18 Thread Robin Becker
On 15/11/2013 18:16, random...@fastmail.us wrote: Of course, the real solution to this issue is to replace sys.stdout on windows with an object that can handle Unicode directly with the WriteConsoleW function - the problem there is that it will break code that expects to be able to use sys.stdout

Re: UnicodeDecodeError: 'ascii' codec can't decodee byte 0xff in position 0: ordinal not in range(128)

2013-11-18 Thread Fabio Zadrozny
On Mon, Nov 18, 2013 at 2:55 AM, Hoàng Tuấn Việt wrote: > Hi all, > > > > I use Python telnetlib on Windows 7 32 bit. Here is my code: > > > > def *telnet*(*self*, host, os, username, password): > > connection = telnetlib.Telnet(host) > > connection.read_until(*'login: '*) > >

Re: RapydScript : Python to Javascript translator

2013-11-18 Thread Salvatore DI DIO
> > I don't know about other people here, but I'm a bit leery of just > > downloading Windows binaries from people and running them. Is your > > source code available? Is this an open source / free project? > > > > ChrisA You are completly right :-) Here is the source code : https://github

  1   2   >