Re: Cutting a deck of cards

2013-05-26 Thread Roy Smith
In article <4d02f46f-8264-41bf-a254-d1c204696...@googlegroups.com>, RVic wrote: > Suppose I have a deck of cards, and I shuffle them > > import random > cards = [] > decks = 6 > cards = list(range(13 * 4 * decks)) > random.shuffle(cards) > > So now I have an array of cards. I would like to cut

Re: Future standard GUI library

2013-05-26 Thread Roy Smith
In article , Michael Torrie wrote: > On good thing web development has brought us is the knowledge that > modularization and layers are a brilliant idea. Modularization and layers were a brilliant idea long before the web came around. -- http://mail.python.org/mailman/listinfo/python-list

Re: Short-circuit Logic

2013-05-26 Thread Roy Smith
In article , Terry Jan Reedy wrote: > On 5/26/2013 7:11 AM, Ahmed Abdulshafy wrote: > > > if not allow_zero and abs(x) < sys.float_info.epsilon: > > print("zero is not allowed") > > The reason for the order is to do the easy calculation first and the > harder one only i

Re: serialize a class to XML and back

2013-05-26 Thread Roy Smith
In article , Chris Rebert wrote: > On May 23, 2013 3:42 AM, "Schneider" wrote: > > > > Hi list, > > > > how can I serialize a python class to XML? Plus a way to get the class > back from the XML? > > There's pyxser: http://pythonhosted.org/pyxser/ > > > My aim is to store instances of this cl

Re: serialize a class to XML and back

2013-05-26 Thread Roy Smith
In article <51a28f42$0$15870$e4fe5...@news.xs4all.nl>, Irmen de Jong wrote: > On 26-5-2013 22:48, Roy Smith wrote: > > > The advantage of pickle over json is that pickle can serialize many > > types of objects that json can't. The other side of the coin is that

Re: Reading *.json from URL - json.loads() versus urllib.urlopen.readlines()

2013-05-27 Thread Roy Smith
In article <10be5c62-4c58-4b4f-b00a-82d85ee4e...@googlegroups.com>, Bryan Britten wrote: > If I use the following code: > > > import urllib > > urlStr = "https://stream.twitter.com/1/statuses/sample.json"; > > fileHandle = urllib.urlopen(urlStr) > > twtrText = fileHandle.readlines() > > >

Re: Future standard GUI library

2013-05-27 Thread Roy Smith
In article , Chris Angelico wrote: > I'll use XML when I have to, but if I'm inventing my own protocol, > nope. There are just too many quirks with it. How do you represent an > empty string named Foo? > > > > or equivalently > > > > How do you represent an empty list named Foo? The same w

Re: detect key conflict in a JSON file

2013-05-29 Thread Roy Smith
In article , Jabba Laci wrote: > I have a growing JSON file that I edit manually and it might happen > that I repeat a key. If this happens, I would like to get notified. The real answer here is that JSON is probably not the best choice for large files that get hand-edited. For data that you

Re: detect key conflict in a JSON file

2013-05-29 Thread Roy Smith
hey both have the same GIGO issue. > How to process (read) YAML files in Python? Take a look at http://pyyaml.org/ --- Roy Smith r...@panix.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Short-circuit Logic

2013-05-30 Thread Roy Smith
In article , Chris Angelico wrote: > On Thu, May 30, 2013 at 3:10 PM, Steven D'Aprano > wrote: > > # Wrong, don't do this! > > x = 0.1 > > while x != 17.3: > > print(x) > > x += 0.1 > > > > Actually, I wouldn't do that with integers either. There are too many > ways that a subsequent e

Re: Short-circuit Logic

2013-05-30 Thread Roy Smith
In article , Jussi Piitulainen wrote: > I wonder why floating-point errors are not routinely discussed in > terms of ulps (units in last position). Analysis of error is a complicated topic (and is much older than digital computers). These sorts of things come up in the real world, too. For

Re: Short-circuit Logic

2013-05-30 Thread Roy Smith
In article , Nobody wrote: > On Thu, 30 May 2013 19:38:31 -0400, Dennis Lee Bieber wrote: > > > Measuring 1 foot from the 1000 foot stake leaves you with any error > > from datum to the 1000 foot, plus any error from the 1000 foot, PLUS any > > azimuth error which would contribute to shorte

Re: Short-circuit Logic

2013-05-31 Thread Roy Smith
In article <51a86319$0$29966$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > In an early talk Ken was explaining the advantages of tolerant > comparison. A member of the audience asked incredulously, > “Surely you don’t mean that when A=B and B=C, A may not equal C

Re: Python #ifdef

2013-06-02 Thread Roy Smith
In article , Erik Max Francis wrote: > On 05/29/2013 08:05 AM, Chris Angelico wrote: > > It's not a bad tool. I used it as a sort of PHP preprocessor, because > > requirements at work had me wanting to have a source file defining a > > PHP class and having an autogenerated section in the middle

Re: Beginner question

2013-06-04 Thread Roy Smith
In article , Larry Hudson wrote: > def partdeux(): > print('A man lunges at you with a knife!') > option = input('Do you DUCK or PARRY? ').lower() > success = random.randint(0, 1) > if success: > if option == 'duck': > print('He tumbles over you') >

Re: [ANNOUNCE] greenlet 0.4.1

2013-06-07 Thread Roy Smith
In article , Ralf Schmitt wrote: > Hi, > > I have uploaded greenlet 0.4.1 to PyPI: > https://pypi.python.org/pypi/greenlet > > What is it? > --- > The greenlet module provides coroutines for python. coroutines allow > suspending and resuming execution at certain locations. > > concurr

Re: Redirecting to a third party site with injected HTML

2013-06-09 Thread Roy Smith
On Sunday, June 9, 2013 8:22:17 PM UTC+3, Fábio Santos wrote: >> This does not seem like a python question, instead a HTML/JavaScript one. In article <0021fabe-78ed-4e79-8cdf-468b4ccc7...@googlegroups.com>, guytam...@gmail.com wrote: > its a python question since the request is received on a py

Re: [newbie] problem with if then

2013-06-09 Thread Roy Smith
In article , Jean Dubois wrote: > I'm writing some code to check whether an url is available or not, > therefore I make use of a wget-command in Linux and then check whether > this is successful In general, "shelling out" to run a command-line utility should be the last resort. It's slower,

Re: problem with if then

2013-06-09 Thread Roy Smith
In article <20165c85-4cc3-4b79-943b-82443e4a9...@w7g2000vbw.googlegroups.com>, Jean Dubois wrote: > But, really, > > once you've done all that (and it's worth doing as an exercise), rewrite > > your code to use urllib2 or requests.  It'll be a lot easier. > > Could you show me how to code the

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Roy Smith
In article , Rui Maciel wrote: > Essentially, a Model object stores lists of Point objects and Line objects, > and Line objects include references to Point objects which represent the > starting and ending point of a line. > > class Point: > position = [] > > def __init__(sel

Split a list into two parts based on a filter?

2013-06-10 Thread Roy Smith
I have a list, songs, which I want to divide into two groups. Essentially, I want: new_songs = [s for s in songs if s.is_new()] old_songs = [s for s in songs if not s.is_new()] but I don't want to make two passes over the list. I could do: new_songs = [] old_songs = [] for s in songs: if s.

Re: Split a list into two parts based on a filter?

2013-06-10 Thread Roy Smith
In article , Roel Schroeven wrote: > new_songs, old_songs = [], [] > [(new_songs if s.is_new() else old_songs).append(s) for s in songs] Thanks kind of neat, thanks. I'm trying to figure out what list gets created and discarded. I think it's [None] * len(songs). -- http://mail.python.org/ma

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Roy Smith
In article , Chris Angelico wrote: > On Wed, Jun 12, 2013 at 1:28 AM, Serhiy Storchaka wrote: > > 11.06.13 01:50, Chris Angelico написав(ла): > > > >> On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith wrote: > >>> > >>> new_songs = [s for s in

Re: Split a list into two parts based on a filter?

2013-06-11 Thread Roy Smith
In article , Serhiy Storchaka wrote: > 11.06.13 07:11, Roy Smith написав(ла): > > In article , > > Roel Schroeven wrote: > > > >> new_songs, old_songs = [], [] > >> [(new_songs if s.is_new() else old_songs).append(s) for s in songs] > >

Why doesn't nose see my plugin?

2013-06-11 Thread Roy Smith
I'm attempting to write a nose plugin. Nosetests (version 1.3.0) is not seeing it. I'm running python 2.7.3. The plugin itself is: mongo_reporter.py: import nose.plugins import logging log = logging.getLogger('nose.plugins.mongoreporter') clas

Re: Why doesn't nose see my plugin?

2013-06-11 Thread Roy Smith
In article <69d4486b-d2ff-4830-b16e-f3f6ea73d...@kt20g2000pbb.googlegroups.com>, alex23 wrote: > On Jun 12, 10:54 am, Roy Smith wrote: > > I'm attempting to write a nose plugin.  Nosetests (version 1.3.0) is not > > seeing it. > > &g

Re: Why doesn't nose see my plugin?

2013-06-11 Thread Roy Smith
In article <0d704515-46c9-486a-993c-ff5add3c9...@rh15g2000pbb.googlegroups.com>, alex23 wrote: > On Jun 12, 11:43 am, Roy Smith wrote: > > Just to see what would happen, I tried changing it to: > > > >     entry_points = { > >         

Re: Split a list into two parts based on a filter?

2013-06-12 Thread Roy Smith
In article , Phil Connell wrote: > > Well, continuing down this somewhat bizarre path: > > > > new_songs, old_songs = [], [] > > itertools.takewhile( > > lambda x: True, > > (new_songs if s.is_new() else old_songs).append(s) for s in songs) > > ) > > > > I'm not sure I got the syntax

Re: Why doesn't nose see my plugin? (FIXED)

2013-06-12 Thread Roy Smith
In article , Roy Smith wrote: >setup( >name = "Mongo Reporter", >version = "0.0", >entry_points = { >'nose.plugins.1.10': ['mongoreporter = mongo_reporter.MongoReporter'], >}, >) The problem turned ou

Re: Version Control Software

2013-06-12 Thread Roy Smith
In article <98c13a55-dbf2-46a7-a2aa-8c5f052ff...@googlegroups.com>, cutems93 wrote: > I am looking for an appropriate version control software for python > development, and need professionals' help to make a good decision. Currently > I am considering four software: git, SVN, CVS, and Mercuria

Re: Version Control Software

2013-06-13 Thread Roy Smith
In article <2644d0de-9a81-41aa-b27a-cb4535964...@googlegroups.com>, cutems93 wrote: > Thank you everyone for such helpful responses! Actually, I have one more > question. Does anybody have experience with closed source version control > software? If so, why did you buy it instead of downloadin

Re: Version Control Software

2013-06-13 Thread Roy Smith
In article , Tim Chase wrote: > On 2013-06-13 10:20, Serhiy Storchaka wrote: > > 13.06.13 05:41, Tim Chase написав(ла): > > > -hg: last I checked, can't do octopus merges (merges with more > > > than two parents) > > > > > > +git: can do octopus merges > > > > Actually it is possible i

Re: A certainl part of an if() structure never gets executed.

2013-06-13 Thread Roy Smith
In article <8a75b1e4-41e8-45b5-ac9e-6611a4698...@g9g2000pbd.googlegroups.com>, rusi wrote: > On Jun 12, 8:20 pm, Zero Piraeus wrote: > > : > > > > On 12 June 2013 10:55, Neil Cerutti wrote: > > > > > > > > > He's definitely trolling. I can't think of any other reason to > > > make it so hard

Re: My son wants me to teach him Python

2013-06-13 Thread Roy Smith
In article <545a441b-0c2d-4b1e-82ae-024b011a4...@e1g2000pbo.googlegroups.com>, rusi wrote: > Python is at least two things, a language and a culture. This is true of all languages. Hang out on the PHP, Ruby, Python, etc, forums and you quickly learn that the cultures are as different (or mor

Re: RFD: rename comp.lang.python to comp.support.superhost

2013-06-14 Thread Roy Smith
In article <8a333cd0-c1cf-4f41-ac49-65f0b23ed...@ow4g2000pbc.googlegroups.com>, alex23 wrote: > On Jun 14, 2:24 am, Íéêüëáïò Êïýñáò wrote: > > iam researchign a solution to this as we speak. > > Spamming endless "ZOMG HELP ME I'M INCOMPETENT" posts isn't "research". But it could be an argume

Re: Version Control Software

2013-06-14 Thread Roy Smith
In article , Anssi Saari wrote: > I have some experience with ClearCase. I don't know why anyone would buy > it since it's bloated and slow and hard to use and likes to take over > your computer. ClearCase was the right solution to certain specific problems which existed 20 years ago. It does

Re: Version Control Software

2013-06-15 Thread Roy Smith
In article , Chris Angelico wrote: > On Sat, Jun 15, 2013 at 3:39 PM, Tim Delaney > wrote: > > I can absolutely confirm how much ClearCase slows things down. I completely > > refused to use dynamic views for several reasons - #1 being that if you lost > > your network connection you couldn't wo

Re: A few questiosn about encoding

2013-06-15 Thread Roy Smith
In article , Grant Edwards wrote: > There is some ambiguity in the term "byte". It used to mean the > smallest addressable unit of memory (which varied in the past -- at > one point, both 20 and 60 bit "bytes" were common). I would have defined it more like, "some arbitrary collection of adja

Re: Version Control Software

2013-06-16 Thread Roy Smith
In article , Chris メKwpolskaモ Warrick wrote: > (I’m using wc -c to count the bytes in all files there are. du is > unaccurate with files smaller than 4096 bytes.) It's not that du is not accurate, it's that it's measuring something different. It's measuring how much disk space the file

Why is regex so slow?

2013-06-18 Thread Roy Smith
I've got a 170 MB file I want to search for lines that look like: [2010-10-20 16:47:50.339229 -04:00] INFO (6): songza.amie.history - ENQUEUEING: /listen/the-station-one This code runs in 1.3 seconds: -- import re pattern = re.compile(r'ENQUEUEING: /listen/(.*)') co

Re: Why is regex so slow?

2013-06-18 Thread Roy Smith
t; pattern, you could just as easily split the line yourself instead of > creating a group. At this point, I'm not so much interested in making this faster as understanding why it's so slow. I'm tempted to open this up as a performance bug against the regex module (which I assume

Re: Why is regex so slow?

2013-06-18 Thread Roy Smith
In article , Mark Lawrence wrote: > Out of curiousity have the tried the new regex module from pypi rather > than the stdlib version? A heck of a lot of work has gone into it see > http://bugs.python.org/issue2636 I just installed that and gave it a shot. It's *slower* (and, much higher var

Re: Why is regex so slow?

2013-06-18 Thread Roy Smith
On Tuesday, June 18, 2013 2:10:16 PM UTC-4, Johannes Bauer wrote: > Resulting file has a size of 91530018 and md5 of > > 2d20c3447a0b51a37d28126b8348f6c5 (just to make sure we're on the same > > page because I'm not sure the PRNG is stable across Python versions). If people want to test against m

Re: Why is regex so slow?

2013-06-18 Thread Roy Smith
On Tuesday, June 18, 2013 4:05:25 PM UTC-4, Antoine Pitrou wrote: > One invokes a fast special-purpose substring searching routine (the > str.__contains__ operator), the other a generic matching engine able to > process complex patterns. It's hardly a surprise for the specialized routine > to be f

Re: Why is regex so slow?

2013-06-19 Thread Roy Smith
On Wednesday, June 19, 2013 9:21:43 AM UTC-4, Duncan Booth wrote: > I'd just like to point out that your simple loop is looking at every > character of the input string. The simple "'ENQ' not in line" test can look > at the third character of the string and if it's none of 'E', 'N' or 'Q' > ski

Re: Default Value

2013-06-20 Thread Roy Smith
In article <447dd1c6-1bb2-4276-a109-78d7a067b...@d8g2000pbe.googlegroups.com>, rusi wrote: > > > def f(a, L=[]): > > >     L.append(a) > > >     return L > Every language has gotchas. This is one of python's. One of our pre-interview screening questions for Python programmers at Songza is ab

Re: Default Value

2013-06-20 Thread Roy Smith
In article <51c39b88$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Thu, 20 Jun 2013 09:19:48 -0400, Roy Smith wrote: > > > In article > > <447dd1c6-1bb2-4276-a109-78d7a067b...@d8g2000pbe.googlegroups.com>, > > rusi wrote: &g

Re: Default Value

2013-06-20 Thread Roy Smith
In article , Tim Chase wrote: > On 2013-06-21 01:08, Steven D'Aprano wrote: > > Here's my syntax plucked out of thin air: > > > > def func(arg, x=expression, !y=expression): > > ... > > > > where y=expression is late-bound, and the above is compiled to: > > > > def func(arg, x=expression,

Re: n00b question on spacing

2013-06-22 Thread Roy Smith
In article <51c66455$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about- > time Number 2 on the list is "Months have either 30 or 31 days", which was obviously believed by whoever made this sign: h

Re: n00b question on spacing

2013-06-23 Thread Roy Smith
In article <51c66a03$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sat, 22 Jun 2013 23:12:49 -0400, Roy Smith wrote: > > Number 2 on the list is "Months have either 30 or 31 days", which was > > obviously believed by whoever made t

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Roy Smith
In article <51c723b4$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sun, 23 Jun 2013 10:15:38 -0600, Ian Kelly wrote: > > > If you're worried about efficiency, you can also explicitly name the > > superclass in order to call the method directly, like: > > > >

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Roy Smith
In article , Ian Kelly wrote: > Yes, you're missing that super() does not simply call the base class, > but rather the next class in the MRO for whatever the type of the > "self" argument is. If you write the above as: > > class Base1(object): >def __init__(self, foo, **kwargs): > su

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Roy Smith
In article <51c74373$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sun, 23 Jun 2013 12:04:35 -0600, Ian Kelly wrote: > > > On Sun, Jun 23, 2013 at 11:36 AM, Steven D'Aprano > > wrote: > >> On Sun, 23 Jun 2013 11:18:41 -0600, Ian Kelly wrote: > >> > >>> Incidentally,

Re: Python development tools

2013-06-23 Thread Roy Smith
In article <263da442-0c87-41df-9118-6003c6168...@googlegroups.com>, ru...@yahoo.com wrote: > > 1. Automated Refactoring Tools > I wish. Why? I've never seen the appeal of these. I do plenty of refactoring. It's unclear to me what assistance an automated tool would provide. > > 2. Bug Track

Re: Python development tools

2013-06-23 Thread Roy Smith
In article , ru...@yahoo.com wrote: > > Other things like finding all uses of various objects/functions > etc would also be useful now and then but I suppose that is a > common IDE capability? $ find . -name '*.py' | xargs grep my_function_name seems to work for me. I suppose a language-awar

Re: Python development tools

2013-06-23 Thread Roy Smith
In article , Tim Chase wrote: > I'd wager money that Emacs allows you to do something similar, I'm sure it can. But, the next step in the evolution is: $ emacs `find . -name '*.py' | xargs grep -l my_function_name` -- http://mail.python.org/mailman/listinfo/python-list

Re: What is the semantics meaning of 'object'?

2013-06-23 Thread Roy Smith
In article <51c7a087$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sun, 23 Jun 2013 15:24:14 -0400, Roy Smith wrote: > > > In article <51c74373$0$2$c3e8da3$54964...@news.astraweb.com>, > > Steven D'Aprano wrote: > &g

Re: What is the semantics meaning of 'object'?

2013-06-24 Thread Roy Smith
In article <51c7fe14$0$29973$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Mixins are such a limited version of MI that it's often not even counted > as MI, and even when it is, being familiar with mixins is hardly > sufficient to count yourself as familiar with MI. OK, fair e

Re: Looking for a name for a deployment framework...

2013-06-24 Thread Roy Smith
In article <8b0d8931-cf02-4df4-8f17-a47ddd279...@googlegroups.com>, jonathan.slend...@gmail.com wrote: > Hi all, > > Any suggestions for a good name, for a framework that does automatic server > deployments? > > It's like Fabric, but more powerful. > It has some similarities with Puppet, Chef

Re: Looking for a name for a deployment framework...

2013-06-24 Thread Roy Smith
In article , Cousin Stanley wrote: > jonathan.slend...@gmail.com wrote: > > > Any suggestions for a good name, > > for a framework that does > > automatic server deployments ? > > asdf : automatic server deployment framework I prefer: Quite Wonderful Electronic Rollout Tool -- http://m

Re: Looking for a name for a deployment framework...

2013-06-26 Thread Roy Smith
In article , xDog Walker wrote: > On Tuesday 2013 June 25 19:16, Dave Angel wrote: > > On 06/25/2013 03:38 PM, Stig Sandbeck Mathisen wrote: > > > jonathan.slend...@gmail.com writes: > > >> Any suggestions for a good name, for a framework that does automatic > > >> server deployments? > > Yet A

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Roy Smith
In article , Andrew Berg wrote: > I've begun writing a program with an interactive prompt, and it needs to > parse input from the user. I thought the argparse module would be > great for this, but unfortunately it insists on calling sys.exit() at any > sign of trouble instead of letting its Ar

Re: Why is the argparse module so inflexible?

2013-06-29 Thread Roy Smith
In article , Terry Reedy wrote: > > So a library that behaves like an app is OK? > > No, Steven is right as a general rule (do not raise SystemExit), but > argparse was considered an exception because its purpose is to turn a > module into an app. With the responses I have seen here, I agree

Re: Unittest fails to import module

2013-06-29 Thread Roy Smith
In article , Martin Schöön wrote: > I know the answer to this must be trivial but I am stuck... > > I am starting on a not too complex Python project. Right now the > project file structure contains three subdirectories and two > files with Python code: > > code >blablabla.py > test >b

Re: Stupid ways to spell simple code

2013-06-30 Thread Roy Smith
In article <51d06cb6$0$2$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sun, 30 Jun 2013 16:06:35 +1000, Chris Angelico wrote: > > > So, here's a challenge: Come up with something really simple, and write > > an insanely complicated - yet perfectly valid - way to achieve t

Re: Python list code of conduct

2013-07-02 Thread Roy Smith
In article , Ned Deily wrote: > If you find a bug in Python, don't send it to comp.lang.python; file > a bug report in the issue tracker. I'm not sure I agree with that one, at least not fully. It's certainly true that you shouldn't expect anybody to do anything about a bug unless you open

Re: Python - forking an external process?

2013-07-02 Thread Roy Smith
In article <14be21de-2ceb-464a-a638-dce0368ab...@googlegroups.com>, Victor Hooi wrote: > Hi, > > I have a Python script where I want to run fork and run an external command > (or set of commands). > > For example, after doing , I then want to run ssh to a host, handover > control back to the

Re: Bug reports [was Re: Python list code of conduct]

2013-07-03 Thread Roy Smith
In article , Chris Angelico wrote: > Of course, it's possible for there to be dark corners. But if you're > working with those, you know it full well. The dark corners of Python > might be in some of its more obscure modules, or maybe in IPv6 > handling, The sad thing about this statement is th

Re: Python list code of conduct

2013-07-03 Thread Roy Smith
In article , Terry Reedy wrote: > 6. If you make an informed post to the tracker backed up by at least > opinion, at least one tracker responder be in a better mode when responding. What I generally do is summarize the problem in the tracker, but also include a link to the google groups archi

Re: Bug reports [was Re: Python list code of conduct]

2013-07-03 Thread Roy Smith
In article , Chris Angelico wrote: > On Thu, Jul 4, 2013 at 12:03 AM, Roy Smith wrote: > > In article , > > Chris Angelico wrote: > > > >> Of course, it's possible for there to be dark corners. But if you're > >> working with those,

Re: Bug reports [was Re: Python list code of conduct]

2013-07-03 Thread Roy Smith
In article , Grant Edwards wrote: > On 2013-07-03, Roy Smith wrote: > > In article , > > Chris Angelico wrote: > > > >> Of course, it's possible for there to be dark corners. But if you're > >> working with those, you know it full well. The da

Re: Important features for editors

2013-07-04 Thread Roy Smith
In article , Joshua Landau wrote: [talking about Sublime Text] > There's, instead of a scrollbar, a little "bird's-eye-view" of the > whole code on the RHS. I've never used it myself, but there's a couple of guys in the office who do. I have to admit, this feature looks pretty neat. Does Sub

Re: Important features for editors

2013-07-05 Thread Roy Smith
In article , Rustom Mody wrote: > > I'm a vi user. Once I mastered "hit ESC by reflex when you pause > > typing an insert" I was never confused above which mode I was in. > > > > And now my fingers know vi. All the vi you need to know: : q ! -- http://mail.python.org/mailman/listinfo/python

Re: Editor Ergonomics [was: Important features for editors]

2013-07-11 Thread Roy Smith
In article <2fdf282e-fd28-4ba3-8c83-ce120...@googlegroups.com>, jus...@zeusedit.com wrote: > On Wednesday, July 10, 2013 2:17:12 PM UTC+10, Xue Fuqiao wrote: > > > * It is especially handy for selecting and deleting text. > > When coding I never use a mouse to select text regions or to dele

Re: Question about mailing list rules

2013-07-12 Thread Roy Smith
In article , Chris Angelico wrote: > On Fri, Jul 12, 2013 at 9:59 AM, Devyn Collier Johnson > wrote: > > Am I allowed to ask questions like "Here is my code. How can I optimize it?" > > on this mailing list? > > Sure you can! And you'll get a large number of responses, not all of > which are d

Re: help with explaining how to split a list of tuples into parts

2013-07-13 Thread Roy Smith
In article , pe...@ifoley.id.au wrote: > Hi List, > > I am new to Python and wondering if there is a better python way to do > something. As a learning exercise I decided to create a python bash script > to wrap around the Python Crypt library (Version 2.7). > > My attempt is located here -

Re: help with explaining how to split a list of tuples into parts

2013-07-13 Thread Roy Smith
In article <892e3baa-b214-4c57-a828-a51db0ff7...@googlegroups.com>, pe...@ifoley.id.au wrote: > In my defence I was trying to give some context for my problem domain. I think posting a link to the github page was perfectly fine. It wasn't a huge amount of code to look at, and the way github pr

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Roy Smith
In article , ÉΪɫɻόλας wrote: > But it works for me, How can it be impossible and worked for me at the > same time? > > Also i tried some other website that asked me to allow it to run a > javascript on my browser and it pinpointed even my street! > > If it wasnt possbile then Max

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > Obviously a fixed IP will be tied to a fixed connection and thereby to > a fixed location which can be provided to a location database. And even then, it can be wrong. When I worked for EMC, they (apparently, from what I could see) back-hauled internet

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Roy Smith
In article , ÉΪɫɻόλας wrote: > But then how do you explain the fact that > http://www.maxmind.com/en/geoip_demo pinpointed Thessalon£ki and not > Athens and for 2 friends of mine that use the same ISP as me but live > in different cities also accurately identified their locations

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Roy Smith
In article , ÉΪɫɻόλας wrote: > > There are lots of interesting (and superior) ways to do geolocation > > other than looking up IP addresses. Here's a few: > . [...] > > In general, mobile operating systems control direct access to all of > > these signals and only allow applications

Re: Ideal way to separate GUI and logic?

2013-07-14 Thread Roy Smith
In article , Joel Goldstick wrote: > Writing code isn't all theory. It takes practice, and since the days > of The Mythical Man-Month, it has been well understood that you > always end up throwing away the first system anyway. If I may paraphrase Brooks, "Plan to throw the first one away, be

Re: UTF-EBCDIC encoding?

2013-07-15 Thread Roy Smith
In article , Owen Marshall wrote: > On 2013-07-12, Joel Goldstick wrote: > > --047d7bdc8be492d67804e154c580 Content-Type: text/plain; charset=UTF-8 > > > > On Fri, Jul 12, 2013 at 2:11 PM, Wayne Werner > > wrote: > > > >> Is anyone aware of a UTF-EBCDIC[1] decoder? > >> > >> While Python does

Re: grimace: a fluent regular expression generator in Python

2013-07-17 Thread Roy Smith
In article , "Anders J. Munch" <2...@jmunch.dk> wrote: > The problem with Perl-style regexp notation isn't so much that it's terse - > it's > that the syntax is irregular (sic) and doesn't follow modern principles for > lexical structure in computer languages. There seem to be three basic way

Re: Designing a Pythonic search DSL for SQL and NoSQL databases

2013-07-19 Thread Roy Smith
In article , Alec Taylor wrote: > Dear Python community, > > I am analysing designing an abstraction layer over a select few NoSQL > and SQL databases. > > Specifically: > > - Redis, Neo4j, MongoDB, CouchDB > - PostgreSQL This isn't really a Python question. Before you even begin to think a

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

2013-07-20 Thread Roy Smith
In article <6bf4d298-b425-4357-9c1a-192e6e6cd...@googlegroups.com>, pablobarhamal...@gmail.com wrote: > Ok, I'm working on a predator/prey simulation, which evolve using genetic > algorithms. At the moment, they use a quite simple feed-forward neural > network, which can change size over time.

Re: Homework help requested, thanks to everyone.

2013-07-21 Thread Roy Smith
In article , Chris Angelico wrote: > 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 simp

collections.Counter surprisingly slow

2013-07-28 Thread Roy Smith
I've been doing an informal "intro to Python" lunchtime series for some co-workers (who are all experienced programmers, in other languages). This week I was going to cover list comprehensions, exceptions, and profiling. So, I did a little demo showing different ways to build a dictionary coun

Re: collections.Counter surprisingly slow

2013-07-28 Thread Roy Smith
In article <51f5843f$0$29971$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > > Why is count() [i.e. collections.Counter] so slow? > > It's within a factor of 2 of test, and 3 of exception or default (give or > take). I don't think that's surprisingly slow. It is for a module whi

Finding absolute path of imported module?

2012-06-19 Thread Roy Smith
We're trying to debug a weird (and, of course, intermittent) problem a gunicorn-based web application. Our production directory structure looks like: deploy/ rel-2012-06-14/ rel-2012-06-12/ rel-2012-06-11/ current -> rel-2012006-14 Each time we deploy a new version, we create a new relea

Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-20 Thread Roy Smith
In article , Chris Angelico wrote: > Well, for communication it's even easier. Pick up an SSL or SSH > library and channel everything through that! +1 on this. Actually, plus a whole bunch more than 1. I worked on a project which had rolled their own communication layer (including encryption).

emded revision control in Python application?

2012-06-22 Thread duncan smith
Hello, I have an application that would benefit from collaborative working. Over time users construct a "data environment" which is a number of files in JSON format contained in a few directories (in the future I'll probably place these in a zip so the environment is contained within a s

Re: emded revision control in Python application?

2012-06-22 Thread duncan smith
On 22/06/12 17:42, Emile van Sebille wrote: On 6/22/2012 8:58 AM duncan smith said... Hello, I have an application that would benefit from collaborative working. Over time users construct a "data environment" which is a number of files in JSON format contained in a few directories

Re: emded revision control in Python application?

2012-06-22 Thread duncan smith
On 22/06/12 21:34, Emile van Sebille wrote: On 6/22/2012 11:19 AM duncan smith said... On 22/06/12 17:42, Emile van Sebille wrote: On 6/22/2012 8:58 AM duncan smith said... Hello, I have an application that would benefit from collaborative working. Over time users construct a "

Re: emded revision control in Python application?

2012-06-23 Thread duncan smith
On 23/06/12 06:45, rusi wrote: On Jun 22, 8:58 pm, duncan smith wrote: Hello, I have an application that would benefit from collaborative working. Over time users construct a "data environment" which is a number of files in JSON format contained in a few directories (in the f

Re: Why has python3 been created as a seperate language where there is still python2.7 ?

2012-06-27 Thread Roy Smith
In article , rantingrickjohn...@gmail.com wrote: > On Monday, June 25, 2012 5:10:47 AM UTC-5, Michiel Overtoom wrote: > > It has not. Python2 and Python3 are very similar. It's not like if > > you learn Python using version 2, you have to relearn the language > > when you want to switch Python3.

json.loads() should return a more specific error

2012-06-27 Thread Roy Smith
Before I go open an enhancement request, what do people think of the idea that json.load() should return something more specific than ValueError? I've got some code that looks like try: response = requests.get(url) except RequestException as ex: logger.exception(ex)

Re: Dictless classes

2012-07-03 Thread Roy Smith
In article , Duncan Booth wrote: > Also you cannot create a subclass of 'type' with non-empty slots (it throws > a type error "nonempty __slots__ not supported for subtype of 'type'"). > However I don't think that's really relevant as even if they did allow you > to use __slots__ it wouldn't

Re: code review

2012-07-03 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > On 03 Jul 2012 04:11:22 GMT, Steven D'Aprano > declaimed the following in > gmane.comp.python.general: > > > > One of my favourites is the league, which in the Middle Ages was actually > > defined as the distance that a man, or a horse, could walk in a

Re: Using a CMS for small site?

2012-07-04 Thread Roy Smith
In article , Gilles wrote: > Hello > > Someone I know with no computer knowledge has a studio appartment to > rent in Paris and spent four months building a small site in Joomla to > find short-time renters. > > The site is just... > - a few web pages that include text (in four languages) and

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