Re: standalone python web server

2012-02-08 Thread Roy Smith
In article , Rodrick Brown wrote: > On Feb 8, 2012, at 11:01 PM, Rita wrote: > > > I am building a small intranet website and I would like to use Python. I > > was wondering if there was a easy and medium performance python based web > > server available. I would like to run it on port :8080

Re: turbogears 1

2012-02-09 Thread Roy Smith
In article , anon hung wrote: > >> Hey guys, someone asked me to maintain his old website, trouble is, > >> it's in python, more trouble is it's in turbogears 1. I'm not fluent > >> in python but all right, I can learn, but this turbogears > >> thing.. > >> > >> First of all, is it still

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Chris Angelico wrote: > On Sun, Feb 12, 2012 at 1:36 PM, Rick Johnson > wrote: > > On Feb 11, 8:23 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > >> "I have a file containing text. I can open it in an editor and see it's > >> nearly all ASCII text, except for a fe

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article <4f375347$0$29986$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > ASCII truly is a blight on the world, and the sooner it fades into > obscurity, like EBCDIC, the better. That's a fair statement, but it's also fair to say that at the time it came out (49 years ago!) i

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > On Sun, 12 Feb 2012 10:48:36 -0500, Roy Smith wrote: > > >As Steven D'Aprano pointed out, it was missing some commonly used US > >symbols such as ¢ or ©. That's interesting. When I wrote that, it showed on my sc

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , rusi wrote: > On Feb 12, 10:51 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > > On Sun, 12 Feb 2012 15:38:37 +1100, Chris Angelico wrote: > > > Everything that displays text to a human needs to translate bytes into > > > glyphs, and the usual way to do this conceptu

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Terry Reedy wrote: > Let me repeat. Unicode and utf-8 is a solution to the mess, not the > cause. Perhaps we should have a synonym for utf-8: escii, for Earthian > Standard Code for Information Interchange. I'm not arguing that Unicode is where we need to get to. Just trying to

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Feb 13, 2012 at 9:07 AM, Terry Reedy wrote: > > The situation before ascii is like where we ended up *before* unicode. > > Unicode aims to replace all those byte encoding and character sets with > > *one* byte encoding for *one* character set, which

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article <4f384b6e$0$29986$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > > I could hope for one and only one, but I know I'm just going to be > > disapointed. The last project I worked on used UTF-8 in most places, > > but also used some C and Java libraries which were only av

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Chris Angelico wrote: > The advantage, though, is that you can always know how many bytes to > read for X characters. In ASCII, you allocate 80 bytes of storage and > you can store 80 characters. In UTF-8, if you want an 80-character > buffer, you can probably get away with allocati

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Terry Reedy wrote: > On 2/12/2012 5:14 PM, Chris Angelico wrote: > > On Mon, Feb 13, 2012 at 9:07 AM, Terry Reedy wrote: > >> The situation before ascii is like where we ended up *before* unicode. > >> Unicode aims to replace all those byte encoding and character sets with > >> *on

What does exc_info do in a logging call?

2012-02-23 Thread Roy Smith
In http://docs.python.org/release/2.6.7/library/logging.html, it says: logging.debug(msg[, *args[, **kwargs]]) [...] There are two keyword arguments in kwargs which are inspected: exc_info which, if it does not evaluate as false, causes exception information to be added to the logging message. I

Re: What does exc_info do in a logging call?

2012-02-23 Thread Roy Smith
Duh, I figured out what's going on. I'm using a custom Formatter class, which overrides format(). It's the job of format() to handle this, and ours doesn't! -- http://mail.python.org/mailman/listinfo/python-list

Re: Just curious: why is /usr/bin/python not a symlink?

2012-02-24 Thread Roy Smith
In article , Thomas Rachel wrote: > Not only that, [hard and symbolic links] have slightly different > semantics. This is true, but only for very large values of "slightly". Symlinks, for example, can cross file system boundaries (including NFS mount points). Symlinks can refer to locat

Re: sum() requires number, not simply __add__

2012-02-24 Thread Roy Smith
In article , Antoon Pardon wrote: > > Python doesn't try to prevent people from shooting themselves in the foot. > > > Yes it does! A simple example is None as a keyword to prevent > assignments to it. Hmmm. Just playing around with some bizarre things to do with None, and discovered thi

Re: are int, float, long, double, side-effects of computer engineering?

2012-03-06 Thread Roy Smith
[intentionally violating the followup-to header] In article <7ol5r.29957$zd5.14...@newsfe12.iad>, Chiron wrote: > On Mon, 05 Mar 2012 22:34:46 -0800, Xah Lee wrote: > > > while what you said is true, but the problem is that 99.99% of > > programers do NOT know this. They do not know Mathematic

Re: What's the best way to write this regular expression?

2012-03-06 Thread Roy Smith
In article <12783654.1174.1331073814011.JavaMail.geo-discussion-forums@yner4>, John Salerno wrote: > I sort of have to work with what the website gives me (as you'll see below), > but today I encountered an exception to my RE. Let me just give all the > specific information first. The point o

Re: nmea

2012-03-10 Thread Roy Smith
In article , "Johannes Wagner" wrote: > can any1 help me on how to get python to read nmea data? I assume you're talking about National Marine Electronics Association, i.e. the protocol GPSs use to talk to plotters and the like? A quick google search for "nmea python" found a bunch of good h

Re: How to re-implement the crypt.crypt function?

2012-03-10 Thread Roy Smith
In article <28304124.1374.1331408016748.JavaMail.geo-discussion-forums@yncd8>, Cosmia Luna wrote: > I'm not searching for a full solution and only want to know how to use > hashlib to create a equivalent string like > > crypt.crypt('123456', '$6$ds41p/9VMA.BHH0U') returns the string below.

Re: How to re-implement the crypt.crypt function?

2012-03-10 Thread Roy Smith
In article , Christian Heimes wrote: > Am 10.03.2012 21:15, schrieb Roy Smith: > > By today's standards, the algorithm isn't considered very strong. The > > only place I'm aware that uses it is unix password files, and even there > > many (most?) sys

Re: How to break long method name into more than one line?

2012-03-11 Thread Roy Smith
In article , Herman wrote: > I am trying to stick to the rule described in the TDD book that, each > test method name consists of the method name to be tested, inputs and > the expected outputs. It takes up a lot of space and my company has a > rule of limiting 79 characters (or 80) per line. I

Re: What's the best way to parse this HTML tag?

2012-03-11 Thread Roy Smith
In article <239c4ad7-ac93-45c5-98d6-71a434e1c...@r21g2000yqa.googlegroups.com>, John Salerno wrote: > Getting the time that the song is played is easy, because the time is > wrapped in a tag all by itself with a class attribute that has a > specific value I can search for. But the actual song

Re: How to break long method name into more than one line?

2012-03-11 Thread Roy Smith
In article <4f5d4390$0$29891$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > You can't split tokens over multiple lines, or put any whitespace > between them. Well, if you truly wanted to be perverse, you could write some kind of decorator: @make_long_named_test_method('some',

Re: What's the best way to parse this HTML tag?

2012-03-12 Thread Roy Smith
In article , John Salerno wrote: > Well, I had considered exactly that method, but I don't know for sure > if the titles and names will always have links like that, so I didn't > want to tie my programming to something so specific. But perhaps it's > still better than just taking the first two

Enchancement suggestion for argparse: intuit type from default

2012-03-13 Thread Roy Smith
Using argparse, if I write: parser.add_argument('--foo', default=100) it seems like it should be able to intuit that the type of foo should be int (i.e. type(default)) without my having to write: parser.add_argument('--foo', type=int, default=100) Does this seem like a reasonable enhanc

Re: Enchancement suggestion for argparse: intuit type from default

2012-03-14 Thread Roy Smith
In article <87399bgw18@benfinney.id.au>, Ben Finney wrote: > Right. I dislike proposals for run-time type inference in Python, since > they are too magical. > > Especially since we're talking about user input (arguments from the > command line to the program); that requires more explicit de

Re: Enchancement suggestion for argparse: intuit type from default

2012-03-14 Thread Roy Smith
In article <4f612a9d$0$12033$742ec...@news.sonic.net>, John Nagle wrote: > On 3/13/2012 2:08 PM, Roy Smith wrote: > > Using argparse, if I write: > > > > parser.add_argument('--foo', default=100) > > > > it seems like it should be able to i

Re: Enchancement suggestion for argparse: intuit type from default

2012-03-15 Thread Roy Smith
In article , Robert Kern wrote: > Yes. Not all type(default) types can be called with a string to produce a > valid > value. Note that "type=" is really a misnomer. argparse doesn't really want a > type object there; it wants a converter function that takes a string to an > object. Orthogon

Re: Python is readable

2012-03-15 Thread Roy Smith
In article , Chris Angelico wrote: > I use gcc/g++ with most of the new features enabled. There's some > pretty handy features in it. Frankly, though, if I'd known about > Cython when I started the current project, I would have argued to > write it all in Python and Cify (is that a word?) the mo

Re: Python is readable

2012-03-15 Thread Roy Smith
In article , Chris Angelico wrote: > "We're talking about a file that someone's uploaded to us, so it > won't matter". Whatever processing we do is massively dwarfed by > network time, and both scale linearly with the size of the file. That last part (both scaling linearly) may not be true.

Re: Python simulate browser activity

2012-03-16 Thread Roy Smith
In article <214c4c0c-f8ec-4030-946b-8becc8e1a...@ur9g2000pbc.googlegroups.com>, choi2k wrote: > Hi, everyone > > I am trying to write a small application using python but I am not > sure whether it is possible to do so.. > The application aims to simulate user activity including visit a > webs

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Roy Smith
In article , Antti J Ylikoski wrote: > I came across the problem, which would be the clearest way to program > such algorithms with a programming language such as Python, which has > no GOTO statement. It struck me that the above construction actually > is a modified Deterministic Finite Automa

Released: stackprint -- analyze python stack dumps in server logs

2012-03-20 Thread Roy Smith
Stackprint is a little tool for finding, formatting, and categorizing python stack dumps in server log files. We've found it useful for monitoring the health of our django applications. https://bitbucket.org/roysmith/python-tools. BSD license. -- http://mail.python.org/mailman/listinfo/python-

Re: Documentation, assignment in expression.

2012-03-23 Thread Roy Smith
In article <4f6d0060$0$6634$9b4e6...@newsspool2.arcor-online.net>, Alexander Blinne wrote: > The last sentence "For example, in the current version of Python file > objects support the iterator protocol, so you can now write simply > (for line in file:)" ... In general, words like "current",

Re: verbs in comments [OT]

2012-03-24 Thread Roy Smith
In article , Chris Angelico wrote: > It's funny how these things go. There are multiple distinct > conventions, and regarding function definition comments (or > docstrings), both of those do definitely exist. I think I've seen more > code in the second form ("this is what this code does"), but b

Re: OAuth 2.0 implementation

2012-03-26 Thread Roy Smith
In article <87haxahh51@benfinney.id.au>, Ben Finney wrote: > Demian Brecht writes: > > > I'm getting close to an alpha release of an OAuth 2.0 implementation > > (https://github.com/demianbrecht/py-sanction). > > Thank you for doing this work. > > As someone who uses OpenID, what can I r

Re: OAuth 2.0 implementation

2012-03-26 Thread Roy Smith
In article <878vimhfdp@benfinney.id.au>, Ben Finney wrote: > Roy Smith writes: > > > In article <87haxahh51@benfinney.id.au>, > > Ben Finney wrote: > > > As someone who uses OpenID, what can I read about why OAuth is better? > > > &g

Re: OAuth 2.0 implementation

2012-03-27 Thread Roy Smith
In article <7909491.0.1332826232743.JavaMail.geo-discussion-forums@pbim5>, Demian Brecht wrote: > OAuth 2.0 is still in draft status (draft 25 is the current one I believe) > and yes, unfortunately every single server available at this point have > varying degrees of separation from the actua

Re: tabs/spaces (was: Re: unittest: assertRaises() with an instance instead of a type)

2012-03-29 Thread Roy Smith
In article <0ved49-hie@satorlaser.homedns.org>, Ulrich Eckhardt wrote: > I didn't consciously use tabs, actually I would rather avoid them. That > said, my posting looks correctly indented in my "sent" folder and also > in the copy received from my newsserver. What could also have an > in

Re: Best way to structure data for efficient searching

2012-04-03 Thread Roy Smith
> On 3/28/2012 11:39 AM, larry.mart...@gmail.com wrote: > > I have a set of data that is contains 3 fields, K1, K2 and a > > timestamp. There are duplicates in the data set, and they all have to > > processed. > > > > Then I have another set of data with 4 fields: K3, K4, K5, and a > > timestamp. T

Re: No os.copy()? Why not?

2012-04-04 Thread Roy Smith
On Tue, 03 Apr 2012 15:46:31 -0400, D'Arcy Cain wrote: > > cp is not a system command, it's a shell command. Why not just use the > > incredibly simple and portable > > > >>>>open("outfile", "w").write(open("infile").read()) In article <4f7be1e8$0$2$c3e8da3$54964...@news.astraweb.com>,

Re: No os.copy()? Why not?

2012-04-04 Thread Roy Smith
In article <87fwcj4zru@dpt-info.u-strasbg.fr>, Alain Ketterlin wrote: > And sparse files are really hard to reproduce, at least on Unix: on > Linux even the system's cp doesn't guarantee sparseness of the copy (the > manual mentions a "crude heuristic"). I imagine the heuristic is to look f

Re: Python Gotcha's?

2012-04-05 Thread Roy Smith
In article <4f7d896f$0$29983$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > > You mean JSON expects a string with valid JSON? Quelle surprise. > > No. The surprise is that there exists a tool invented in the 21st century > that makes a distinction between strings quoted with " a

Re: Python Gotcha's?

2012-04-05 Thread Roy Smith
In article , Grzegorz Staniak wrote: > On 05.04.2012, Roy Smith wroted: > > > There's absolutely no reason why JSON should follow Python syntax > > rules. Making it support either kind of quotes would have > > complicated every JSON library in the world, for no ad

Re: Python Gotcha's?

2012-04-05 Thread Roy Smith
In article , John Gordon wrote: > In <7367295.815.1333578860181.JavaMail.geo-discussion-forums@ynpp8> Miki > Tebeka writes: > > > Greetings, > > > I'm going to give a "Python Gotcha's" talk at work. > > If you have an interesting/common "Gotcha" (warts/dark corners ...) > > please share. >

Re: Python Gotcha's?

2012-04-05 Thread Roy Smith
In article <4f7de152$0$29983$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I'm not the only one who has had trouble with JSON's poor design choice: This is getting a bit off-topic. If you wish to argue that JSON is designed poorly, you should do that in some appropriate JSON f

Re: Python Gotcha's?

2012-04-06 Thread Roy Smith
In article , mwil...@the-wire.com wrote: > rusi wrote: > > > Are there languages (other than python) in which single and double > > quotes are equivalent? > > Kernighan and Plauger's RATFOR (a pre-processor that added some C-like > syntax to FORTRAN) did that. Published in their book _Softwar

Re: Python Gotcha's?

2012-04-08 Thread Roy Smith
In article , John Nagle wrote: > 1. Nobody is really in charge of third party packages. In the > Perl world, there's a central repository, CPAN, and quality > control. Python's "pypi" is just a collection of links. Many > major packages are maintained by one person, and if they lose > intere

Re: f python?

2012-04-09 Thread Roy Smith
In article <4f82d3e2$1$fuzhry+tra$mr2...@news.patriot.net>, Shmuel (Seymour J.) Metz wrote: > >Null terminated strings have simplified all kids of text > >manipulation, lexical scanning, and data storage/communication > >code resulting in immeasurable savings over the years. > > Yeah, especial

Re: [newbie] help with pygame-tutorial

2012-04-09 Thread Roy Smith
In article <1a558398-3984-4b20-8d67-a0807871b...@v1g2000yqm.googlegroups.com>, aapeetnootjes wrote: > I'm trying out the pygame tutorial at > http://www.pygame.org/docs/tut/intro/intro.html > If I try out the code I'm facing an error: > ./game.py: line 4: syntax error at unexpected symbol 'si

Deep merge two dicts?

2012-04-12 Thread Roy Smith
Is there a simple way to deep merge two dicts? I'm looking for Perl's Hash::Merge (http://search.cpan.org/~dmuey/Hash-Merge-0.12/Merge.pm) in Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: Framework for a beginner

2012-04-17 Thread Roy Smith
In article , Bryan wrote: > Django has emphasized backwards compatibility with the > down-side that, last I heard, there was no plan to move to Python 3. Hardly. See https://www.djangoproject.com/weblog/2012/mar/13/py3k/ I agree that Django is probably what the OP should be looking at, for

Re: Framework for a beginner

2012-04-19 Thread Roy Smith
In article <4f8ff38c$0$1381$4fafb...@reader1.news.tin.it>, Kiuhnm wrote: > I don't like when a community imposes style on a programmer. For > instance, many told me that I shouldn't use camelCase and I should > adhere to PEP8. > Well, that's not me. I write my code the way I like it and if tha

How do you refer to an iterator in docs?

2012-04-19 Thread Roy Smith
Let's say I have a function which takes a list of words. I might write the docstring for it something like: def foo(words): "Foo-ify words (which must be a list)" What if I want words to be the more general case of something you can iterate over? How do people talk about that in docstrings

Re: How do you refer to an iterator in docs?

2012-04-20 Thread Roy Smith
In article <4f910c3d$0$29965$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I refer you to your subject line: > > "How do you refer to an iterator in docs?" > > In documentation, I refer to an iterator as an iterator, just as I would > refer to a list as a list, a dict as a dic

Re: why () is () and [] is [] work in other way?

2012-04-20 Thread Roy Smith
In article <877gxajit0@dpt-info.u-strasbg.fr>, Alain Ketterlin wrote: > Tuples are immutable, while lists are not. If you really want to have fun, consider this classic paradox: >>> [] is [] False >>> id([]) == id([]) True -- http://mail.python.org/mailman/listinfo/python-list

Re: How do you refer to an iterator in docs?

2012-04-20 Thread Roy Smith
In article <4f921a2d$0$29965$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Fri, 20 Apr 2012 09:41:25 -0400, Roy Smith wrote: > > > In article <4f910c3d$0$29965$c3e8da3$54964...@news.astraweb.com>, > > Steven D'Aprano wrote: &g

Re: Newbie, homework help, please.

2012-04-21 Thread Roy Smith
In article <32945367.2045.1335029313436.JavaMail.geo-discussion-forums@ynjn4>, someone wrote: I'm not going to do your homework for you (nor do I expect anybody else will), but I'll give you a hint about one sticky part. > 6) Display the SHI data read from the file in the interpreter with a b

Re: Newbie, homework help, please.

2012-04-21 Thread Roy Smith
On 04/21/12 14:44, Roy Smith wrote: > print "* %-*s *" % (max_length, data) On Apr 21, 2012, at 4:12 PM, Tim Chase wrote: > Sounds like a lot more work and less flexible than using the (underemployed) > .ljust() or .center() methods of a string. :-) > > print "

Re: global vars across modules

2012-04-22 Thread Roy Smith
In article <2652842.660.1335123578432.JavaMail.geo-discussion-forums@pbckz3>, mambokn...@gmail.com wrote: > I need to use global var across files/modules: [...] > Question: > How can I access to the global 'a' in file_2 without resorting to the whole > name 'file_1.a' ? Answer 1: You can't. A

Re: global vars across modules

2012-04-22 Thread Roy Smith
In article <11146533.5.1335125285850.JavaMail.geo-discussion-forums@pboo1>, mambokn...@gmail.com wrote: > On Sunday, April 22, 2012 12:48:23 PM UTC-7, Roy Smith wrote: > > > Answer 1: You can't. > > > > Answer 2: You might want to look at thread local s

Re: why () is () and [] is [] work in other way?

2012-04-25 Thread Roy Smith
In article <4f9833ff$0$29965$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Wed, 25 Apr 2012 13:42:31 +0200, Thomas Rachel wrote: > > > Two objects can be equal (=) without being identical (≡), but not the > > other way. > > > >>> x = float('nan') > >>> y = x > >>> x is y

Half-baked idea: list comprehensions with "while"

2012-04-26 Thread Roy Smith
I'm not seriously suggesting this as a language addition, just an interesting idea to simplify some code I'm writing now: x = [a for a in iterable while a] which equates to: x = [] for a in iterable: if not a: break x.append(a) It does has a few things going for it. It doesn't

Re: CPython thread starvation

2012-04-28 Thread Roy Smith
In article <7xy5pgqwto@ruckus.brouhaha.com>, Paul Rubin wrote: > John Nagle writes: > >I may do that to prevent the stall. But the real problem was all > > those DNS requests. Parallizing them wouldn't help much when it took > > hours to grind through them all. > > True dat. But bui

Re: Communication between C++ server and Python app

2012-04-28 Thread Roy Smith
In article <108cb846-6bb9-4600-a984-2fded0c91...@er9g2000vbb.googlegroups.com>, kenk wrote: > Hi, > > I've got a server process written in C++ running on Unix machine. > On the same box I'd like to run multiple Python scripts that will > communicate with this server. > > Can you please sugges

Re: CPython thread starvation

2012-04-29 Thread Roy Smith
In article <7xipgj8vxh@ruckus.brouhaha.com>, Paul Rubin wrote: > Roy Smith writes: > > I agree that application-level name cacheing is "wrong", but sometimes > > doing it the wrong way just makes sense. I could whip up a simple > > cacheing wrap

Expand RFC-2445 (iCalendar) recurrence rule?

2012-05-08 Thread Roy Smith
Does there exist a stand-alone module to expand RFC-2445 recurrence rule? The idea is to start with a string like: "RRULE:FREQ=WEEKLY;COUNT=6;INTERVAL=2;BYDAY=FR" and derive a list of dates on which that event occurs. I'm aware of http://codespeak.net/icalendar/, but that solves a much larger

Re: Expand RFC-2445 (iCalendar) recurrence rule?

2012-05-08 Thread Roy Smith
O.B. Murithi suggested I look at http://labix.org/python-dateutil, which turns out to have exactly what I'm looking for. Thanks! from dateutil.rrule import rrulestr from dateutil.parser import parse rule = rrulestr("FREQ=WEEKLY;COUNT=6;INTERVAL=2;BYDAY=FR", dtstart=parse("2012-0

A question of style (finding item in list of tuples)

2012-05-21 Thread Roy Smith
I've got this code in a django app: CHOICES = [ ('NONE', 'No experience required'), ('SAIL', 'Sailing experience, new to racing'), ('RACE', 'General racing experience'), ('GOOD', 'Experienced racer'), ('ROCK', 'Rock star'), ] def experience_

Re: A question of style (finding item in list of tuples)

2012-05-21 Thread Roy Smith
On Monday, May 21, 2012 9:39:59 AM UTC-4, Jon Clements wrote: > > def experience_text(self): > > return dict(CHOICES).get("self.level", "???") > Haven't used django in a while, but doesn't the model provide a > get_experience_display() method which you could use... Duh, I totally mi

Smallest/cheapest possible Python platform?

2012-05-26 Thread Roy Smith
What's the smallest/cheapest/lowest-power hardware platform I can run Python on today? I'm looking for something to use as a hardware controller in a battery-powered device and want to avoid writing in C for this project. Performance requirements are minimal. I need to monitor a few switches,

Re: usenet reading

2012-05-26 Thread Roy Smith
In article , duncan smith wrote: > On 25/05/12 23:38, Jon Clements wrote: > > Hi All, > > > > Normally use Google Groups but it's becoming absolutely frustrating - not > > only has the interface changed to be frankly impractical, the posts are > > somewhat random of what appears, is posted and

Re: Smallest/cheapest possible Python platform?

2012-05-26 Thread Roy Smith
In article <8ic799-gk3@chris.zbmc.eu>, tinn...@isbd.co.uk wrote: > > Rasberry Pi is available, some have arrived, mine will arrive on > Monday or Tuesday (I'm talking about UK here). Interesting. Newark is claiming they'll have 1 piece on June 18th, and no further stock until October. htt

Re: Smallest/cheapest possible Python platform?

2012-05-26 Thread Roy Smith
In article <7x1um6928y@ruckus.brouhaha.com>, Paul Rubin wrote: > The Raspberry Pi is not really appropriate for a low powered portable > application anyway, because of relatively high power requirements > compared to an 8 bitter without all that media playback stuff. It sounds like I can r

Re: setup(**config); rookie

2012-05-28 Thread Roy Smith
In article , cate wrote: > I going thru a 101 and came upon this (http:// > learnpythonthehardway.org/book/ex46.html) > > try: > from setuptools import setup > except ImportError: > from distutils.core import setup > > config = { > 'description': 'My Project', > 'author': 'My

Finding all regex matches by index?

2012-05-29 Thread Roy Smith
I have a long string (possibly 100s of Mbytes) that I want to search for regex matches. re.finditer() is *almost* what I want, but the problem is that it returns matching strings. What I need is a list of offsets in the string where the regex matched. Thus: s = "this is a string" find("is",

Re: Finding all regex matches by index?

2012-05-29 Thread Roy Smith
In article , Roy Smith wrote: > I have a long string (possibly 100s of Mbytes) that I want to search for > regex matches. re.finditer() is *almost* what I want, but the problem > is that it returns matching strings. What I need is a list of offsets > in the string where the r

Re: Help needed with nested parsing of file into objects

2012-06-04 Thread Roy Smith
In article <6b296278-fd32-45fb-b5c7-6c0fe5ce4...@q2g2000vbv.googlegroups.com>, richard wrote: > Hi guys i am having a bit of dificulty finding the best approach / > solution to parsing a file into a list of objects / nested objects any > help would be greatly appreciated. The first question is

Finding all loggers?

2012-06-14 Thread Roy Smith
Is there any way to get a list of all the loggers that have been defined? So if somebody has done: from logging import getLogger getLogger("foo") getLogger("foo.bar") getLogger("baz") I want something which will give me back ["foo", "foo.bar", "baz"]. -- http://mail.python.org/mailman/listinfo/

Re: Finding all loggers?

2012-06-14 Thread Roy Smith
ogging.Logger.manager.loggerDict > {'foo': , 'bar': > } > > Enjoy, > Michael > > On Thu, Jun 14, 2012 at 5:03 PM, Roy Smith wrote: >> Is there any way to get a list of all the loggers that have been >> defined? So if somebody has done: >&g

Conditional decoration

2012-06-18 Thread Roy Smith
Is there any way to conditionally apply a decorator to a function? For example, in django, I want to be able to control, via a run-time config flag, if a view gets decorated with @login_required(). @login_required() def my_view(request): pass -- http://mail.python.org/mailman/listinfo/python-

Re: how to avoid leading white spaces

2011-06-02 Thread Roy Smith
In article <94ph22frh...@mid.individual.net>, Neil Cerutti wrote: > On 2011-06-01, ru...@yahoo.com wrote: > > For some odd reason (perhaps because they are used a lot in > > Perl), this groups seems to have a great aversion to regular > > expressions. Too bad because this is a typical problem w

Re: how to avoid leading white spaces

2011-06-02 Thread Roy Smith
In article , Chris Torek wrote: > Python might be penalized by its use of Unicode here, since a > Boyer-Moore table for a full 16-bit Unicode string would need > 65536 entries (one per possible ord() value). I'm not sure what you mean by "full 16-bit Unicode string"? Isn't unicode inherently

Re: how to avoid leading white spaces

2011-06-03 Thread Roy Smith
In article <4de992d7$0$29996$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Of course, if you include both case-sensitive and insensitive tests in > the same calculation, that's a good candidate for a regex... or at least > it would be if regexes supported that :) Of course the

Re: how to avoid leading white spaces

2011-06-04 Thread Roy Smith
I wrote: >> Another nice thing about regexes (as compared to string methods) is >> that they're both portable and serializable. You can use the same >> regex in Perl, Python, Ruby, PHP, etc. In article <4de9bf50$0$29996$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Regexes a

Re: how to avoid leading white spaces

2011-06-07 Thread Roy Smith
On 06/06/2011 08:33 AM, rusi wrote: >> Evidently for syntactic, implementation and cultural reasons, Perl >> programmers are likely to get (and then overuse) regexes faster than >> python programmers. "ru...@yahoo.com" wrote: > I don't see how the different Perl and Python cultures themselves >

Re: Function within class and in modules

2011-06-15 Thread Roy Smith
In article , TheSaint wrote: > Hello > sorry, I'm bit curious to understand what could be the difference to pack up > a class for some number of functions in it and a simple module which I just > import and use the similar functions? If all you have is a bunch of functions, just sticking them

debugging https connections with urllib2?

2011-06-18 Thread Roy Smith
We've got a REST call that we're making to a service provider over https using urllib2.urlopen(). Is there any way to see exactly what's getting sent and received over the network (i.e. all the HTTP headers) in plain text? Things like tcpdump and strace only have access to the encrypted data.

Re: debugging https connections with urllib2?

2011-06-18 Thread Roy Smith
In article <4dfcff48$0$49184$e4fe5...@news.xs4all.nl>, Irmen de Jong wrote: > On 18-6-2011 20:57, Roy Smith wrote: > > We've got a REST call that we're making to a service provider over https > > using urllib2.urlopen(). Is there any way to see exactly what&#

Re: What is this syntax ?

2011-06-19 Thread Roy Smith
In article <4dfe10d1$0$28053$426a3...@news.free.fr>, candide wrote: > OK, thanks for your explanation, it was just stringisation ! > > > I erroneously focused on > > +x+ > > as a kind of placeholder unknown to me, instead of left and right > concatenations ;) > > It would be more readable

Re: How to iterate on a changing dictionary

2011-06-19 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Jun 20, 2011 at 12:32 AM, TheSaint wrote: > > Hello > > > > Trying to pop some key from a dict while is iterating over it will cause an > > exception. > > How I can remove items when the search result is true. > > > > Example: > > > > while len(dict)

Re: What is this syntax ?

2011-06-19 Thread Roy Smith
In article , rusi wrote: > On Jun 19, 8:39 pm, Roy Smith wrote: > > > This is one of the (very) few places PHP wins over Python.  In PHP, I > > would write this as > > > > print "'$x'" > > > You dont find > > >>>

Re: using only the django ORM (DB access model) and nothing else.

2011-06-21 Thread Roy Smith
In article <4e012e8d$0$23682$426a3...@news.free.fr>, News123 wrote: > Hi, > > I have a small application running on a host without web server and > without any need for django except its ORM accessing data bases without > explicitely writing sql queries.) You would do much better to ask this q

Re: web hosting, first hand experiences?

2011-07-03 Thread Roy Smith
In article , Daniel Fetchinson wrote: > Hi folks, I know this comes up regularly but the thing is that the > quality of service changes also quite regularly with many of the > hosting companies. What's currently the best option for shared hosting > of a turbogears application? I'm thinking of dr

Re: Implicit initialization is EVIL!

2011-07-03 Thread Roy Smith
In article , Chris Angelico wrote: > var(0x14205359) x # Don't forget to provide an address where the > object will be located > x=42 > > After all, everyone's gotta learn about segfaults some day! 0x14205359 is more likely to give a bus error (odd address) than a segfault :-) -- http://ma

Re: String concatenation vs. string formatting

2011-07-10 Thread Roy Smith
In article , Andrew Berg wrote: > How should I go about switching from concatenation to string formatting > for this? > > avs.write(demux_filter + field_filter + fpsin_filter + i2pfilter + > dn_filter + fpsout_filter + trim_filter + info_filter) > > I can think of a few ways, but none of them

Re: Function docstring as a local variable

2011-07-10 Thread Roy Smith
In article , pyt...@bdurham.com wrote: > I'm not sure how a function can get a generic handle to itself, but if > you're willing to hardcode the function name, then this technique works: > > def test(): > """This is my doc string""" > print test.__doc__ > > test() > > Outputs: > > Thi

Re: Lisp refactoring puzzle

2011-07-12 Thread Roy Smith
In article <4e1cf936.4050...@canterbury.ac.nz>, Gregory Ewing wrote: > Xah Lee wrote: > > they > > don't provide even simple list manipulation functions such as union, > > intersection, and the like. Not in perl, not in python, not in lisps. > > Since 2.5 or so, Python has a built-in set type t

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-17 Thread Roy Smith
In article , Andrew Berg wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: RIPEMD160 > > On 2011.07.17 06:29 PM, Roy Smith wrote: > > We don't have that problem any more. It truly boggles my mind that > > we're still churning out people with 80 column mi

Re: Tabs -vs- Spaces: Tabs should have won.

2011-07-18 Thread Roy Smith
In article , Duncan Booth wrote: > Tim Chase wrote: > > > On 07/17/2011 08:01 PM, Steven D'Aprano wrote: > >> Roy Smith wrote: > >>> We don't have that problem any more. It truly boggles my > >>> mind that we're still churning out

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