Search Discussions

260 discussions - 1,371 posts

  • I don't know this book and there may be a pedagogical reason for the implementation you quote, but pairwise_sum is probably better implemented in Python 3.X as: def pairwise_sum(list1, list2): return ...
    Arnaud DelobelleArnaud Delobelle
    Mar 14, 2012 at 11:54 pm
    Apr 2, 2012 at 10:06 pm
  • I'm not entirely sure what you mean by "moderately well", nor "languages", but I'm of the opinion that a good developer should be able to learn a new language very efficiently. Do you count Python 2 ...
    Chris AngelicoChris Angelico
    Mar 22, 2012 at 7:14 pm
    Apr 8, 2012 at 8:47 pm
  • Hi, is there any way to convert a string to bytes without interpreting the data in any way? Something like: s='abcde' b=bytes(s, "unchanged") Regards, Peter
    Peter DaumPeter Daum
    Mar 28, 2012 at 8:56 am
    Aug 30, 2012 at 5:51 am
  • Hi All How can we generate a 6 digit random number from a given number ? eg:- def number_generator(id): random.randint(id,999999) When i am using this it is sometimes giving me five digit and ...
    Nikhil VermaNikhil Verma
    Mar 26, 2012 at 6:08 am
    Apr 3, 2012 at 5:47 am
  • 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 of my script ...
    John SalernoJohn Salerno
    Mar 6, 2012 at 10:43 pm
    Mar 9, 2012 at 10:45 am
  • Hi! I'm currently writing some tests for the error handling of some code. In this scenario, I must make sure that both the correct exception is raised and that the contained error code is correct ...
    Ulrich EckhardtUlrich Eckhardt
    Mar 28, 2012 at 12:28 pm
    Apr 2, 2012 at 7:42 am
  • Hi all, I'm getting close to an alpha release of an OAuth 2.0 implementation (https://github.com/demianbrecht/py-sanction). High level features include: * Support for multiple providers (protocol ...
    Demian BrechtDemian Brecht
    Mar 27, 2012 at 2:42 am
    Jul 6, 2012 at 6:58 pm
  • I'm looking for a Python (2.7) equivalent to the Unix "cp" command. Since the equivalents of "rm" and "mkdir" are in the os module, I figured I look there. I haven't found anything in the ...
    John LadaskyJohn Ladasky
    Mar 28, 2012 at 8:12 pm
    Apr 5, 2012 at 1:30 am
  • Hi guys just wanted to share one of my first programs. Could you please tell me, do I use a right logic ? It works fine what I wanted to do, but is it writen in the right way? My next step is to make ...
    Anatoli HristovAnatoli Hristov
    Mar 26, 2012 at 9:53 pm
    Apr 16, 2012 at 8:37 pm
  • Hi, I think this section of the docs needs some kind of rewrite: <http://docs.python.org/faq/design.html#why-can-t-i-use-an-assignment-in-an-expression While it is great to discuss the reasons for ...
    Alexander BlinneAlexander Blinne
    Mar 23, 2012 at 10:59 pm
    Mar 26, 2012 at 5:42 pm
  • the refreshen of the blood, from Xah's Entertainment Enterprise, i bring you: ?Is Programing Art or Science? http://xahlee.org/UnixResource_dir/writ/art_or_science.html penned in the year of our lord ...
    Xah LeeXah Lee
    Mar 30, 2012 at 8:27 am
    Apr 4, 2012 at 5:52 pm
  • Like the topic.. . I use Python a lot, both Windows and Linux, and it's little weird to have many python process without fast distinction which is what.
    Mar 14, 2012 at 2:43 pm
    Mar 24, 2012 at 3:24 pm
  • See attached example code. I have a program that calls exactly the same code, and here is the strange thing about it: * Program is started as "start.py", e.g. with an open console. In this case, the ...
    Laszlo NagyLaszlo Nagy
    Mar 17, 2012 at 2:13 pm
    Mar 22, 2012 at 3:25 pm
  • Using argparse, if I write: parser.add_argument('--foo', default0) 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: ...
    Roy SmithRoy Smith
    Mar 13, 2012 at 9:08 pm
    Mar 15, 2012 at 9:18 pm
  • I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? From ...
    Mar 26, 2012 at 11:45 am
    Sep 10, 2012 at 7:16 am
  • some additional info i thought is relevant. are int, float, long, double, side-effects of computer engineering? Xah Lee wrote: ?? One easy way to measure it is whether a programer can read and ...
    Xah LeeXah Lee
    Mar 6, 2012 at 1:11 am
    Mar 14, 2012 at 5:32 am
  • I'm getting line 79, in tounicode return(unicode(s, errors='replace')) TypeError: decoding Unicode is not supported from this, under Python 2.7: def tounicode(s) : if type(s) == unicode : return(s) ...
    John NagleJohn Nagle
    Mar 7, 2012 at 8:25 am
    Mar 11, 2012 at 6:12 am
  • I'm writing an application that interacts with ldap, and I'm looking for advice on how to handle the connection. Specifically, how to close the ldap connection when the application is done. I wrote a ...
    John GordonJohn Gordon
    Mar 21, 2012 at 7:30 pm
    Apr 5, 2012 at 6:56 pm
  • Hello everyone. This is my first post in this group. I started learning python a week ago from the "dive into python" e- book and thus far all was clear. However today while reading chapter 5 about ...
    Mar 8, 2012 at 3:25 pm
    Mar 12, 2012 at 9:09 am
  • I confess i've indulged in Haskell and found f a more readable than f(a) And why aren't functions curried (partially applied function is another function which takes the rest arguments) by default? ...
    Ray SongRay Song
    Mar 16, 2012 at 12:45 pm
    Mar 17, 2012 at 6:39 am
  • Hi List, I've coded three functions that I would like to concatenate. I mean, run them one after another. The third function depends on the results of the second function, which depends on the ...
    Mar 13, 2012 at 2:35 pm
    Mar 14, 2012 at 2:37 pm
  • Which is preferred in a raise: X or X()? I've seen both. In my specific case I'm dumping out of a deep loop: try: for ... for ... for ... if match: raise StopInteration() else ... except ...
    Mar 11, 2012 at 7:04 pm
    Mar 12, 2012 at 4:08 pm
  • In his legendary book series The Art of Computer Programming, Professor Donald E. Knuth presents many of his algorithms in the form that they have been divided in several individual phases, with ...
    Antti J YlikoskiAntti J Ylikoski
    Mar 17, 2012 at 2:03 pm
    Mar 18, 2012 at 11:08 am
  • I'm pulling image data from a database blob, and serving it from a web2py app. I have to send the correct Content-Type header, so I need to detect the image type. Everything that I've found on the ...
    Mar 8, 2012 at 9:55 pm
    Mar 9, 2012 at 5:53 pm
  • I can't seem to wrap my head around all the necessary arguments for making a widget expand when a window is resized. I've been following along with a tutorial and I feel like I'm doing everything it ...
    John SalernoJohn Salerno
    Mar 5, 2012 at 7:12 am
    Mar 6, 2012 at 3:09 am
  • fun example. in-place algorithm for reversing a list in Perl, Python, Lisp http://xahlee.org/comp/in-place_algorithm.html plain text follows ---------------------------------------- What's ?In-place ...
    Xah LeeXah Lee
    Mar 1, 2012 at 4:07 am
    Mar 2, 2012 at 11:30 am
  • Hi, I have a WinXP PC running an SSH server and I have a Linux PC with an SSH client and logged into the XP seemingly OK. It's all on my personal LAN, the connection seems OK. I have a py file on the ...
    Mar 28, 2012 at 12:51 am
    Apr 9, 2012 at 2:35 am
  • I'm porting my existing work to Python 3.X, but... class Foo: def bar(self): pass mthd = Foo.bar assert mthd.im_class is Foo # this does not work in py3k So, how can I get a reference to Foo? This is ...
    Cosmia LunaCosmia Luna
    Mar 17, 2012 at 5:30 am
    Mar 18, 2012 at 4:14 pm
  • 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 ...
    Mar 11, 2012 at 6:53 pm
    Mar 15, 2012 at 12:07 am
  • Hi, I want to know whether two .pyc files are identical. With identical I mean whether they contain the same byte code. Unfortunately it seems, that .pyc files contain also something like the time ...
    Gelonida NGelonida N
    Mar 10, 2012 at 2:48 pm
    Mar 11, 2012 at 11:56 pm
  • What happens if I pickle a class, and later unpickle it where the class now has added some new attributes?
    Neal BeckerNeal Becker
    Mar 6, 2012 at 12:34 pm
    Mar 8, 2012 at 12:16 am
  • Hi, I would like to define methods using exec like this: class A: def __init__(self): cmd = "def sqr(self, x):\n return x**2\nself.sqr = sqr\n" exec cmd a = A() print a.sqr(a, 2) This works, but I ...
    Rolf WesterRolf Wester
    Mar 1, 2012 at 1:07 pm
    Mar 2, 2012 at 7:26 am
  • Hi, I'm able to connect to an Exchange server via SMTP and IMAP from my iPhone using SSL and without using a VPN. So I would expect to be able to do the same from my computer using Python. However, ...
    Mar 31, 2012 at 5:39 am
    Apr 12, 2012 at 5:34 pm
  • Some versions of CentOS 6 seem to have a potential getaddrinfo exploit. See To test, try this from a command line: ping example If it fails, good. If it returns pings from "example.com", bad. The ...
    John NagleJohn Nagle
    Mar 31, 2012 at 10:58 pm
    Apr 4, 2012 at 5:10 pm
  • Hi! I've tried to build Python 2.7.3rc2 on cygwin and got the following errors: $ CFLAGS=-I/usr/include/ncursesw/ CPPFLAGS=-I/usr/include/ncursesw/ ./configure $ make ... gcc -shared ...
    Alexey LuchkoAlexey Luchko
    Mar 28, 2012 at 11:50 am
    Mar 30, 2012 at 11:41 am
  • Algebraically, your concatenation rules don't really make sense - your flows are both distributive and non distributive. You also make the implicit assumption of an order over streams in a flow, but ...
    Nathan RiceNathan Rice
    Mar 23, 2012 at 4:33 pm
    Mar 26, 2012 at 9:27 am
  • I have a rather large ASCII file that is structured as follows header line 9 nonblank lines with alphanumeric data header line 9 nonblank lines with alphanumeric data ... ... ... header line 9 ...
    Virgil StokesVirgil Stokes
    Mar 12, 2012 at 7:39 pm
    Mar 21, 2012 at 4:32 pm
  • I started the following small project: https://github.com/AndreaCrotti/import-tree because I would like to find out what exactly depends on what at run-time, using an import hook. It works quite well ...
    Andrea CrottiAndrea Crotti
    Mar 16, 2012 at 4:49 pm
    Mar 17, 2012 at 1:22 am
  • Which is preferred: for value in list: if not value is another_value: value.do_something() break --or-- if list and not list[0] is another_value: list[0].do_something() Comments are welcome, Thanks ...
    Mar 14, 2012 at 8:37 pm
    Mar 15, 2012 at 5:13 pm
  • I'm trying project euler problem 3 and I've hit the wall with this error. What could be the problem here? l=[] ... if num%i==0: ... l.append(i) ... i+=1 ... print max(l) File "<stdin ", line 5 print ...
    Mar 10, 2012 at 12:34 pm
    Mar 10, 2012 at 5:07 pm
  • I have a list of defective CCD pixels and I need to find clusters where a cluster is a group of adjacent defective pixels. This seems to me to be a classic linked list tree search.I take a pixel from ...
    Mar 7, 2012 at 7:49 pm
    Mar 8, 2012 at 4:12 pm
  • According to the Python docs, the way to use tkinter.ttk is this: from tkinter import * from tkinter.ttk import * But what if I don't like this import method and prefer to do: import tkinter as tk ...
    John SalernoJohn Salerno
    Mar 3, 2012 at 1:48 am
    Mar 5, 2012 at 5:53 am
  • I have the following use case: 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 ...
    Larry MartellLarry Martell
    Mar 28, 2012 at 6:39 pm
    Apr 4, 2012 at 1:45 am
  • I pine for the fjords. And it's time to bring "Python-URL!" to a close. "Python-URL!", which Jean-Claude Wippler and I appear to have launched in 1998, has reached the end of its utility. We still ...
    Cameron LairdCameron Laird
    Mar 31, 2012 at 3:38 pm
    Apr 3, 2012 at 1:34 pm
  • Dear all, I am a bit frustrated by the following as I believe it is something silly that I am not able to see. I am using python 2.7.1+ under ubuntu. When I run the following script as in $python ...
    Mar 29, 2012 at 12:33 pm
    Apr 3, 2012 at 12:47 pm
  • The MySQLdb entry on SourceForge (http://sourceforge.net/projects/mysql-python/) web site still says the last supported version of Python is 2.6. PyPi says the last supported version is Python 2.5 ...
    John NagleJohn Nagle
    Mar 30, 2012 at 9:20 pm
    Apr 2, 2012 at 3:44 pm
  • It seems to me that the Python class system is needlessly confusing. Am I missing something? For example in the class Complex given in the documentation *class Complex:* * def __init__(self, ...
    Steven LeharSteven Lehar
    Mar 22, 2012 at 10:51 am
    Mar 23, 2012 at 2:41 pm
  • Hi I am new to the python programming language. I've been trying to write a script that would access the last modified file in one of my directories. I'm using Win XP. I saw a similar topic, on the ...
    Mar 22, 2012 at 11:33 am
    Mar 23, 2012 at 1:00 pm
  • #!/usr/bin/python def main(): str1='this is a test' str2='t' print "".join([ c for c in str1 if c not in str2 ]) print(str1.strip(str2)) if __name__ == '__main__': main() ./remove_str.py his is a es ...
    Rodrick BrownRodrick Brown
    Mar 22, 2012 at 7:48 pm
    Mar 22, 2012 at 8:18 pm
  • Hi all, I am doing a simulation project using Python. In my project, I want to use some short of distribution to generate requests to a server. The request should have two distributions. One for ...
    Mar 20, 2012 at 4:31 am
    Mar 20, 2012 at 8:19 pm
Group Navigation
period‹ prev | Mar 2012 | next ›
Group Overview
grouppython-list @

341 users for March 2012

Steven D'Aprano: 82 posts Chris Angelico: 68 posts Prasad, Ramit: 46 posts Terry Reedy: 44 posts John Salerno: 43 posts Steve Howell: 33 posts Chris Rebert: 32 posts Peter Otten: 29 posts Nathan Rice: 28 posts Ben Finney: 27 posts Roy Smith: 24 posts Ian Kelly: 22 posts Robert Kern: 21 posts John Nagle: 19 posts Ethan Furman: 17 posts Dave Angel: 16 posts Rick Johnson: 16 posts Stefan Behnel: 15 posts Tim Chase: 15 posts Mark Lawrence: 14 posts
show more