Re: Floating point minimum and maximum exponent values

2013-07-16 Thread Chris Angelico
On Tue, Jul 16, 2013 at 9:43 PM, Marco wrote: > Hi all, why the maximum and minimum exp values are 1024 and -1021?: > sys.float_info > sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, > min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, > mant_dig=53

Re: Help with pygame

2013-07-16 Thread Chris Angelico
On Wed, Jul 17, 2013 at 3:29 AM, Daniel Kersgaard wrote: > def drawWalls(surface): > > #left and right walls > for y in range(HEIGHT): > surface.blit(wallblock, (0, y * BLOCK_SIZE)) > surface.blit(wallblock, (WIDTH * BLOCK_SIZE, y * BLOCK_SIZE)) > > for x in range(W

Re: Homework help requested (not what you think!)

2013-07-16 Thread Chris Angelico
On Wed, Jul 17, 2013 at 8:43 AM, John Ladasky wrote: > I think that they're disappointed when I show them how much they have to > understand just to write a program that plays Tic Tac Toe. The disillusionment of every novice programmer, I think. It starts out as "I want to learn programming and

Re: GeoIP2 for retrieving city and region ?

2013-07-16 Thread Chris Angelico
On Wed, Jul 17, 2013 at 10:51 AM, Dennis Lee Bieber wrote: > On Tue, 16 Jul 2013 22:43:35 +0300, ??? declaimed > the following: > >> >>Lest say i embed inside my index.html the Javascript Geo Code. >> >>Is there a way to pass Javascript's outcome to my Python cgi script somehow? >> >>Can Java

Re: Homework help requested (not what you think!)

2013-07-16 Thread Chris Angelico
On Wed, Jul 17, 2013 at 10:53 AM, Joel Goldstick wrote: > There is a book : http://inventwithpython.com/ Invent Your Own Computer > Games with Python > which claims to teach people to program games in python. I haven't read it, > but it seems to be for beginning programmers. Take a look.. Maybe

Re: Homework help requested (not what you think!)

2013-07-17 Thread Chris Angelico
On Wed, Jul 17, 2013 at 11:20 PM, Neil Cerutti wrote: > Markov chains are an advanced technique you could introduce, but > you'd need a huge list of names broken into syllables from > somewhere. You could use names broken into letters... or skip the notion of names and just generate words. Lists

Re: Homework help requested (not what you think!)

2013-07-17 Thread Chris Angelico
On Wed, Jul 17, 2013 at 11:55 PM, Neil Cerutti wrote: > On 2013-07-17, Chris Angelico wrote: >> On Wed, Jul 17, 2013 at 11:20 PM, Neil Cerutti wrote: >>> Markov chains are an advanced technique you could introduce, but >>> you'd need a huge list of names broken i

Re: Need help with network script

2013-07-17 Thread Chris Angelico
On Thu, Jul 18, 2013 at 11:44 AM, wrote: > Hi everyone. I am starting to learn python and I decided to start with what I > though was a simple script but I guess now. All I want to do is return what > current network location I am using on my mac. Every time I run it, it gives > me back a 0. I

Re: Need help with network script

2013-07-17 Thread Chris Angelico
On Thu, Jul 18, 2013 at 11:59 AM, wrote: > On Wednesday, July 17, 2013 7:50:44 PM UTC-6, Chris Angelico wrote: >> >> Copy and paste your actual code, don't re-type it :) > > This is as far as I have gotten. THis is all my code and it has been copied > and pasted. T

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-17 Thread Chris Angelico
On Thu, Jul 18, 2013 at 2:36 PM, Aseem Bansal wrote: > I wanted to do a little project for learning Python. I thought a chat system > will be good as it isn't something that I have ever done. A good thing to start with. Yes, it's been done before, many times... but if you think about it, it's th

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-17 Thread Chris Angelico
On Thu, Jul 18, 2013 at 4:11 PM, Aseem Bansal wrote: > @vikash agrawal > > About GUI I discussed it at > https://groups.google.com/forum/#!starred/comp.lang.python/M-Dy2pyWRfM and I > am thinking about using PySide 1.2 for clients of chat system. I think I'll > need downloadable clients if I wa

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-17 Thread Chris Angelico
On Thu, Jul 18, 2013 at 4:36 PM, Aseem Bansal wrote: > @Chris Angelico > > Thanks. That cleared many doubts and your suggestions would definitely be > useful. > > I am asking the next paragraph because you said about Python 3 helping with > things. I am not looking for a de

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-18 Thread Chris Angelico
On Thu, Jul 18, 2013 at 5:05 PM, Aseem Bansal wrote: > @Andrew Berg > @Chris Angelico > > Is there a way to have both Python 2 and 3 installed on my computer till I > can update the little codebase that I have built? Can I make different > commands for invoking python 2 and Py

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-18 Thread Chris Angelico
On Thu, Jul 18, 2013 at 5:29 PM, Aseem Bansal wrote: > @ChrisA > > Thanks. That's great. That solved the whole thing easily. I'll install Python > 3 and start updating today. > > About reading comp.lang.python can you suggest how to read it and reply? I > have never read a newsgroup leave alone

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-18 Thread Chris Angelico
On Thu, Jul 18, 2013 at 5:48 PM, Aseem Bansal wrote: > @ChrisA > > I subscribed to it. How do I reply to a message that has already been posted > before my subscription? Not easily, far as I know. But you now have this reply, and you can always just post something with the right subject line and

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-18 Thread Chris Angelico
On Thu, Jul 18, 2013 at 6:10 PM, Aseem Bansal wrote: > I tried replying to your message by mail. I used the reply button and send it > to "python-list@python.org"? Or do I need to use "pytho...@python.org" as you > wrote in your post? You replied correctly. The ellipsis was presumably an anti-s

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-19 Thread Chris Angelico
On Fri, Jul 19, 2013 at 5:10 PM, Jake Angulo wrote: > On Thu, Jul 18, 2013 at 2:36 PM, Aseem Bansal wrote: >> >> I wanted to do a little project for learning Python. I thought a chat >> system will be good as it isn't something that I have ever done. >> ... >> >> I wanted to know what

Re: Messages to Python-List aren't posting

2013-07-19 Thread Chris Angelico
On Fri, Jul 19, 2013 at 6:30 AM, Matthew Lefavor wrote: > All: > > I've been having trouble with all three Python mailing lists (python-list, > python-dev, python-ideas). This has been going on for about a month. > Whenever I post, it takes hours for my messages to be posted on the list. I > first

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-19 Thread Chris Angelico
On Fri, Jul 19, 2013 at 9:25 PM, Jorgen Grahn wrote: > On Thu, 2013-07-18, Chris Angelico wrote: > ... >> You can certainly do your server-side programming directly in Python; >> in fact, I recommend it for this task. There's no reason to use HTTP, >> much less a

Re: Messages to Python-List aren't posting

2013-07-19 Thread Chris Angelico
On Sat, Jul 20, 2013 at 12:57 AM, Skip Montanaro wrote: >> One relevant piece of information: I have subscribed and unsubscribed to >> different combinations of these lists several times over the past year, and >> particularly over the past few months (as I was trying to manage the flow of >> emai

Re: Messages to Python-List aren't posting

2013-07-19 Thread Chris Angelico
On Sat, Jul 20, 2013 at 2:31 AM, Steven D'Aprano wrote: > Admittedly, this was a few years back that we ran into this problem, and > since then we've just routinely whitelisted email from Optus and Bigpond, > curse their black souls for making spam prevention just that little bit > harder. So I su

Re: Stack Overflow moderator “animuson”

2013-07-19 Thread Chris Angelico
On Sat, Jul 20, 2013 at 4:54 AM, wrote: > And do not forget memory. The €uro just become expensive. > sys.getsizeof(' > ) > 26 sys.getsizeof('€') > 40 > > I do not know. When an €uro char need 14 bytes more that > a dollar, I belong to those who thing there is a problem > somewhere. Oh

Re: Share Code Tips

2013-07-19 Thread Chris Angelico
On Sat, Jul 20, 2013 at 8:10 AM, Devyn Collier Johnson wrote: > > On 07/19/2013 12:19 PM, Steven D'Aprano wrote: >> >> On Fri, 19 Jul 2013 10:21:10 -0400, Joel Goldstick wrote: >> >>> >> class="gmail_quote"> >> >> [snip 70-odd lines of HTML...] >> >>> I'm guessing you may be posting with html. So

Re: Share Code Tips

2013-07-19 Thread Chris Angelico
On Sat, Jul 20, 2013 at 8:08 AM, Devyn Collier Johnson wrote: > As for the case-insensitive if-statements, most code uses Latin letters. > Making a case-insensitive-international if-statement would be interesting. I > can tackle that later. For now, I only wanted to take care of Latin letters. > I

Re: Share Code Tips

2013-07-19 Thread Chris Angelico
ing is similar to lowercasing but more aggressive because it is >> intended to remove all case distinctions in a string. For example, the >> German lowercase letter 'ß' is equivalent to "ss". Since it is already >> lowercase, lower() would do nothing to

Re: how: embed + extend to control my running app?

2013-07-19 Thread Chris Angelico
On Sat, Jul 20, 2013 at 9:52 AM, David M. Cotter wrote: > i'd like my app to be "available" to python while it's running. > > for example, say my app is "FooBar.app". > > when my FooBar.app is running, now there is a python interface available to > python, and the user can write python scripts to

Re: List as Contributor

2013-07-20 Thread Chris Angelico
On Sat, Jul 20, 2013 at 10:48 PM, Devyn Collier Johnson wrote: > Many users on here have answered my questions and given me ideas and > suggestions for code that I am using in my open-source GPLv3 chatbot. When I > release the next update (that will be in a month or two), does anyone that > has co

Re: How can I make this piece of code even faster?

2013-07-20 Thread Chris Angelico
On Sun, Jul 21, 2013 at 6:22 AM, wrote: > temp = 0 > for y in range(input_num): > count += 1 > temp += inputs[y] * h_weight[count] > hidden[x] = 1/(1+e**(-temp)) It's a micro-optimization that'll probably have negligible effect,

Re: How can I make this piece of code even faster?

2013-07-20 Thread Chris Angelico
On Sun, Jul 21, 2013 at 9:24 AM, wrote: > Hi there Chris. > Unfortunately, using iterations was about twice as slow as the original > implementation, so that's not the solution. > Thank's anyway. Fascinating! Well, was worth a try anyhow. But that's a very surprising result. ChrisA -- http://

Re: Play Ogg Files

2013-07-20 Thread Chris Angelico
On Sun, Jul 21, 2013 at 3:39 PM, David Hutto wrote: > With linux you can have your package listed in synaptic, and can use with a > sudo apt-get install whatever ogg player like ogg123, and windows I don't > work with that much, but I'm pretty sure I've played .wav files from the > command line be

Re: Play Ogg Files

2013-07-20 Thread Chris Angelico
On Sun, Jul 21, 2013 at 4:07 PM, David Hutto wrote: > Yeah, its like yum used in others(or the point and click gui package > installers). The main point kind of is in cross platform it would seem that > you would just use what's available with try/except, or if statements, and > the question is wh

Re: How can I make this piece of code even faster?

2013-07-21 Thread Chris Angelico
On Sun, Jul 21, 2013 at 5:11 PM, Paul Rudin wrote: > Steven D'Aprano writes: > >> On Sat, 20 Jul 2013 13:22:03 -0700, pablobarhamalzas asked: >> >> "How can I make this piece of code even faster?" >> >> - Use a faster computer. >> - Put in more memory. >> - If using Unix or Linux, decrease the "n

Re: How can I make this piece of code even faster?

2013-07-21 Thread Chris Angelico
On Sun, Jul 21, 2013 at 8:31 PM, Steven D'Aprano wrote: > On Sun, 21 Jul 2013 03:19:24 -0700, pablobarhamalzas wrote: > >> Thank's for all the replies! I've tried some of the imporovements you >> suggested (using math.exp() and sum() or math.fsum()). None of that made >> the code faster, because t

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-21 Thread Chris Angelico
On Mon, Jul 22, 2013 at 12:42 AM, Gilles wrote: > Hello > > Every once in a while, my ISP's SMTP server refuses to send > perfectly legit e-mails because it considers them as SPAM. > > So I'd like to install a dead-simple SMTP server on my XP computer > just to act as SMTP backup server. >

Re: Homework help requested, thanks to everyone.

2013-07-21 Thread Chris Angelico
On Mon, Jul 22, 2013 at 6:49 AM, John Ladasky wrote: > Another project I thought of was a Pig Latin translator. (But do kids today > even know what Pig Latin is? Am I showing my age?) Even if they don't, they'll grok it no problem. It's simple enough. ChrisA -- http://mail.python.org/mailma

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-22 Thread Chris Angelico
On Mon, Jul 22, 2013 at 10:11 PM, Gilles wrote: > On Sun, 21 Jul 2013 18:28:27 -0600, Michael Torrie > wrote: >>Having spent a long time managing e-mail servers, everything Ivan said >>in his reply is true as well. I had forgotten a lot of that since I >>haven't been running my own mail server (

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-22 Thread Chris Angelico
On Mon, Jul 22, 2013 at 10:38 PM, Gilles wrote: > On Mon, 22 Jul 2013 22:29:42 +1000, Chris Angelico > wrote: >>One thing to check when you change how you send mail is your SPF >>record. I run the mail server for kepl.com.au and have set its SPF to: >> >>&

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-22 Thread Chris Angelico
On Tue, Jul 23, 2013 at 12:08 AM, Michael Torrie wrote: > On 07/22/2013 06:51 AM, Chris Angelico wrote: >>> Thanks for the tip. I didn't know about SPF >>> http://en.wikipedia.org/wiki/Sender_Policy_Framework >> >> It's a great way of detecting legit

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-22 Thread Chris Angelico
On Tue, Jul 23, 2013 at 12:21 AM, Michael Torrie wrote: > My mail server did a number of things: > 1. ensure IP address of sending server has a reverse name (domain didn't > particularly matter) > 2. ensure the HELO address in SMTP matches IP address of sending server > 3. check sender IP address

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-22 Thread Chris Angelico
On Tue, Jul 23, 2013 at 2:25 AM, Michael Torrie wrote: > On 07/22/2013 08:15 AM, Chris Angelico wrote: >> If legit mail is rejected for failing an SPF check, it's the sending >> admin's problem, not yours. You should never have problems with it if >> it's set u

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Chris Angelico
On Tue, Jul 23, 2013 at 6:06 PM, Duncan Booth wrote: > Chris Angelico wrote: > >> On Tue, Jul 23, 2013 at 12:08 AM, Michael Torrie >> wrote: >>> On 07/22/2013 06:51 AM, Chris Angelico wrote: >>>>> Thanks for the tip. I didn't kn

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Chris Angelico
On Tue, Jul 23, 2013 at 7:19 PM, Chris Angelico wrote: > Ah, there's a solution to this one. You simply use your own > envelope-from address; SPF shouldn't be being checked for the From: > header. There's an example, by the way, of this exact technique right here - pyth

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Chris Angelico
On Tue, Jul 23, 2013 at 8:06 PM, Duncan Booth wrote: > Excellent idea, I'll tell the email forwarding service to rewrite their > system immediately. Yes. If they are using your domain in the MAIL FROM command and not using your mail servers, then yes, you should tell them, and use a different ser

Re: [OT] SPF - was Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-23 Thread Chris Angelico
On Wed, Jul 24, 2013 at 1:12 AM, Michael Torrie wrote: > On 07/23/2013 03:30 AM, Chris Angelico wrote: >> On Tue, Jul 23, 2013 at 7:19 PM, Chris Angelico wrote: >>> Ah, there's a solution to this one. You simply use your own >>> envelope-from address; SPF shouldn

Re: Converting a list of lists to a single list

2013-07-23 Thread Chris Angelico
On Wed, Jul 24, 2013 at 8:34 AM, Rafael Durán Castañeda wrote: > In [3]: [ y for y in itertools.chain.from_iterable(x)] > Out[3]: ['A0', 'A1', 'A2', 'B0', 'B1', 'B2', 'C0', 'C1', 'C2'] Complete aside, given that this has already been pointed out as solving a different problem: Any time you see a

Re: Strange behaviour with os.linesep

2013-07-24 Thread Chris Angelico
On Wed, Jul 24, 2013 at 5:02 PM, Vincent Vande Vyvre wrote: > In fact, in my code, the original file is open in binary mode, the line > separator is translate to \n and it is parsed by the module tokenise. > > I'm not a Windows user but my code must be run also on Win, this is the > reason of the

Re: i want to run user specific cronjobs so where to specify user in ubuntu?

2013-07-24 Thread Chris Angelico
On Wed, Jul 24, 2013 at 5:47 PM, wrote: > > -- > http://mail.python.org/mailman/listinfo/python-list Not a Python question. I'm sure Google can help you with this one - just take three words from your question, 'user specific cronjobs', and you'll get plenty of advice. ChrisA -- http://mail.py

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Wed, Jul 24, 2013 at 11:40 PM, wrote: > Short example. Writing an editor with something like the > FSR is simply impossible (properly). jmf, have you ever written an editor with *any* string representation? Are you speaking from any level of experience at all? ChrisA -- http://mail.python.o

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 12:17 AM, David Hutto wrote: > I've screwed up plenty of times in python, but can write code like a pro > when I'm feeling better(on SSI and medicaid). An editor can be built simply, > but it's preference that makes the difference. Some might have used tkinter, > gtk. wxpyt

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 12:47 AM, Michael Torrie wrote: > On 07/24/2013 07:40 AM, wxjmfa...@gmail.com wrote: >> Sorry, you are not understanding Unicode. What is a Unicode >> Transformation Format (UTF), what is the goal of a UTF and >> why it is important for an implementation to work with a UTF.

Re: how: embed + extend to control my running app?

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 2:10 AM, David M. Cotter wrote: > So: i really want it to go to my own log file (via my Log() function). now, > can i specify "please output to this FILE*" ?, i looked at all the python c > headers but found nothing about redirecting the output. Are you able to simply

Re: Python 3: dict & dict.keys()

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 1:57 AM, Ethan Furman wrote: > On 07/24/2013 05:51 AM, Oscar Benjamin wrote: >> What do you mean? Why would you want to create a temporary list just to >> iterate over it explicitly or implicitly (set, >> sorted, max,...)? > > You wouldn't. But you don't need .keys() for t

Re: Python 3: dict & dict.keys()

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 3:17 AM, Terry Reedy wrote: > On 7/24/2013 12:34 PM, Chris Angelico wrote: > >> Side point: Why is iterating over a dict equivalent to .keys() rather >> than .items()? It feels odd that, with both options viable, the >> implicit version iterates ov

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 3:52 AM, Terry Reedy wrote: > On 7/24/2013 11:00 AM, Michael Torrie wrote: >> >> On 07/24/2013 08:34 AM, Chris Angelico wrote: >>> >>> Frankly, Python's strings are a *terrible* internal representation >>> for an editor widg

Re: Dihedral

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 4:08 AM, Stefan Behnel wrote: > Fábio Santos, 16.07.2013 00:54: >> Does this mean he passes the Turing test? > > I'd say that "it" appears more correct. Or is there any indication of a > specific bot gender? (I sure might have missed it...) > > Note that being of a specific

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 8:09 AM, Terry Reedy wrote: > On 7/24/2013 2:15 PM, Chris Angelico wrote: >> To my mind, exposing UTF-16 surrogates to the application is a bug >> to be fixed, not a feature to be maintained. > > It is definitely not a feature, but a proper UTF-16 imp

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 8:59 AM, Michael Torrie wrote: > I don't fully understand > why making strings simply "unicode" in javascript breaks compatibility > with older scripts. What operations are performed on strings that > making unicode an abstract type would break? Imagine this in JavaScrip

Re: I have a little problem with Django when I am trying to create a new app

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 12:03 PM, wrote: > Hello everyone I'm watching a tutorial on how to create a project on Django... > > django-admin.py startproject carabali > > when I run this code on terminal.. happens : > > > http://nsae01.casimages.net/img/2013/07/25/130725021220676239.png > > > There

Re: RE Module Performance

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 3:49 PM, Serhiy Storchaka wrote: > 24.07.13 21:15, Chris Angelico написав(ла): > >> To my mind, exposing UTF-16 >> surrogates to the application is a bug to be fixed, not a feature to >> be maintained. > > > Python 3 uses code points fr

Re: Python 3: dict & dict.keys()

2013-07-24 Thread Chris Angelico
On Thu, Jul 25, 2013 at 3:48 PM, Steven D'Aprano wrote: > Dicts aren't sets, and don't support set methods: > > py> d1 - d2 > Traceback (most recent call last): > File "", line 1, in > TypeError: unsupported operand type(s) for -: 'dict' and 'dict' I wouldn't take this as particularly signific

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 5:02 PM, Steven D'Aprano wrote: > On Thu, 25 Jul 2013 00:34:24 +1000, Chris Angelico wrote: > >> But mainly, I'm just wondering how many people here have any basis from >> which to argue the point he's trying to make. I doubt most of us

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 5:15 PM, Steven D'Aprano wrote: > On Thu, 25 Jul 2013 04:15:42 +1000, Chris Angelico wrote: > >> If nobody had ever thought of doing a multi-format string >> representation, I could well imagine the Python core devs debating >> whether the co

Re: Python 3: dict & dict.keys()

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 5:04 PM, Steven D'Aprano wrote: > - Views support efficient (O(1) in the case of keys) membership testing, > which neither iterkeys() nor Python2 keys() does. To save me the trouble and potential error of digging through the source code: What's the complexity of membership

Re: Python 3: dict & dict.keys()

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 5:27 PM, Steven D'Aprano wrote: > On Thu, 25 Jul 2013 16:02:42 +1000, Chris Angelico wrote: > >> On Thu, Jul 25, 2013 at 3:48 PM, Steven D'Aprano >> wrote: >>> Dicts aren't sets, and don't support set methods: >>&

Re: must be dicts in tuple

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 4:58 PM, Tanaya D wrote: > Hi, > > I am using Python with Bots(EDI translator) > > But i am getting the following error: > MappingFormatError: must be dicts in tuple: get((({'BOTSID': 'HEADER'},),)) The first thing to do is to construct a short piece of code that demonstra

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 7:22 PM, Steven D'Aprano wrote: > What I'm trying to say is that it is possible to use UTF-16 internally, > but *not* assume that every code point (character) is represented by a > single 2-byte unit. For example, the len() of a UTF-16 string should not > be calculated by c

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 7:27 PM, wrote: > A coding scheme works with a unique set of characters (the repertoire), > and the implementation (the programming) works with a unique set > of encoded code points. The critical step is the path > {unique set of characters} <--> {unique set of encoded cod

Re: Python 3: dict & dict.keys()

2013-07-25 Thread Chris Angelico
On Thu, Jul 25, 2013 at 7:44 PM, Steven D'Aprano wrote: > On Thu, 25 Jul 2013 18:15:22 +1000, Chris Angelico wrote: >> That's true, but we already have that issue with sets. What's the union >> of {0} and {0.0}? Python's answer: It depends on the order of the &g

Re: Python 3: dict & dict.keys()

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 12:57 AM, Steven D'Aprano wrote: > [ snip lengthy explanation of sets ] > The union operator ought to > be symmetrical, a ∪ b should be identical to b ∪ a, but isn't. Another > leaky abstraction. Right. I agree with all your theory, which is fine and good. If we had a "set

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 1:26 AM, Steven D'Aprano wrote: > On Thu, 25 Jul 2013 14:36:25 +0100, Jeremy Sanders wrote: >> "To conserve memory, Emacs does not hold fixed-length 22-bit numbers >> that are codepoints of text characters within buffers and strings. >> Rather, Emacs uses a variable-length

Re: Is it that easy to install Python ?

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 2:36 AM, Irmen de Jong wrote: > On 25-7-2013 17:11, santiago.d...@caoba.fr wrote: >> Hi there, >> >> I never write any Python program but as a system administrator, I'm often >> asked to install python on Debian servers. >> >> I just finished downloading, configuring, maki

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 3:18 AM, Steven D'Aprano wrote: > On Fri, 26 Jul 2013 01:36:07 +1000, Chris Angelico wrote: > >> On Fri, Jul 26, 2013 at 1:26 AM, Steven D'Aprano >> wrote: >>> On Thu, 25 Jul 2013 14:36:25 +0100, Jeremy Sanders wrote: >>>&g

Re: RE Module Performance

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 5:07 AM, wrote: > Let start with a simple string \textemdash or \texttendash > sys.getsizeof('–') > 40 sys.getsizeof('a') > 26 Most of the cost is in those two apostrophes, look: >>> sys.getsizeof('a') 26 >>> sys.getsizeof(a) 8 Okay, that's slightly unfair (bo

Re: Help

2013-07-25 Thread Chris Angelico
On Fri, Jul 26, 2013 at 6:06 AM, wrote: > I'm a bit new to python and I'm trying to create a simple program which adds > words and definitions to a list, and then calls them forward when asked to. One of the most important tidbits of information is: What version of Python are you using? > prin

Re: Python Script Hashplings

2013-07-26 Thread Chris Angelico
On Fri, Jul 26, 2013 at 11:37 AM, Devyn Collier Johnson wrote: > > On 07/25/2013 09:54 AM, MRAB wrote: >> >> On 25/07/2013 14:42, Devyn Collier Johnson wrote: >>> >>> If I execute a Python3 script with this haspling (#!/usr/bin/python3.3) >>> and Python3.3 is not installed, but Python3.2 is instal

Re: Python Script Hashplings

2013-07-26 Thread Chris Angelico
On Fri, Jul 26, 2013 at 2:53 PM, MRAB wrote: > If you want to test what would happen if that version wasn't installed, > set the shebang line to a future version, such as Python 3.4. I doubt > you have that installed! :-) Be careful, some people DO have a python3.4 binary :) Go for 3.5 for a bit

Re: dump a multi dimensional dictionary

2013-07-26 Thread Chris Angelico
On Fri, Jul 26, 2013 at 9:21 PM, cerr wrote: > >>> mylist = [] > >>> mydict = {} > >>> mylist = '1','2' Side point: mylist is no longer a list, it's a tuple. I don't think pickle has problems with tuples, but it's worth noting that difference. ChrisA -- http://mail.python.org/mailm

Re: Cross-Platform Python3 Equivalent to notify-send

2013-07-27 Thread Chris Angelico
On Sat, Jul 27, 2013 at 1:22 PM, Devyn Collier Johnson wrote: > That really sucks. I was hoping Python had some way of doing that. All that > it needs to do is display a little box at one of the corners of the screen. > I thought someone would have implemented something by now. Thank you anyway.

Re: Understanding other people's code

2013-07-27 Thread Chris Angelico
On Sat, Jul 27, 2013 at 2:13 PM, Albert van der Horst wrote: > If the code is really tidy, it is possible to understand a function > using only the *documentation* (not the code itself) of any function > or data it uses. I'd broaden that slightly to the function's signature, which consists of the

Re: Critic my module

2013-07-27 Thread Chris Angelico
On Sat, Jul 27, 2013 at 2:19 PM, Devyn Collier Johnson wrote: > About the aliases, I have tried setting pwd() as an alias for "os.getcwd()", > but I cannot type "pwd()" and get the desired output. Instead, I must type > "pwd". I tested this in Guake running Python3.3. > os.getcwd() > '/home/c

Re: Critic my module

2013-07-27 Thread Chris Angelico
On Sat, Jul 27, 2013 at 3:53 PM, Devyn Collier Johnson wrote: > Would a Python3 game module be more useful? I plan to make a function that > rolls a die and prints the output (You got a 5) and other similar random > games. Taking someone else's module and learning to use it has a cost. Plus there

Re: Cross-Platform Python3 Equivalent to notify-send

2013-07-27 Thread Chris Angelico
On Sat, Jul 27, 2013 at 4:59 PM, Steven D'Aprano wrote: > On Sat, 27 Jul 2013 08:22:00 -0400, Devyn Collier Johnson wrote: >> That really sucks. I was hoping Python had some way of doing that. All >> that it needs to do is display a little box at one of the corners of the >> screen. I thought some

Re: python import module question

2013-07-27 Thread Chris Angelico
On Sun, Jul 28, 2013 at 12:15 AM, syed khalid wrote: > Syedk@syedk-ThinkPad-T410:~/shogun-2.0.0/src/interfaces/cmdline_static$ > shogun | more This implies that you have something called 'shogun', without an extension, in your $PATH. Where is the actual script? You may need to install it by a qu

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 4:52 PM, Michael Torrie wrote: > Is my understanding of these things wrong? No, your understanding of those matters is fine. There's just one area you seem to be misunderstanding; you appear to think that jmf actually cares about logical argument. I gave up on that theory

Re: [Savoynet] G&S Opera Co: Pirates of Penzance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 6:36 PM, David Patterson wrote: > By the way, Chris, I think the book that Ruth brought on was probably > supposed to be Debretts Peerage. I couldn't see the cover clearly but it > would have been a more logical choice in view of the circumstances. Sure. Makes no differen

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 6:36 PM, Terry Reedy wrote: > I posted about a week ago, in response to Chris A., a method by which lookup > for UTF-16 can be made O(log2 k), or perhaps more accurately, > O(1+log2(k+1)), where k is the number of non-BMP chars in the string. > Which is an optimization cho

Re: RE Module Performance

2013-07-28 Thread Chris Angelico
On Sun, Jul 28, 2013 at 7:19 PM, Joshua Landau wrote: > On 28 July 2013 09:45, Antoon Pardon wrote: >> >> Op 27-07-13 20:21, wxjmfa...@gmail.com schreef: >>> >>> utf-8 or any (utf) never need and never spend their time >>> in reencoding. >> >> >> So? That python sometimes needs to do some kind of

Re: [Savoynet] G&S Opera Co: Pirates of Penzance

2013-07-28 Thread Chris Angelico
On Mon, Jul 29, 2013 at 12:49 AM, Ethan Furman wrote: > On 07/28/2013 10:57 AM, Chris Angelico wrote: >. >. >. > > Okay, how did you get confused that this was a Python List question? ;) *sigh* Because I still haven't gotten around to switching mail clients

Re: programming course

2013-07-29 Thread Chris Angelico
On Sat, Jul 27, 2013 at 1:28 PM, wrote: > Hi, > A good step by step easy book on Python is: "Start Here: Python 3x > Programming Made Fun and Easier," at http://www.quantum-sight.com This is a Usenet group and a mailing list, not a web forum. You do not need to dig up a dozen ancient threads in

Re: RE Module Performance

2013-07-29 Thread Chris Angelico
On Sun, Jul 28, 2013 at 11:14 PM, Joshua Landau wrote: > GC does have sometimes severe impact in memory-constrained environments, > though. See http://sealedabstract.com/rants/why-mobile-web-apps-are-slow/, > about half-way down, specifically > http://sealedabstract.com/wp-content/uploads/2013/05/

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 12:43 PM, wrote: > Le dimanche 28 juillet 2013 22:52:16 UTC+2, Steven D'Aprano a écrit : > 3.2 timeit.timeit("r = dir(list)") > 22.300465007102908 > > 3.3 timeit.timeit("r = dir(list)") > 27.13981129541519 3.2: >>> len(dir(list)) 42 3.3: >>> len(dir(list)) 45

Re: FSR and unicode compliance - was Re: RE Module Performance

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 3:20 PM, wrote: >>c:\python32\pythonw -u "timitmod.py" > 15.258061416225663 >>Exit code: 0 >>c:\Python33\pythonw -u "timitmod.py" > 17.052203122286194 >>Exit code: 0 >>> len(dir(C)) Did you even think to check that before you posted timings? ChrisA -- http://mail.pytho

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 5:09 PM, MRAB wrote: > I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats > are approximate anyway, and the float value 1/3 is more likely to be > Fraction(1, 3) than Fraction(6004799503160661, 18014398509481984). At what point should it become Fraction(

Re: What do you do when a library is outdated?

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 5:14 PM, Matt wrote: > I'm fairly new to python but have experience in other languages. What do you > generally do when a library is outdated? I asked a question on a few forums > and everyone has been pointing me to Mechanize, but it will not work with 3.3 > > What do yo

Re: Unexpected results comparing float to Fraction

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 5:40 PM, Ian Kelly wrote: > On Mon, Jul 29, 2013 at 10:20 AM, Chris Angelico wrote: >> On Mon, Jul 29, 2013 at 5:09 PM, MRAB wrote: >>> I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats >>> are approximate anyway,

Re: Bitwise Operations

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 12:34 AM, Devyn Collier Johnson wrote: > > I understand the symbols. I want to know how to perform the task in a script > or terminal. I have searched Google, but I never saw a command. Typing "101 > & 010" or "x = (int(101, 2) & int(010, 2))" only gives errors. Your probl

Re: timing issue: shutil.rmtree and os.makedirs

2013-07-29 Thread Chris Angelico
On Mon, Jul 29, 2013 at 8:16 PM, Tim wrote: > My intent is to pass it a directory name or path and if it exists, use > shutil.rmtree to remove whatever is there (if it isn't a directory, try to > unlink it); then use os.makedirs to create a new directory or path: > > def make_clean_dir(directory

Re: Bitwise Operations

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 12:48 AM, Devyn Collier Johnson wrote: > Now here is something that confuses me, the binary numbers are numbers not > strings, so why are they put in quotes as if they are strings? They aren't numbers at that point, they're strings of digits. A number is represented in var

Re: Pyglet on Python3.x, problems

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 1:47 AM, John Ladasky wrote: > I'm getting one problem. After a few tests run, I can't close a window. I > am normally closing each interactive test with the ESC key. But when that > fails I try clicking with the mouse. This also fails. This broken behavior > appear

Re: SQLite logic error or missing database

2013-07-29 Thread Chris Angelico
On Tue, Jul 30, 2013 at 3:02 AM, CM wrote: > If I try additional commits in that same instance of my app being open, > it gives me the same error every time. If I close the app and re-open > it, it does not give me this error, with the same or very similar data > being written in the same routine

<    2   3   4   5   6   7   8   9   10   11   >