FAQ

Search Discussions

508 discussions - 2,733 posts

  • All: Finding .ini configuration files too limiting, JSON and XML to hard to manually edit, and YAML too complex to parse quickly, I have started work on a new configuration file parser. I call the ...
    Patrick MaupinPatrick Maupin
    Mar 1, 2010 at 2:09 am
    Mar 10, 2010 at 9:56 pm
  • Hi, how can I write the popular C/JAVA syntax in Python? Java example: return (a==b) ? 'Yes' : 'No' My first idea is: return ('No','Yes')[bool(a==b)] Is there a more elegant/common python expression ...
    GentlestoneGentlestone
    Mar 30, 2010 at 3:40 pm
    Apr 19, 2010 at 12:16 pm
  • Is there a sequence-oriented equivalent to the sum built-in? E.g.: seq_sum(((1, 2), (5, 6))) -- (1, 2) + (5, 6) -- (1, 2, 5, 6) ? (By "sequence" I'm referring primarily to lists and tuples, and ...
    KjKj
    Mar 24, 2010 at 3:29 pm
    Apr 6, 2010 at 2:51 pm
  • For C++ Petru Marginean once invented the "scope guard" technique (elaborated on by Andrei Alexandrescu, they published an article about it in DDJ) where all you need to do to ensure some desired ...
    Alf P. SteinbachAlf P. Steinbach
    Mar 3, 2010 at 3:10 pm
    Mar 8, 2010 at 2:03 pm
  • recently i wrote a blog article on The NoSQL Movement at http://xahlee.org/comp/nosql.html i'd like to post it somewhere public to solicit opinions, but in the 20 min or so, i couldn't find a proper ...
    Xah LeeXah Lee
    Mar 3, 2010 at 5:36 pm
    Mar 15, 2010 at 4:57 am
  • Does anyone know of a good python to stand alone exe compiler? Thanks, -Robin
    RobinRobin
    Mar 13, 2010 at 3:26 am
    Mar 14, 2010 at 11:18 pm
  • What's the word on using "classes as namespaces"? E.g. class _cfg(object): spam = 1 jambon = 3 huevos = 2 breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) Granted, this is not the "intended use" for ...
    KjKj
    Mar 26, 2010 at 2:49 pm
    Apr 12, 2010 at 10:31 am
  • In a module, how do I create a conditional that will do something based on whether or not another module has been loaded? Suppose I have the following: import foo import foobar print foo() print ...
    Pete EmersonPete Emerson
    Mar 5, 2010 at 7:24 pm
    Mar 16, 2010 at 11:55 pm
  • Given some known data/crc pairs, how feasible is it to figure out the polynomial being used to generate the crc? In the case I'm looking at, it appears that the crc size may be at least 24 bits, so ...
    Gregory EwingGregory Ewing
    Mar 8, 2010 at 3:09 am
    Mar 20, 2010 at 5:24 pm
  • Want to switch __call__ behavior. Why doesn't this work? What is the correct way to write this? class X (object): def __init__(self, i): if i == 0: def __call__ (self): return 0 else: def __call_ ...
    Neal BeckerNeal Becker
    Mar 10, 2010 at 1:12 pm
    Mar 12, 2010 at 3:30 am
  • True True Huh? True Huh?! Regards, mk
    MkMk
    Mar 5, 2010 at 5:14 pm
    Mar 8, 2010 at 8:53 am
  • I need to create a class solely for the purpose of encapsulating a large number of disparate data items. At the moment I have no plans for any methods for this class other than the bazillion ...
    KjKj
    Mar 20, 2010 at 10:15 pm
    Mar 23, 2010 at 9:13 am
  • Hello, Learning Python from the help file and online resources can leave one with many gaps. Can someone comment on the following: # --------- class X: T = 1 def f1(self, arg): print "f1, arg=%d" % ...
    LallousLallous
    Mar 15, 2010 at 4:39 pm
    Mar 20, 2010 at 7:32 am
  • I have been learning Python, and it is amazing .... I am using the tutorial that comes with the official distribution. At the end my goal is to develop applied mathematic in engineering applications ...
    Jose ManuelJose Manuel
    Mar 23, 2010 at 4:55 pm
    May 10, 2010 at 11:35 am
  • I must be having a brain cramp. Given a list of objects, how can I sort the list on one attribute in descending order, then sort within each group in ascending order on another attribute. For ...
    Chris CurveyChris Curvey
    Mar 31, 2010 at 5:08 pm
    Apr 1, 2010 at 2:23 pm
  • Hi, i have a serious problem and I am looking for a solution. I pass an instance of a class from a file to PyObject_Call. When something fails, I get a full traceback. If it succeeds, I get the ...
    Moerchendiser2k3Moerchendiser2k3
    Mar 16, 2010 at 11:52 am
    Mar 20, 2010 at 9:44 am
  • Hello, So I set out to write generic singleton, i.e. the one that would do a singleton with attributes of specified class. At first: class Singleton(object): instance = None def __new__(cls, ...
    MkMk
    Mar 3, 2010 at 6:54 pm
    Mar 6, 2010 at 1:45 am
  • I've got a subclass of fractions.Fraction called Value; it's a mostly trivial class, except that it overrides __eq__ to mean 'nearly equal'. However, since Fraction's operations result in a Fraction, ...
    JLundellJLundell
    Mar 13, 2010 at 5:03 pm
    Dec 23, 2010 at 11:21 pm
  • To get the decimal representation of a binary number, I can just do this: int('11',2) # returns 3 But decimal binary numbers throw a ValueError: int('1.1',2) # should return 1.5, throws error ...
    AdityaAditya
    Mar 30, 2010 at 3:13 pm
    Mar 30, 2010 at 9:05 pm
  • Webmonkey, Greasemonkey, monkey-patching, Tracemonkey, J?germonkey, Spidermonkey, Mono (monkey in spanish), codemonkey, etc, etc, etc... Monkeys everywhere. Sorry for the off topic question, but what ...
    Luis M. GonzálezLuis M. González
    Mar 26, 2010 at 1:14 pm
    Mar 29, 2010 at 11:59 pm
  • Hi everybody! The "Where is CPAN for Python?" question keeps popping up, with answers ranging from "There is no CPAN for Python" and "We already have CPAN for Python" (confusing). I'm wondering - is ...
    Olof BjarnasonOlof Bjarnason
    Mar 3, 2010 at 12:45 pm
    Mar 4, 2010 at 6:06 pm
  • Hi all, I have a question about decorators. I would like to use them for argument checking, and pre/post conditions. However, I don't want the additional overhead when I run in non-debug mode. I ...
    LXLX
    Mar 30, 2010 at 12:54 am
    Apr 1, 2010 at 5:01 pm
  • I've posted "Usability, the Soul of Python: An Introduction to the Python Programming Language Through the Eyes of Usability", at: http://JonathansCorner.com/python/ The basic suggestion is that much ...
    Jonathan HaywardJonathan Hayward
    Mar 29, 2010 at 7:41 pm
    Mar 31, 2010 at 7:21 pm
  • Have you people embraced Python 3.x or still with 2.5 or 2.6? I personally want to switch over but not too sure how many people are using 3.x as opposed to 2 so I want to keep my programs compatible ...
    HarishankarHarishankar
    Mar 26, 2010 at 1:23 pm
    Mar 29, 2010 at 12:58 pm
  • Hi Vinay Sajip, I'm very glad discoverd your logging module ;-) (That's what I would have liked 25 years ago when I was working as a technical software developper!) Now I'm writing just some personal ...
    Hellmut WeberHellmut Weber
    Mar 10, 2010 at 9:23 pm
    Mar 31, 2010 at 7:52 am
  • I am loading a dictionary from a text file and constructing a trie data structure in memory. However, it takes longer than I'm happy with - about 12 seconds on my computer. I profiled it, came up ...
    WeebleWeeble
    Mar 19, 2010 at 12:13 am
    Mar 24, 2010 at 1:39 am
  • So I am trying to write a bit of code and a simple numerical subtraction y_diff = y_diff-H is giving me the error Syntaxerror: Non-ASCII character '\x96' in file on line 70, but no encoding declared. ...
    Joel PenderyJoel Pendery
    Mar 15, 2010 at 5:37 pm
    Mar 22, 2010 at 2:26 pm
  • "EURO GIRLS" "MISS EUROPE" "MISS FRENCH" "FRENCH" "PRETTY GIRLS" "SEXY FRENCH GIRLS" on www.sexyandpretty-girls.blogspot.com "SEXY RUSSIAN GIRLS" "SEXY GREEK GIRLS" "SEXY DUTCH GIRLS" "SEXY UK GIRLS" ...
    NaeemNaeem
    Mar 20, 2010 at 4:18 am
    Mar 21, 2010 at 10:06 pm
  • Is there any tutorial how to write a bindings for a exe ( dos) program? I would like to run it from a Python directly ( using import command and a particular function from the binding) not using ...
    JohnyJohny
    Mar 16, 2010 at 4:20 pm
    Mar 19, 2010 at 7:01 am
  • Hello, I am still learning python, thus developnig small scripts. Some of them consist only of the main module. While testing them (debugging) I sometimes want to stop the script at a certain point, ...
    VsolerVsoler
    Mar 14, 2010 at 11:34 am
    Mar 15, 2010 at 6:50 pm
  • I ran a comparison that timed 1e6 file seeks. The tests were run with Python 2.6.4 and Microsoft Visual C 6.0 on Windows XP with an Intel 3GHz single processor with hyperthreading. Results: C : 0.812 ...
    MetaloneMetalone
    Mar 9, 2010 at 11:56 pm
    Mar 13, 2010 at 4:13 am
  • Hi, I have two related lists: x = [1 ,2, 8, 5, 0, 7] y = ['a', 'a', 'b', 'c', 'c', 'c' ] what I need is a list representing the mean value of 'a', 'b' and 'c' while maintaining the number of items ...
    Dimitri pater - serpiaDimitri pater - serpia
    Mar 8, 2010 at 10:34 pm
    Mar 9, 2010 at 6:24 pm
  • Hi all I'm looking for a queue that I can use with multiprocessing, which has a peek method. I've seen some discussion about queue.peek but don't see anything in the docs about it. Does python have a ...
    VelozVeloz
    Mar 2, 2010 at 4:29 pm
    Mar 9, 2010 at 1:47 am
  • I've written my first python program, and would love suggestions for improvement. I'm a perl programmer and used a perl version of this program to guide me. So in that sense, the python is ...
    Pete EmersonPete Emerson
    Mar 4, 2010 at 6:39 pm
    Mar 5, 2010 at 6:50 pm
  • Dear friends . I have two simple questions: It is possible to encrypt with md5 python source code? What option do I have to protect my python source code? Thank you .
    CatalinfestCatalinfest
    Mar 28, 2010 at 6:59 am
    Apr 5, 2010 at 2:58 am
  • On 2010-02-28 06:31:56 -0800, ssteinerX at gmail.com said: But somehow the question is not in the FAQ, though the answer is. See: ...
    R FritzR Fritz
    Mar 2, 2010 at 9:14 pm
    Mar 30, 2010 at 5:19 pm
  • I know that unicode is the way to go in Python 3.1, but it is getting in my way right now in my Unix scripts. How do I write a chr(253) to a file? #nntst2.py import sys,codecs mychar=chr(253) ...
    NnNn
    Mar 23, 2010 at 5:33 pm
    Mar 24, 2010 at 7:35 pm
  • What does a slice as [N::-1] ? It looks that in the first it reverses the slice and then it shows only N items, right? Could you add an example to get the same result without use `::` to see it more ...
    Joan MillerJoan Miller
    Mar 5, 2010 at 6:01 pm
    Mar 6, 2010 at 3:05 am
  • Subject line pretty much says it all: is there a book like "Effective Java" for Python. I.e. a book that assumes that readers are experienced programmers that already know the basics of the language, ...
    KjKj
    Mar 10, 2010 at 3:19 pm
    Mar 12, 2010 at 8:36 pm
  • __dict__. I know I can just do: FOO = 'bar' at the module top-level, but I've got 'FOO' as a string and what I really need to do is __dict__['Foo'] = 'bar' When I do that, I get "NameError: name ...
    Roy SmithRoy Smith
    Mar 2, 2010 at 4:27 am
    Mar 4, 2010 at 10:43 am
  • Folks: Every couple of years I run into a problem where some Python code that worked well at small scales starts burning up my CPU at larger scales, and the underlying issue turns out to be the idiom ...
    Zooko O'WhielacronxZooko O'Whielacronx
    Mar 12, 2010 at 7:11 am
    Mar 30, 2010 at 1:46 pm
  • Hi, I'm trying to do something like : if m = re.match(r'define\s+(\S+)\s*{$', line): thing = m.group(1) elif m = re.match(r'include\s+(\S+)$', line): thing = m.group(1) else thing = "" But in fact ...
    SambSamb
    Mar 16, 2010 at 7:45 am
    Mar 16, 2010 at 3:40 pm
  • Say that "m" is a tuple of 2-tuples m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6)) and I need to build a "d" dict where each key has an associated list whose first element is the count, and ...
    VsolerVsoler
    Mar 13, 2010 at 3:05 pm
    Mar 14, 2010 at 1:28 pm
  • Hours of Googling has not helped me resolve a seemingly simple question - Given a string s, how can I tell whether it's ascii (and thus 1 byte per character) or UTF-8 (and two bytes per character)? ...
    C. Benson ManicaC. Benson Manica
    Mar 9, 2010 at 4:54 pm
    Mar 9, 2010 at 10:15 pm
  • Hi all, I'd like to ask about the possibility of negative "counts" in collections.Counter (using Python 3.1); I believe, my usecase is rather trivial, basically I have the word frequencies of two ...
    Vlastimil BromVlastimil Brom
    Mar 7, 2010 at 9:04 pm
    Mar 8, 2010 at 10:44 pm
  • I've been wrestling with dicts. I hope at the very least what I discovered helps someone else out, but I'm interested in hearing from more learned python users. I found out that adding a two ...
    Pete EmersonPete Emerson
    Mar 6, 2010 at 1:22 am
    Mar 8, 2010 at 1:14 am
  • hi, i've to convert from Pascal this code: iterations=0; count=0; REPEAT; iterations = iterations+1; ... IF (genericCondition) THEN count=count+1; ... CASE count OF: 1: m = 1 2: m = 10 3: m = 100 ...
    TracubikTracubik
    Mar 2, 2010 at 5:46 pm
    Mar 4, 2010 at 10:58 am
  • I have two arrays, made with numpy. The first one has values that I want to use as sorting keys; the second one needs to be sorted by those keys. Obviously I could turn them into a dictionary of ...
    Victor EijkhoutVictor Eijkhout
    Mar 30, 2010 at 11:25 pm
    Apr 1, 2010 at 2:59 pm
  • Hello I've just realized recently that sys.exc_info() didn't return a full traceback for exception concerned : it actually only contains the frame below the point of exception catching. That's very ...
    PakalPakal
    Mar 17, 2010 at 10:42 am
    Mar 25, 2010 at 5:41 pm
  • I have a list of items L, and a test function is_invalid that checks the validity of each item. To check that there are no invalid items in L, I could check the value of any(map(is_invalid, L)). But ...
    KjKj
    Mar 22, 2010 at 2:45 pm
    Mar 23, 2010 at 10:55 am
Group Navigation
period‹ prev | Mar 2010 | next ›
Group Overview
grouppython-list @
categoriespython
discussions508
posts2,733
users601
websitepython.org

601 users for March 2010

Steve Holden: 83 posts Steven D'Aprano: 72 posts Alf P. Steinbach: 63 posts MRAB: 60 posts Gabriel Genellina: 54 posts Terry Reedy: 54 posts Patrick Maupin: 53 posts Robert Kern: 53 posts Chris Rebert: 46 posts Stefan Behnel: 46 posts Jean-Michel Pichavant: 45 posts Gregory Ewing: 40 posts Mk: 36 posts Steven D'Aprano: 35 posts Paul Rubin: 29 posts Peter Otten: 28 posts Steve Howell: 28 posts Alex Hall: 27 posts Bruno Desthuilliers: 27 posts Martin P. Hellwig: 27 posts
show more
Archives