Re: Packaging a proprietary Python library for multiple OSs

2013-12-05 Thread Zero Piraeus
exists). A search for the mailing list from the front page works just fine: http://gmane.org/find.php?list=python-list%40python.org -[]z. -- Zero Piraeus: flagellum dei http://etiol.net/pubkey.asc -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Unicode handling wins again -- mostly

2013-11-29 Thread Zero Piraeus
"et" specifically, rather than the letter-pair e,t (no-one has ever written "k&tle" other than ironically), which makes it a logogram rather than a ligature (like "@"). (I happen to think the presence of ligatures in Unicode is insane, but my dictator-of-the

Re: Managing Google Groups headaches

2013-11-28 Thread Zero Piraeus
: On Thu, Nov 28, 2013 at 08:40:47AM -0700, Michael Torrie wrote: > My opinion is that the Python list should dump the Usenet tie-in and > just go straight e-mail. +1 Hell yes. -- Zero Piraeus: coram publico http://etiol.net/pubkey.asc -- https://mail.python.org/mailman/listinfo/python-list

Re: Self-defence

2013-11-17 Thread Zero Piraeus
t owned by any package > > It appears that my server has been compromised with a malicious > payload designed to sniff for and steal server passwords. > > I'am sure this is your doing Zero Piraeus. It is not my doing. Please desist from defaming me. I will not respond here, o

Self-defence

2013-11-17 Thread Zero Piraeus
st for very much longer, and am very close to unsubscribing after six years as an admittedly not very active member. -[]z. -- Zero Piraeus: pollice verso http://etiol.net/pubkey.asc -- https://mail.python.org/mailman/listinfo/python-list

Re: python 3.3 repr

2013-11-15 Thread Zero Piraeus
moderate amount of fun envisaging how that might work: if the characters were restricted to vowels, then 5**6 < 2**14, giving a couple of bits left over for a choice of four preset "three-character" extensions. I can't say that AEIOUA.EX1 looks particularly appealing, though ..

Re: chunking a long string?

2013-11-08 Thread Zero Piraeus
something itertools would do, but I don't see anything. You could use io.StringIO (or StringIO.StringIO in Python 2.x): from io import StringIO big_str = 'x' * 1000 stream = StringIO(big_str) while True: chunk = stream.read(1024) if not chunk:

Re: Using the nntplib module to count Google Groups users

2013-10-26 Thread Zero Piraeus
quot; % gg_users) print("---") - - - It's obviously not very robust, but I reckon it's good enough to get an idea what's going on. The results: Senders: 1701 GG users: 879 ... so just over 50%. If anyone wants the complete output, just let me know and I'll email it privately. -[]z. [1] except for spam filtered out by Gmail. -- Zero Piraeus: ad referendum http://etiol.net/pubkey.asc -- https://mail.python.org/mailman/listinfo/python-list

Re: Cookie (expletive) problem

2013-10-26 Thread Zero Piraeus
top reposting the same question over and over again. ... and now you're adding expletives to the subject line of a post which will be read in a workplace environment. If you can't learn your trade, at least learn some basic respect for others. -[]z. -- Zero Piraeus: coram publico htt

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Zero Piraeus
Joking aside, there is a legitimate use for asciifying text in this way: creating unambiguous identifiers. For example, a miscreant may create the username 'míguel' in order to pose as another user 'miguel', relying on other users inattentiveness. Asciifying is one way of red

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-18 Thread Zero Piraeus
; characters, like große to grosse. This: https://pypi.python.org/pypi/Unidecode/ ... seems to work: >>> from unidecode import unidecode >>> unidecode("Klüft, große") 'Kluft, grosse' >>> unidecode("Текст декодирует вы"

Re: Sexism in the Ruby community: how does the Python community manage it?

2013-10-17 Thread Zero Piraeus
ly be > pleased to have a bunch of strangers from another community come over > to tell me all the things I'm doing wrong. What could possibly go wrong? http://www.theguardian.com/world/2004/oct/18/uselections2004.usa2 -[]z. -- Zero Piraeus: in ictu oculi http://etiol.net/pubkey.asc

Re: Database statements via python but database left intact

2013-10-06 Thread Zero Piraeus
r a Python issue, and is off-topic for discussion here. -[]z. -- Zero Piraeus: vive ut vivas http://etiol.net/pubkey.asc -- https://mail.python.org/mailman/listinfo/python-list

Re: Database statements via python but database left intact

2013-10-05 Thread Zero Piraeus
yAdmin and > i see that it was left intact. Are you sure that you're committing your changes (either by having autocommit set or using an explicit con.commit() call)? http://geert.vanderkelen.org/dont-forget-the-commit-in-mysql/ -[]z. -- Zero Piraeus: inter caetera http://etio

Re: Select fails when cookie tried to get a numeric value

2013-10-05 Thread Zero Piraeus
y or may not be correct, but it's the kind of mental process you should be going through to solve your problem. -[]z. -- Zero Piraeus: inter caetera http://etiol.net/pubkey.asc -- https://mail.python.org/mailman/listinfo/python-list

Re: Select fails when cookie tried to get a numeric value

2013-10-05 Thread Zero Piraeus
the docs or at the interpreter with help(Biscuit) As previously mentioned, there's likely to be some kind of 'value' attribute that will return just the number you want. -[]z. -- Zero Piraeus: post scriptum http://etiol.net/pubkey.asc -- https://mail.python.org/mailman/listinfo/python-list

Re: JUST GOT HACKED

2013-10-01 Thread Zero Piraeus
posed, and open a text editor. If that's hacking, I'm Neo. That's not to say someone else *hasn't* pissed in your bucket, but if they have, they won't have publicised the fact. By the way: if you haven't already, you'll want to remove the extra line from your .

Re: Handling 3 operands in an expression without raising an exception

2013-09-28 Thread Zero Piraeus
: > On Sat, Sep 28, 2013 at 1:53 PM, Mark Lawrence wrote: > > You actually need the tool that was used on King Edward II. To be clear, Mark, you are calling for Νίκος to be tortured to death with a red hot poker, yes? I'm going to go out on a limb and suggest that such a suggestion is outside wh

Re: How to split with "\" character, and licence copyleft mirror of (c)

2013-09-01 Thread Zero Piraeus
: On 1 September 2013 22:40, Tim Roberts wrote: > Another altrnative is to use "raw" strings, in which backslashes are not > interpreted: > a = r'E:\Dropbox\jjfsdjjsdklfj\sdfjksdfkjslkj\flute.wav' > a.split(r'\') Acually, that doesn't work: >>> a = r'E:\Dropbox\jjfsdjjsdklfj\sdfjksd

Re: Converting a list of lists to a single list

2013-07-23 Thread Zero Piraeus
: On 23 July 2013 17:52, wrote: > > Say I have three lists: > > [[A0,A1,A2], [B0,B1,B2] [C0,C1,C2]] > > I would like to convert those to a single list that looks like this: > [A0,B0,C0,C1,C2,B1,C0,C1,C2,B2,C0,C1,C2,A1,B0,C0,C1,C2,B1,C0,C1,C2,B2,C0,C1,C2,A2,B0,C0,C1,C2,B1,C0,C1,C2,B2,C0,C1,C2] H

Re: Don't feed the troll...

2013-06-15 Thread Zero Piraeus
: On 14 June 2013 08:50, Nick the Gr33k wrote: > > So, if i had no interest of actually learning python i would just cut n' > paste provided code without worrying what it actually does, since knowing > that came form you would be enough to know that works. Worrying what it actually does is good;

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

2013-06-14 Thread Zero Piraeus
: On 14 June 2013 09:07, Nick the Gr33k wrote: > > Thanks for explaining this but i cannot follow its logic at all. > My mind is stuck trying to interpret it as an English sentence: > > if ('Parker' and 'May' and '2001') > > if ('Parker' or 'May' or '2001') > > i just don't get it and i feel sill

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

2013-06-14 Thread Zero Piraeus
: On 14 June 2013 08:47, Gene Heskett wrote: > > One old (78) farts take on this endless thread is that its a sign that > those who had it made in Greece, before the bill for it came due, are now > being forced to actually (gasp, a 4 letter word) "work" for a living, eg > producing something of v

Re: A few questiosn about encoding

2013-06-13 Thread Zero Piraeus
: On 14 June 2013 01:34, Nick the Gr33k wrote: > Why doesn't it work like this? > > leading 0 = 1 byte flag > leading 1 = 2 bytes flag > leading 00 = 3 bytes flag > leading 01 = 4 bytes flag > leading 10 = 5 bytes flag > leading 11 = 6 bytes flag > > Wouldn't it be more logical? Think about it.

Re: Version Control Software

2013-06-13 Thread Zero Piraeus
: On 13 June 2013 17:53, Grant Edwards wrote: > > Unfortunately, something that requires typing commands would not fly. I haven't used it (very rarely use GUI dev tools), but Tortoise Hg seems to have a decent reputation for Mercurial (and is at least somewhat

Re: Turnign greek-iso filenames => utf-8 iso

2013-06-13 Thread Zero Piraeus
: > But iam not offering Steven full root access, but restricted user level > access. Are you implying that for example one could elevate his privileges > to root level access form within a normal restricted user account? I am implying that your demonstrated lack of ability means that *you don't

Re: Turnign greek-iso filenames => utf-8 iso

2013-06-13 Thread Zero Piraeus
: > Steven, i can create a normal user account for you and copy files.py into > your home folder if you want to take a look from within. Nikos, please, DO NOT DO THIS. It must be clear to you that Steven is *much* more experienced than you. Your presumptions about what he can and can't do with t

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

2013-06-13 Thread Zero Piraeus
: 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 to kill-file himself. He's not a troll, he's a help vampire: http://slash7.com/2006/12/22/vampires/ ... a particularly extreme example, I'll admit: his lack of co

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-07 Thread Zero Piraeus
: On 7 June 2013 16:45, MRAB wrote: > On 07/06/2013 20:31, Zero Piraeus wrote: >> [something exasperated, in capitals] > > Have you noticed how the line in the traceback doesn't match the line > in the post? Actually, I hadn't. It's not exactly a surprise at t

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-07 Thread Zero Piraeus
: On 7 June 2013 14:52, Νικόλαος Κούρας wrote: File "/home/nikos/public_html/cgi-bin/files.py", line 81 > [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] if( flag == > 'greek' ) > [Fri Jun 07 21:49:33 2013] [error] [client 79.103.41.173] > ^ > [Fri Jun 07 2

Re: Apache and suexec issue that wont let me run my python script

2013-06-05 Thread Zero Piraeus
: On 5 June 2013 14:34, Νικόλαος Κούρας wrote: > Here is the mails you sent to my customers for the other members to see. > --- > [...] > I advise that you look to alternative web hosting. > --- > > Thanks for screwing me up entirely

Re: Do you feel bad because of the Python docs?

2013-02-26 Thread Zero Piraeus
: On 26 February 2013 08:54, Steven D'Aprano wrote: > One week ago, "JoePie91" wrote a blog post challenging the Python > community and the state of Python documentation [...] > [...] should we feel bad about Python's docs? The Python docs are my first port of call when I know the module (and m

Re: Awsome Python - chained exceptions

2013-02-12 Thread Zero Piraeus
: On 12 February 2013 02:15, Steven D'Aprano wrote: > As an antidote to the ill-informed negativity of Ranting Rick's > illusionary "PyWarts", I thought I'd present a few of Python's more > awesome features [...] You could call them PyW00ts. -[]z. -- http://mail.python.org/mailman/listinfo/py

Re: Vote tallying...

2013-01-18 Thread Zero Piraeus
: On 18 January 2013 16:57, Tim Chase wrote: > > - there are just some serious what-the-heck's in MySQL's handling of some > edge cases regarding NULL values and dates (Feb 31st anybody). There's a > good compilation of them at [1]. > > [1] > http://sql-info.de/mysql/gotchas.html I'm getting th

Re: Proper place for everything

2012-11-02 Thread Zero Piraeus
: On 2 November 2012 07:20, Jason Benjamin wrote: > Anybody know of the appropriate place to troll and flame about various > Python related issues? I don't know about appropriate, but there'd be a certain amount of poetic justice in using one of the alt.conspiracy.* or alt.religion.* newsgroups

Re: python and Open cv

2012-11-01 Thread Zero Piraeus
: On 1 November 2012 08:48, inshu chauhan wrote: > I am sorry.. but I need to know what are the rules and what about gmail ?? > Many people are using gmail to mail to the list. There aren't any rules about gmail (except the unwritten rule that to be a "real" geek you need to use a mail client th

Re: pythonic way

2012-11-01 Thread Zero Piraeus
: On 1 November 2012 11:32, inshu chauhan wrote: > what is the most pythonic way to do this : > >if 0 < ix < 10 and 0 < iy < 10 ??? As everyone else has said, it's perfectly pythonic once you stick the colon on the end. You might find it more instantly readable with some ext

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-25 Thread Zero Piraeus
: On 25 October 2012 16:53, Rivka Miller wrote: > I am looking for a regexp for a string not at the beginning of the > line. There are probably quite a few ways to do this, but '(?>> pattern = re.compile(r"(?>> re.findall(pattern, "this is some text") ['is', 'some', 'text'] -[]z. -- http://ma

Re: classes

2012-10-24 Thread Zero Piraeus
: On 24 October 2012 11:18, Chris Angelico wrote: > On Thu, Oct 25, 2012 at 2:14 AM, Zero Piraeus wrote: >> [... on return values and side effects ...] > > Side point: It's not that it's *bad* code or even bad style; It's a matter of taste, sure, but especiall

Re: classes

2012-10-24 Thread Zero Piraeus
: On 24 October 2012 09:02, inshu chauhan wrote: > I changed the programme to this : > class Bag: > def __init__(self): > > self.data = [] > > def add(self, x): > self.data.append(x) > def addtwice(self, x): > self.add(x) > self.add(x) > retu

Re: can we append a list with another list in Python ?

2012-10-23 Thread Zero Piraeus
: On 23 October 2012 03:36, inshu chauhan wrote: > can we append a list with another list in Python ? using the normal routine > syntax but with a for loop ?? The standard way to append the contents of one list to another is list.extend: >>> a = [1, 2, 3] >>> b = [4, 5, 6] >>> a.extend(b) >>> a

Re: a prob.. error in prog ..dont knw how to correct

2012-10-21 Thread Zero Piraeus
: On 21 October 2012 06:09, inshu chauhan wrote: > I am new to python and have a little problem to solve .. > import cv This module is not used in your code [and isn't part of the standard library]. > from math import floor, sqrt, ceil You're only using one of these functions. > from numpy i

Re: change the first letter into uppercase (ask)

2012-10-21 Thread Zero Piraeus
: On 20 October 2012 20:22, Dennis Lee Bieber wrote: > Based on the documentation, most of that pattern is fluff: (?#...) > is considered a comment. The comment isn't entirely fluff ... it provides a Google target for whoever's marking OP's assignment, should they choose to look it up:

Re: change the first letter into uppercase (ask)

2012-10-19 Thread Zero Piraeus
: On 20 October 2012 00:09, contro opinion wrote: > how can i use regular expression in python to change the string > "a test of capitalizing" > into > "A Test Of Capitalizing"? >>> import re >>> pattern = re.compile(".(?#nyh2p){0,1}") >>> result = "" >>> f = str.title >>> for match in re.fi

Re: A desperate lunge for on-topic-ness

2012-10-18 Thread Zero Piraeus
: On 18 October 2012 11:55, Den wrote: > [...] I'm amused by the whole question, and others related > to PEP8. A quick aside, the width of our roads all go back to the > width of a two horse rig. The suggested maximum of 80 characters goes > back to teletype machines, and IBM cards, and charact

Re: python scripts for web

2012-10-18 Thread Zero Piraeus
: On 18 October 2012 12:03, wrote: > yes, but as I have just answered to Zero, is using mod_wsgi a better strategy? WSGI would enable you to write a persistent application that sits around waiting for requests and returns responses for them as and when, as opposed to a simple CGI script that ge

Re: A desperate lunge for on-topic-ness

2012-10-18 Thread Zero Piraeus
: There seems to be a consensus [to the extent there ever is, anyway] around using parentheses etc., then ... On 18 October 2012 02:31, Steven D'Aprano wrote: > I've been burnt enough by word-wrapping in editors that don't handle word- > wrapping that well that it makes me really uncomfortable t

Re: python scripts for web

2012-10-18 Thread Zero Piraeus
: On 18 October 2012 05:22, wrote: > So i guess in that case i do not need cgi or anything? Assuming your scripts accept the request as sent and return an appropriate response, they are CGI scripts (unless there's some wrinkle in the precise definition of CGI that escapes me right now). > Than

Re: python scripts for web

2012-10-18 Thread Zero Piraeus
: On 18 October 2012 04:10, wrote: > I will give you an example. So let us say I create two simple python > scripts, one does the sum of two numbers > the other one does the multiplication. SO now I want to put these > scripts on the server. Now let us say there is a web page that would > like t

Re: python scripts for web

2012-10-18 Thread Zero Piraeus
: On 18 October 2012 03:18, wrote: > Here is what I need to do: on some webpage (done in php, or any other > different technology), user inputs some data, that data and the > request then goes to the server where python scripts calculate > something and return the result to the users end. > > No

Re: Aggressive language on python-list

2012-10-18 Thread Zero Piraeus
: On 18 October 2012 02:19, rusi wrote: > I understood that your original post started after Etienne's outburst > against Steven. Ah, I see. It was intended as a general request for politeness, but yes, IIRC that was the exchange that prompted it. > IOW the robustness principle http://en.wikipe

A desperate lunge for on-topic-ness

2012-10-17 Thread Zero Piraeus
: Okay, so, first thing vaguely Python-related that comes to mind [so probably not even slightly original, but then that's not really the point]: What are people's preferred strategies for dealing with lines that go over 79 characters? A few I can think of off the bat: 1. Say "screw it" and go p

Re: Aggressive language on python-list

2012-10-17 Thread Zero Piraeus
: On 18 October 2012 00:36, rusi wrote: > Unfortunately, I feel this whole discussion/thread has got derailed: > Zero you started this thread about aggressive behavior. It does not > seem to me that this was the case you were talking of, was it? Sorry, but I'm having trouble parsing that sentenc

Re: Aggressive language on python-list

2012-10-17 Thread Zero Piraeus
: On 17 October 2012 19:53, Dwight Hutto wrote: > To take it a little further, what if I said I got gypped. I think it > goes to gypsy's. Was it racist? "Racist" is a word with competing definitions, and intent is a factor in some of them ... but yes, many people are offended by such use of the

Re: Aggressive language on python-list

2012-10-17 Thread Zero Piraeus
: On 17 October 2012 19:17, Steven D'Aprano wrote: [on Asperger's] > Excuse me, I think that anybody who was offended by it needs to take a > long, hard look at themselves. Would you be offended if Rurpy asked "Are > you diabetic?" There's no more shame in being Aspie than there is in > being dia

Re: Aggressive language on python-list

2012-10-14 Thread Zero Piraeus
: On 14 October 2012 17:58, Ben Finney wrote: > What's needed, IMO, is a difficult balance: there needs to be calm, > low-volume, but firm response to instances of hostile behaviour, making > clear by demonstration – especially to the people only observing the > discussion – that such hostility i

Aggressive language on python-list

2012-10-13 Thread Zero Piraeus
: Not sure exactly how to put this ... I'm a mostly passive subscriber to this list - my posts here over the years could probably be counted without having to take my socks off - so perhaps I have no right to comment, but I've noticed a marked increase in aggressive language here lately, so I'm p

Re: help with simple print statement!

2012-08-24 Thread Zero Piraeus
: On 24 August 2012 15:43, Willem Krayenhoff wrote: > Any idea why print isn't working here? http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function Also, pasting images into emails to this list is unlikely to gain you many friends ... -[]z. -- http://mail.python.org/mailm

Re: Top-posting &c. (was Re: [ANNC] pybotwar-0.8)

2012-08-17 Thread Zero Piraeus
: On 17 August 2012 21:43, Steven D'Aprano wrote: > There are cultures that marry five year old girls to sixty year old men, > cultures that treat throwing acid in the faces of women as acceptable > behaviour, cultures that allow war heroes to die of hunger and cold > homeless in the street, and

Re: dictionary into desired variable....

2012-08-10 Thread Zero Piraeus
: > suppose you have a dictionary that looks like this: > > x = [1,3,6,1,1] which should represent a certain other variable. That's a list, not a dict. > in reality it would represent: > > y[1][3][6][1][1] > > Now, how do I write a python routine, that points in this dictionary, > where I should

Re: Intermediate Python user needed help

2012-08-05 Thread Zero Piraeus
: On 5 August 2012 16:52, John Mordecai Dildy wrote: > Current Problem at the moment > > Traceback (most recent call last): > File "ex26.py", line 66, in > beans, jars, crates = secret_formula(start-point) > NameError: name 'start' is not defined > > anyone know how to make start defined

Re: On-topic: alternate Python implementations

2012-08-04 Thread Zero Piraeus
: On 4 August 2012 14:50, Mark Lawrence wrote: > > No. Next question? *plonk* -[]z. -- http://mail.python.org/mailman/listinfo/python-list

Re: On-topic: alternate Python implementations

2012-08-04 Thread Zero Piraeus
: On 4 August 2012 14:24, Mark Lawrence wrote: > > With arrogance like that German by any chance? I didn't give a monkeys about the beer conversation personally, but can we leave the national stereotypes out of it? -[]z. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to generate only rotationally-unique permutations?

2012-05-19 Thread Zero Piraeus
: On 19 May 2012 01:23, John O'Hagan wrote: > How to generate only the distinct permutations of a sequence which are not > rotationally equivalent to any others? More precisely, to generate only the > most > "left-packed" of each group of rotationally equivalent permutations, such that > for eac

Re: [newbie questions] if conditions - if isset - if empty

2012-04-14 Thread Zero Piraeus
: > 1. How can I write the following code in easier way in Python ? > if len(item['description']) > 0: >             item['description'] = item['description'][0] >         else: >             item['description'] = '' Assuming item['description'] is a string, all you need is >>> item['description

Re: Chaos Theory [was Re: Benefit and belief]

2011-10-03 Thread Zero Piraeus
: On 4 October 2011 00:43, alex23 wrote: > rantingrick wrote: >> Clark Kent is just an assumed identity of Superman. > > Actually, he identifies with Clark Kent, Superman is the secret > identity. > > You're thinking of Batman, for whom Bruce Wayne is the mask. A dissenting view [and a Kill Bil

Re: Why are my queues empty even though there are items in it?

2011-09-20 Thread Zero Piraeus
: On 20 September 2011 14:42, MRAB wrote: > On 20/09/2011 19:13, Kayode Odeyemi wrote: >> >>     if item is not {} and timeout is not 0: > > `not {}` has the value True, so `item is not {}` means `item is True`. > The `is` checks for identity, not equality, so this is true only if `item` > actual

Re: PEP 20 - Silly Question?

2011-09-06 Thread Zero Piraeus
: On 6 September 2011 12:17, Joseph Armbruster wrote: > I noticed that it says only 19 of 20 have been written down.  Which one was > not written down? The last one. -[]z. -- http://mail.python.org/mailman/listinfo/python-list

Re: try... except with unknown error types

2011-08-19 Thread Zero Piraeus
: On 19 August 2011 15:09, Yingjie Lin wrote: > > I have been using try...except statements in the situations where I can > expect a certain type of errors might occur. > But sometimes I don't exactly know the possible error types, or sometimes I > just can't "spell" the error types correctly.

Re: Syntactic sugar for assignment statements: one value to multiple targets?

2011-08-17 Thread Zero Piraeus
: Off on a tangent ... On 16 August 2011 20:14, gc wrote: > > Let me address one smell from my particular example, which may be the > one you're noticing. If I needed fifty parallel collections I would > not use separate variables; I've coded a ghastly defaultdefaultdict > just for this purpose,

Fwd: how to separate a list into two lists?

2011-08-06 Thread Zero Piraeus
: > if a list L is composed with tuple consists of two elements, that is > L = [(a1, b1), (a2, b2) ... (an, bn)] > > is there any simple way to divide this list into two separate lists , such > that > L1 = [a1, a2... an] > L2=[b1,b2 ... bn] How about this? >>> L = [("a1", "b1"), ("a2", "b2"), (

Re: PEP 8 and extraneous whitespace

2011-07-24 Thread Zero Piraeus
: > It's also because many people report that it's easier to read text when > it's not wider than ~75 characters. That rule [1] is for paragraphs of prose in proportional text; code is both written and read differently. While there most likely is an upper limit, it's going to be different - large

dict comparison [was: suggestions, comments on an "is_subdict" test]

2011-04-22 Thread Zero Piraeus
: On 22 April 2011 13:30, Peter Otten <__pete...@web.de> wrote: def is_subdict(test_dct, base_dct): > ...     return test_dct <= base_dct and all(test_dct[k] == base_dct[k] for > ... k in test_dct) > ... is_subdict({1:0}, {2:0}) > Traceback (most recent call last): >  File "", line 1, in

Re: suggestions, comments on an "is_subdict" test

2011-04-22 Thread Zero Piraeus
: >> Anything wrong with this? >> >> def is_subdict(test_dct, base_dct): >>     return test_dct <= base_dct and all(test_dct[k] == base_dct[k] for >> k in test_dct) > > It may raise a KeyError. Really? That was what ``test_dct <= base_dct and`` ... is supposed to prevent. Have I missed something?

Re: suggestions, comments on an "is_subdict" test

2011-04-22 Thread Zero Piraeus
: >> I'd like to ask for comments or advice on a simple code for testing a >> "subdict", i.e. check whether all items of a given dictionary are >> present in a reference dictionary. Anything wrong with this? def is_subdict(test_dct, base_dct): return test_dct <= base_dct and all(test_dct[k]

Re: Feature suggestion -- return if true

2011-04-11 Thread Zero Piraeus
: >> This is only true if n < 5.  Otherwise, the first returns None and the >> second returns False. > > Which is why I said: > > return expr or None > > But hey let's argue the point to death! Ok ;-) I think the point is that OP doesn't want to return *at all* if expr is False - presumably beca

Re: Help with regex and optional substring in search string

2009-10-14 Thread Zero Piraeus
: 2009/10/14 Timur Tabi : > Never mind ... I figured it out.  The middle block should have been [\w > \s/]* This is fragile - you'll have to keep adding extra characters to match if the input turns out to contain them. -[]z. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with regex and optional substring in search string

2009-10-14 Thread Zero Piraeus
: 2009/10/14 Timur Tabi : > I'm having trouble creating a regex pattern that matches a string that > has an optional substring in it.  What I'm looking for is a pattern > that matches both of these strings: > > Subject: [PATCH 08/18] This is the patch name > Subject: This is the patch name > > Wha

Re: How to jump out of nested 'for'-loops?

2009-09-28 Thread Zero Piraeus
: > I want some command to jump out of nested loop. I'm wondering what is > the most convenient way to do so in python. http://www.google.com/search?q=python+nested+break -[]z. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a method (similar to str() method in R) that can print the data structure in python?

2009-09-27 Thread Zero Piraeus
: 2009/9/27 Peng Yu : >>> But I want an even simpler solution. I don't want the user to define >>> __pretty__. Is there a tool that can automatically print the content >>> of an object without defining such a member function like __pretty__. Not tested (much): from pprint import pprint def exam

Re: Remove namespace declaration from ElementTree in lxml

2007-12-28 Thread Zero Piraeus
: > > I want to remove an unused namespace declaration from the root element > > of an ElementTree in lxml. > > > [...] I'm reduced to sticking the output through str.replace() ... > > which is somewhat inelegant. > > And also a bit error prone (unless you are sure the replaced string really > onl

Remove namespace declaration from ElementTree in lxml

2007-12-27 Thread Zero Piraeus
: I want to remove an unused namespace declaration from the root element of an ElementTree in lxml. There doesn't seem to be any documented way to do this, so at the moment I'm reduced to sticking the output through str.replace() ... which is somewhat inelegant. Is there a better way? -[]z. --

Re: A way of checking if a string contains a number

2007-12-12 Thread Zero Piraeus
: > [...] IMHO regular > expressions are overkill for the task you describe. You may be better served > to > just try to convert it to whatever number you want. > > try: > value=int(string1) Fails for the OP's example: >>> string1 = "ABC 11" >>> int(string1) Traceback (most recent c

Re: Python Exponent Question

2007-12-10 Thread Zero Piraeus
: > v = 2 > v**v = 2**2 = 4 > v**v**v = 2**2**2 = 16 > v**v**v**v = 2**2**2**2 = 65536 > > I would expect 2**2**2**2 to be 256 "... in an unparenthesized sequence of power and unary operators, the operators are evaluated from right to left ..." - http://docs.python.org/ref/power.html So, 2**2**