Re: Python 3: dict dict.keys()

2013-07-24 Thread Oscar Benjamin
On Jul 24, 2013 7:25 AM, Peter Otten __pete...@web.de wrote: Ethan Furman wrote: So, my question boils down to: in Python 3 how is dict.keys() different from dict? What are the use cases? I just grepped through /usr/lib/python3, and could not identify a single line where

Re: Python 3: dict dict.keys()

2013-07-24 Thread Oscar Benjamin
On Jul 24, 2013 2:27 PM, Peter Otten __pete...@web.de wrote: Oscar Benjamin wrote: On Jul 24, 2013 7:25 AM, Peter Otten __pete...@web.de wrote: Ethan Furman wrote: So, my question boils down to: in Python 3 how is dict.keys() different from dict? What are the use cases? I

Unexpected results comparing float to Fraction

2013-07-30 Thread Oscar Benjamin
On 29 July 2013 17:09, MRAB pyt...@mrabarnett.plus.com wrote: On 29/07/2013 16:43, Steven D'Aprano wrote: Comparing floats to Fractions gives unexpected results: You may not have expected these results but as someone who regularly uses the fractions module I do expect them. # Python 3.3 py

Re: Unexpected results comparing float to Fraction

2013-08-01 Thread Oscar Benjamin
On 1 August 2013 07:32, Chris Angelico ros...@gmail.com wrote: On Thu, Aug 1, 2013 at 7:20 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I know this, and that's not what surprised me. What surprised me was that Fraction converts the float to a fraction, then compares. It

Re: PEP 450 Adding a statistics module to Python

2013-08-10 Thread Oscar Benjamin
On 10 August 2013 12:50, Roy Smith r...@panix.com wrote: In article mailman.417.1376104455.1251.python-l...@python.org, Skip Montanaro s...@pobox.com wrote: Given that installing numpy or scipy is generally no more difficult that executing pip install (scipy|numpy) I'm not really feeling the

Re: PEP 450 Adding a statistics module to Python

2013-08-10 Thread Oscar Benjamin
On 10 August 2013 13:43, Roy Smith r...@panix.com wrote: In article mailman.425.1376137459.1251.python-l...@python.org, Oscar Benjamin oscar.j.benja...@gmail.com wrote: You should use apt-get for numpy/scipy on Ubuntu. Although unfortunately IIRC this doesn't work as well as it should since

Re: PEP 450 Adding a statistics module to Python

2013-08-13 Thread Oscar Benjamin
On Aug 13, 2013 7:22 PM, Wolfgang Keller felip...@gmx.net wrote: I am seeking comments on PEP 450, Adding a statistics module to Python's standard library: I don't think that you want to re-implement RPy. You're right. He doesn't. Oscar --

Re: PEP 450 Adding a statistics module to Python

2013-08-16 Thread Oscar Benjamin
On 16 August 2013 17:31, chris.bar...@noaa.gov wrote: I am seeking comments on PEP 450, Adding a statistics module to Python's The trick here is that numpy really is the right way to do this stuff. Although it doesn't mention this in the PEP, a significant point that is worth bearing in mind

Re: PEP 450 Adding a statistics module to Python

2013-08-16 Thread Oscar Benjamin
On 16 August 2013 20:00, chris.bar...@noaa.gov wrote: One other point -- for performance reason, is would be nice to have some compiled code in there -- this adds incentive to put it in the stdlib -- external packages that need compiling is what makes numpy unacceptable to some folks.

Re: Matrix sort

2013-08-21 Thread Oscar Benjamin
On 21 August 2013 10:24, vijayendramunik...@gmail.com wrote: Hi I have a matrix of numbers representing the nodal points as follows: Element No.Nodes 1 1 2 3 4 2 5 6 7 8 3 2 3 9 10 ...

Re: python3 integer division debugging

2013-08-28 Thread Oscar Benjamin
On 28 August 2013 16:15, Neal Becker ndbeck...@gmail.com wrote: The change in integer division seems to be the most insidious source of silent errors in porting code from python2 - since it changes the behaviour or valid code silently. I wish the interpreter had an instrumented mode to detect

Re: print function and unwanted trailing space

2013-08-31 Thread Oscar Benjamin
On 31 August 2013 12:16, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 31 Aug 2013 10:17:23 +0200, candide wrote: What is the equivalent in Python 3 to the following Python 2 code: # - for i in range(5): print i, #

Re: print function and unwanted trailing space

2013-08-31 Thread Oscar Benjamin
On 31 August 2013 16:30, Chris Angelico ros...@gmail.com wrote: but doesn't solve all the cases (imagine a string or an iterator). Similar but maybe simpler, and copes with more arbitrary iterables: it=iter(range(5)) print(next(it), end='') for i in it: print('',i, end='') If you

Re: Simplex Algorithm

2013-09-02 Thread Oscar Benjamin
On Sep 2, 2013 2:31 AM, Tommy Vee xx...@xx.xxx wrote: Anyone know where I can get an easy to use Python class or algorithm for the Simplex optimization algorithm? I've tried the one in the link below, but I can't figure out if a) I'm using it properly, or b) where to get the solution. BTW,

Re: How can I remove the first line of a multi-line string?

2013-09-02 Thread Oscar Benjamin
On 2 September 2013 17:06, Anthony Papillion papill...@gmail.com wrote: Hello Everyone, I have a multi-line string and I need to remove the very first line from it. How can I do that? I looked at StringIO but I can't seem to figure out how to properly use it to remove the first line.

Re: Importing Definitions

2013-09-06 Thread Oscar Benjamin
On 5 September 2013 19:06, Skip Montanaro s...@pobox.com wrote: You can! Any name will work, functions aren't special. from module1 import method1, A, B, C, D, E Better practice is to use: import module1 print module1.A print module2.B and so forth since that makes it far more clear

Re: Can I trust downloading Python?

2013-09-10 Thread Oscar Benjamin
On 10 September 2013 01:06, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 09 Sep 2013 12:19:11 +, Fattburger wrote: But really, we've learned *nothing* from the viruses of the 1990s. Remember when we used to talk about how crazy it was to download code from untrusted

Re: Weighted choices

2013-09-10 Thread Oscar Benjamin
On 10 September 2013 03:27, Jason Friedman jsf80...@gmail.com wrote: OK, you're well inside the finite domain. Also, you probably want less than the natural randomness. I'd probably shuffle the potential quarterbacks and the others in independent lists, and then pick one half of each to form

Re: why syntax change in lambda

2013-09-11 Thread Oscar Benjamin
On 11 September 2013 14:03, Neal Becker ndbeck...@gmail.com wrote: In py2.7 this was accepted, but not in py3.3. Is this intentional? It seems to violate the 'principle' that extraneous parentheses are usually allowed/ignored In [1]: p = lambda x: x In [2]: p = lambda (x): x File

Re: Help please, why doesn't it show the next input?

2013-09-12 Thread Oscar Benjamin
On 12 September 2013 07:04, William Bryant gogobe...@gmail.com wrote: Thanks everyone for helping but I did listen to you :3 Sorry. This is my code, it works, I know it's not the best way to do it and it's the long way round but it is one of my first programs ever and I'm happy with it: Hi

Re: Please omit false legalese footers (was: Language design)

2013-09-12 Thread Oscar Benjamin
On 12 September 2013 10:27, Skip Montanaro s...@pobox.com wrote: More likely, JP Morgan's mail system added that footer to the message on the way out the virtual door. My recommendation would be to not post using your company email address. Get a free email address. It wouldn't surprise me if

Re: Qt connect and first connect or unicode

2013-09-17 Thread Oscar Benjamin
On 17 September 2013 05:12, Mohsen Pahlevanzadeh moh...@pahlevanzadeh.org wrote: Dear all, Unfortunately, i confused and need help... the following code is: ### ##CheckBox: QtCore.QObject.connect(self.checkBox,

Re: statsmodels.api

2013-09-17 Thread Oscar Benjamin
On 17 September 2013 11:10, Davide Dalmasso davide.dalma...@gmail.com wrote: Il giorno lunedì 16 settembre 2013 17:47:55 UTC+2, Ethan Furman ha scritto: We'll need the rest of the traceback, as it will have the actual error. Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC

Re: statsmodels.api

2013-09-17 Thread Oscar Benjamin
On 17 September 2013 13:13, Davide Dalmasso davide.dalma...@gmail.com wrote: You are right... there is a problem with scipy intallation because this error arise... from scipy.interpolate import interp1d Traceback (most recent call last): File pyshell#3, line 1, in module from

Re: statsmodels.api

2013-09-17 Thread Oscar Benjamin
On 17 September 2013 14:35, Josef Pktd josef.p...@gmail.com wrote: (As an aside, this is all much simpler if you're using Ubuntu or some other Linux distro rather than Windows.) scientific python on a stick https://code.google.com/p/winpython/wiki/PackageIndex_33 Thanks, I've just installed

Re: statsmodels.api

2013-09-17 Thread Oscar Benjamin
On 17 September 2013 15:52, Josef Perktold josef.p...@gmail.com wrote: On the other hand, python-xy comes with MingW, and I never had any problems compiling pandas and statsmodels for any version combination of python and numpy that I tested (although 32 bit only so far, I never set up the

Re: scipy 11 and scipy 12

2013-09-18 Thread Oscar Benjamin
On 18 September 2013 03:48, Steven D'Aprano st...@pearwood.info wrote: On Tue, 17 Sep 2013 20:06:44 -0400, Susan Lubbers wrote: Our group is a python 2.7 which is installed in a shared area. We have scipy 11 installed in site-packages. How would I install scipy 12 so that I used the shared

Re: iterating over a file with two pointers

2013-09-18 Thread Oscar Benjamin
On 18 September 2013 13:56, Roy Smith r...@panix.com wrote: On Wed, Sep 18, 2013 at 9:12 PM, nikhil Pandey nikhilpande...@gmail.com wrote: hi, I want to iterate over the lines of a file and when i find certain lines, i need another loop starting from the next of that CERTAIN line till a

Re: scipy 11 and scipy 12

2013-09-19 Thread Oscar Benjamin
On 19 September 2013 03:42, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: For Python 2.7 I think that easy_install will be able to install from the sourceforge binaries, e.g easy_install --user scipy but I may be wrong. I should add that I meant the above as a suggestion

Re: iterating over a file with two pointers

2013-09-19 Thread Oscar Benjamin
On 19 September 2013 08:23, Peter Otten __pete...@web.de wrote: Roy Smith wrote: I believe by Peter's version, you're talking about: from itertools import islice, tee with open(tmp.txt) as f: while True: for outer in f: print outer, if * in outer:

Re: linregress and polyfit

2013-09-19 Thread Oscar Benjamin
On 18 September 2013 20:57, Dave Angel da...@davea.name wrote: On 18/9/2013 09:38, chitt...@uah.edu wrote: Thanks - that helps ... but it is puzzling because np.random.normal(0.0,1.0,1) returns exactly one and when I checked the length of z, I get 21 (as before) ... I don't use Numpy, so

Re: iterating over a file with two pointers

2013-09-19 Thread Oscar Benjamin
On 19 September 2013 15:38, Peter Otten __pete...@web.de wrote: While running the above python.exe was using 6MB of memory (according to Task Manager). I believe this is because tee() works as follows (which I made up but it's how I imagine it). [...] However, when I ran the above script on

Re: TypeError: only length-1 arrays can be converted to Python

2013-09-21 Thread Oscar Benjamin
On Sep 21, 2013 7:40 AM, D.YAN ESCOLAR RAMBAL dyeringa...@gmail.com wrote: Traceback (most recent call last): File D:\Yan\Documents\Aptana Studio 3 Workspace\DIF1DMEDYER\SOLUCION NUMERICA PARA LA ECUACION DE LA DIFUSION EN 1D DYER, line 34, in module C=(Cdifuana(M,A,D,x,tinicial))

Re: reload and work flow suggestions

2013-09-23 Thread Oscar Benjamin
On 23 September 2013 10:35, rusi rustompm...@gmail.com wrote: Then, I launch iPython, which can intellisense launch 3 easily. Then I make whatever changes I need to 1-3 to make a baby step forward, close iPython, and repeat. Hardly looks very ergonomic to me I'm not quite sure what's meant

Re: parse list recurisively

2013-09-23 Thread Oscar Benjamin
On 23 September 2013 13:53, and...@zoho.com wrote: Hello, i use a load of lists and often i dont know how deep it is, how can i parse that lists elegantly (without a bunch of for loops) I don't really understand what you mean. Can you show some code that illustrates what you're doing?

Re: How to quickly search over a large number of files using python?

2013-09-25 Thread Oscar Benjamin
On 25 September 2013 09:41, dwivedi.dev...@gmail.com wrote: I am a newbie to python. I have about 500 search queries, and about 52000 files in which I have to find all matches for each of the 500 queries. How should I approach this? Seems like the straightforward way to do it would be to

Re: python function parameters, debugging, comments, etc.

2013-10-02 Thread Oscar Benjamin
On 2 October 2013 00:45, Rotwang sg...@hotmail.co.uk wrote: So the upside of duck-typing is clear. But as you've already discovered, so is the downside: Python's dynamic nature means that there's no way for the interpreter to know what kind of arguments a function will accept, and so a user

Re: Running code from source that includes extension modules

2013-10-03 Thread Oscar Benjamin
On 2 October 2013 23:28, Michael Schwarz michi.schw...@gmail.com wrote: I will look into that too, that sounds very convenient. But am I right, that to use Cython the non-Python code needs to be written in the Cython language, which means I can't just copypast C code into it? For my current

Re: ipy %run noob confusion

2013-10-04 Thread Oscar Benjamin
On 3 October 2013 18:42, jshra...@gmail.com wrote: I have some rather complex code that works perfectly well if I paste it in by hand to ipython, but if I use %run it can't find some of the libraries, but others it can. The confusion seems to have to do with mathplotlib. I get it in stream

Re: howto check programs and C libraries

2013-10-04 Thread Oscar Benjamin
On 4 October 2013 10:30, David Palao dpalao.pyt...@gmail.com wrote: Hello, I'm in charge of preparing a computer room for the practices of introduction to programming. One of the tasks is checking that from all the computers in the room one can execute some programs and link (and compile)

Re: hg.python.org: Server unresponsive and timeout

2013-10-04 Thread Oscar Benjamin
On 2 October 2013 23:25, Terry Reedy tjre...@udel.edu wrote: On 10/2/2013 5:36 AM, Tae Wong wrote: This post is irrelevant from using Python; so it's an Internet server problem. When you try to connect to hg.python.org, the connection takes forever. I believe hg.python.org is on a

Re: class-private names and the Zen of Python

2013-10-08 Thread Oscar Benjamin
On Oct 8, 2013 2:26 PM, Steven Dapos;Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 08 Oct 2013 12:13:48 +0200, Marco Buttu wrote: Another question is: where is the place in which this transformation occurs? Is it at the parser level, before the dictionary attribute is gave

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-10 Thread Oscar Benjamin
On 10 October 2013 15:34, David bouncingc...@gmail.com wrote: On 11 October 2013 00:25, Chris Angelico ros...@gmail.com wrote: On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith r...@panix.com wrote: I've never been well-up on complex numbers; can you elaborate on this, please? All I know is that I

Re: I am never going to complain about Python again

2013-10-10 Thread Oscar Benjamin
On 10 October 2013 18:48, Neil Cerutti ne...@norwich.edu wrote: I guess the if appropriate part eluded my eye. When *is* it appropriate? Apparently not during an equal test. 5.0 == abs(3 + 4j) False If the above is genuine output then it's most likely floating point error. I wouldn't expect

Re: Complex literals (was Re: I am never going to complain about Python again)

2013-10-11 Thread Oscar Benjamin
On 11 October 2013 10:35, David bouncingc...@gmail.com wrote: On 11 October 2013 12:27, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 11 Oct 2013 00:25:27 +1100, Chris Angelico wrote: On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith r...@panix.com wrote: BTW, one of the

Re: converting letters to numbers

2013-10-16 Thread Oscar Benjamin
On Oct 16, 2013 11:54 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 16/10/2013 23:39, Rotwang wrote: On 14/10/2013 06:02, Steven D'Aprano wrote: On Sun, 13 Oct 2013 20:13:32 -0700, Tim Roberts wrote: def add(c1, c2): % Decode c1 = ord(c1) - 65 c2 = ord(c2) - 65

Re: strange array size problem

2013-10-18 Thread Oscar Benjamin
On 18 October 2013 16:36, chip9m...@gmail.com wrote: one more thing. the problem is not in the last column, if I use it in regression (only that column, or with a few others) I will get the results. But if I use all 43 columns python breaks! Have you tried testing the rank with

Re: strange array size problem

2013-10-18 Thread Oscar Benjamin
On 18 October 2013 16:52, chip9m...@gmail.com wrote: Interesting! rank of the whole minus last row numpy.linalg.matrix_rank(users_elements_matrix[:,0:42]) is 42 but also rank of whole is numpy.linalg.matrix_rank(users_elements_matrix[:,0:43]) is 42 but what does that mean?! It means that

Re: Python Front-end to GCC

2013-10-21 Thread Oscar Benjamin
On 21 October 2013 08:46, Steven D'Aprano st...@pearwood.info wrote: On Sun, 20 Oct 2013 20:35:03 -0700, Mark Janssen wrote: [Attribution to the original post has been lost] Is a jit implementation of a language (not just python) better than traditional ahead of time compilation. Not at

Re: Python Front-end to GCC

2013-10-22 Thread Oscar Benjamin
On 22 October 2013 00:41, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 21 Oct 2013 10:55:10 +0100, Oscar Benjamin wrote: On 21 October 2013 08:46, Steven D'Aprano st...@pearwood.info wrote: On the contrary, you have that backwards. An optimizing JIT compiler can often

Re: python -c commands on windows.

2013-10-22 Thread Oscar Benjamin
On 21 October 2013 21:47, Terry Reedy tjre...@udel.edu wrote: Manual says -c command Execute the Python code in command. command can be one or more statements separated by newlines, with significant leading whitespace as in normal module code. In Windows Command Prompt I get:

Re: Python Front-end to GCC

2013-10-22 Thread Oscar Benjamin
On 22 October 2013 13:00, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 22 Oct 2013 10:14:16 +0100, Oscar Benjamin wrote: On 22 October 2013 00:41, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Are you suggesting that gcc is not a decent compiler

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Oscar Benjamin
On 24 October 2013 01:09, Tim Daneliuk tun...@tundraware.com wrote: Now that I think about it, as I recall from the prehistoric era of writing lots of assembler and C, if you use shell redirection, stdin shows up as a handle to the file Yes this is true. A demonstration using seek (on Windows

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Oscar Benjamin
On 24 October 2013 12:58, Tim Daneliuk tun...@tundraware.com wrote: On 10/23/2013 11:54 PM, Ben Finney wrote: we don't welcome ableist (nor sexist) behaviour. Well now I just feel so very awful ... Please end this line of discussion. Ben is right: your comment was entirely unnecessary and

Re: Maintaining a backported module

2013-10-25 Thread Oscar Benjamin
On Oct 24, 2013 9:38 PM, Terry Reedy tjre...@udel.edu wrote: On 10/24/2013 1:46 PM, Ned Batchelder wrote: On Thu, 24 Oct 2013 06:36:04 -0400, Ned Batchelder wrote: coverage.py currently runs on 2.3 through 3.4 I want to thank you for this package. I have used it when writing test modules

Re: Parsing multiple lines from text file using regex

2013-10-28 Thread Oscar Benjamin
On 28 October 2013 00:35, Marc m...@marcd.org wrote: What was wrong with the answer Peter Otten gave you earlier today on the tutor mailing list? -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence I did not

Re: Talking to a 'C' program

2013-11-08 Thread Oscar Benjamin
On 8 November 2013 14:23, John Pote johnhp...@o2.co.uk wrote: Hi all, I have the task of testing some embedded 'C' code for a small micro-controller. Thought it would be a good idea to test it on the PC first to make sure the algorithm is correct then perhaps test it on the controller via

Re: class object's attribute is also the instance's attribute?

2012-08-30 Thread Oscar Benjamin
On Thu, 30 Aug 2012 05:34:51 -0700 (PDT), Marco Nawijn naw...@gmail.com wrote: If you want attributes to be local to the instance, you have to define them in the __init__ section of the class like this: class A(object): def __init__(self): d = 'my attribute' Except that in this

Re: Beginners question

2012-08-30 Thread Oscar Benjamin
On Thu, 30 Aug 2012 09:23:03 -0400, Dave Angel d...@davea.name wrote: I haven't discovered why sometimes the type output shows type instead of class. There are other ways of defining classes, however, and perhaps this is using one of them. Still, it is a class, and stat() is returning an

Re: class object's attribute is also the instance's attribute?

2012-08-30 Thread Oscar Benjamin
On 30 August 2012 15:11, Marco Nawijn naw...@gmail.com wrote: Learned my lesson today. Don't assume you know something. Test it first ;). I have done quite some programming in Python, but did not know that class attributes are still local to the instances. It is also a little surprising I

Re: simple client data base

2012-09-03 Thread Oscar Benjamin
On 3 September 2012 15:12, Mark R Rivet markrri...@aol.com wrote: Hello all, I am learning to program in python. I have a need to make a program that can store, retrieve, add, and delete client data such as name, address, social, telephone number and similar information. This would be a small

Re: Comparing strings from the back?

2012-09-04 Thread Oscar Benjamin
On 4 September 2012 19:07, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 04 Sep 2012 18:32:57 +0200, Johannes Bauer wrote: On 04.09.2012 04:17, Steven D'Aprano wrote: On average, string equality needs to check half the characters in the string. How do you

Re: Comparing strings from the back?

2012-09-04 Thread Oscar Benjamin
On 4 September 2012 22:59, Chris Angelico ros...@gmail.com wrote: On Wed, Sep 5, 2012 at 2:32 AM, Johannes Bauer dfnsonfsdu...@gmx.de wrote: How do you arrive at that conclusion? When comparing two random strings, I just derived n = (256 / 255) * (1 - 256 ^ (-c)) where n is the

Re: Comparing strings from the back?

2012-09-05 Thread Oscar Benjamin
On 5 September 2012 10:48, Peter Otten __pete...@web.de wrote: Chris Angelico wrote: On Wed, Sep 5, 2012 at 6:29 PM, Peter Otten __pete...@web.de wrote: comparing every pair in a sample of 1000 8-char words taken from '/usr/share/dict/words' head 1: 477222

Re: Comparing strings from the back?

2012-09-05 Thread Oscar Benjamin
In news.gmane.comp.python.general, you wrote: On Wed, 05 Sep 2012 16:51:10 +0200, Johannes Bauer wrote: [...] You are making unjustified assumptions about the distribution of letters in the words. This might be a list of long chemical compounds where the words typically differ only in their

Re: Comparing strings from the back?

2012-09-06 Thread Oscar Benjamin
On Thu, 06 Sep 2012 06:07:38 -0400, Dave Angel d...@davea.name wrote: For random strings (as defined below), the average compare time is effectively unrelated to the size of the string, once the size passes some point. Define random string as being a selection from a set of characters,

Re: Comparing strings from the back?

2012-09-07 Thread Oscar Benjamin
On 2012-09-07, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: snip After further thought, and giving consideration to the arguments given by people here, I'm now satisfied to say that for equal-length strings, string equality is best described as O(N). 1) If the strings are

Re: Comparing strings from the back?

2012-09-07 Thread Oscar Benjamin
On 2012-09-07, Oscar Benjamin oscar.j.benja...@gmail.com wrote: On 2012-09-07, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: snip Since string comparison is only useful if the strings can be equal or unequal, the average case depends on how often they are equal/unequal as well

Re: Comparing strings from the back?

2012-09-08 Thread Oscar Benjamin
On 2012-09-08, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 07 Sep 2012 19:10:16 +, Oscar Benjamin wrote: On 2012-09-07, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: snip Would you say, then, that dict insertion is O(N)? Pedantically, yes

Re: Standard Asynchronous Python

2012-09-10 Thread Oscar Benjamin
On 2012-09-10, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Sun, 9 Sep 2012 20:07:51 -0400, Dustin J. Mitchell dus...@v.igoro.us declaimed the following in gmane.comp.python.general: My proposal met with near-silence, and I didn't pursue it. Instead, I did what any self-respecting

Re: Comparing strings from the back?

2012-09-10 Thread Oscar Benjamin
On 2012-09-10, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 10 Sep 2012 08:59:37 +, Duncan Booth wrote: Gelonida N gelon...@gmail.com wrote: so at the expense of a single dictionary insertion when the string is created you can get guaranteed O(1) on all the

Re: Comparing strings from the back?

2012-09-10 Thread Oscar Benjamin
On 2012-09-10, Chris Angelico ros...@gmail.com wrote: On Tue, Sep 11, 2012 at 12:06 AM, Oscar Benjamin oscar.j.benja...@gmail.com wrote: On 2012-09-10, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: What interning buys you is that s == t is an O(1) pointer compare

Re: Comparing strings from the back?

2012-09-10 Thread Oscar Benjamin
On 2012-09-10, Oscar Benjamin oscar.j.benja...@gmail.com wrote: On 2012-09-10, Chris Angelico ros...@gmail.com wrote: On Tue, Sep 11, 2012 at 12:06 AM, Oscar Benjamin oscar.j.benja...@gmail.com wrote: On 2012-09-10, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: What interning

Re: Comparing strings from the back?

2012-09-10 Thread Oscar Benjamin
On 2012-09-10, Dan Goodman dg.gm...@thesamovar.net wrote: On 04/09/2012 03:54, Roy Smith wrote: Let's assume you're testing two strings for equality. You've already done the obvious quick tests (i.e they're the same length), and you're down to the O(n) part of comparing every character. I'm

Re: Comparing strings from the back?

2012-09-10 Thread Oscar Benjamin
On 2012-09-10, Dan Goodman dg.gm...@thesamovar.net wrote: On 10/09/2012 18:07, Dan Goodman wrote: On 04/09/2012 03:54, Roy Smith wrote: Let's assume you're testing two strings for equality. You've already done the obvious quick tests (i.e they're the same length), and you're down to the O(n)

Re: Comparing strings from the back?

2012-09-11 Thread Oscar Benjamin
On 11 September 2012 10:51, Duncan Booth duncan.booth@invalid.invalidwrote: Oscar Benjamin oscar.j.benja...@gmail.com wrote: What interning buys you is that s == t is an O(1) pointer compare if they are equal. But if s and t differ in the last character, __eq__ will still inspect every

Re: submit jobs on multi-core

2012-09-11 Thread Oscar Benjamin
On 2012-09-11, Dhananjay dhananjay.c.jo...@gmail.com wrote: --===0316394162== Content-Type: multipart/alternative; boundary=20cf30776bd309ffd004c96557e2 --20cf30776bd309ffd004c96557e2 Content-Type: text/plain; charset=ISO-8859-1 Dear all, I have a python script in which I have

Re: generators as decorators simple issue

2012-09-12 Thread Oscar Benjamin
On Wed, 12 Sep 2012 03:22:31 -0700 (PDT), pyjoshsys j.m.dagenh...@gmail.com wrote: The output is still not what I want. Now runtime error free, however the output is not what I desire. def setname(cls): '''this is the proposed generator to call SetName on the object''' try:

Re: Boolean function on variable-length lists

2012-09-12 Thread Oscar Benjamin
On 12 September 2012 14:25, Libra librar...@gmail.com wrote: On Wednesday, September 12, 2012 3:11:42 PM UTC+2, Steven D'Aprano wrote: On Wed, 12 Sep 2012 05:48:09 -0700, Libra wrote: I need to implement a function that returns 1 only if all the values in a list satisfy given

Re: using subprocess.Popen does not suppress terminal window on Windows

2012-09-13 Thread Oscar Benjamin
On Thu, 13 Sep 2012 00:27:10 -0700 (PDT), janis.judvai...@gmail.com wrote: I'm making a little embedded system programming IDE so I need to run .exe(windows only), make commands, perl python scripts etc(multiplatform). I'm using subprocess.Popen for all of them and it works fine except that

Re: Re: using subprocess.Popen does not suppress terminal window on Windows

2012-09-13 Thread Oscar Benjamin
On 13 September 2012 10:22, Oscar Benjamin oscar.j.benja...@gmail.comwrote: On Thu, 13 Sep 2012 00:27:10 -0700 (PDT), janis.judvai...@gmail.com wrote: I'm making a little embedded system programming IDE so I need to run .exe(windows only), make commands, perl python scripts etc

Re: using subprocess.Popen does not suppress terminal window on Windows

2012-09-13 Thread Oscar Benjamin
On 13 September 2012 13:33, janis.judvai...@gmail.com wrote: It looks like normal terminal to me, could You define normal? Looks like it appears only when target script prints something, but it shouldn't cus I'm using pipes on stdout and stderr. If anyone is interested I'm using function

Re: gc.get_objects()

2012-09-17 Thread Oscar Benjamin
On 2012-09-17, Matteo Boscolo matteo.bosc...@boscolini.eu wrote: from my gc.get_object() I extract the sub system of the object that I would like to delete: this is the object: Class name win32com.gen_py.F4503A16-F637-11D2-BD55-00500400405Bx0x1x0.ITDProperty.ITDProperty that is traked and

Re: Using dict as object

2012-09-19 Thread Oscar Benjamin
On 2012-09-19, Dave Angel d...@davea.name wrote: On 09/19/2012 06:24 AM, Pierre Tardy wrote: All implementation I tried are much slower than a pure native dict access. Each implementation have bench results in commit comment. All of them are 20+x slower than plain dict! Assuming you're

Re: Using dict as object

2012-09-19 Thread Oscar Benjamin
On 2012-09-19, Pierre Tardy tar...@gmail.com wrote: --===1362296571== Content-Type: multipart/alternative; boundary=bcaec554d3229e814204ca105e50 --bcaec554d3229e814204ca105e50 Content-Type: text/plain; charset=ISO-8859-1 This has been proposed and discussed and even

For Counter Variable

2012-09-23 Thread Oscar Benjamin
On Sep 23, 2012 5:42 PM, jimbo1qaz jimmyli1...@gmail.com wrote: Am I missing something obvious, or do I have to manually put in a counter in the for loops? That's a very basic request, but I couldn't find anything in the documentation. Have you seen the enumerate function? Oscar --

Re: For Counter Variable

2012-09-23 Thread Oscar Benjamin
On Sep 23, 2012 6:52 PM, jimbo1qaz jimmyli1...@gmail.com wrote: On Sunday, September 23, 2012 9:36:19 AM UTC-7, jimbo1qaz wrote: Am I missing something obvious, or do I have to manually put in a counter in the for loops? That's a very basic request, but I couldn't find anything in the

Re: Anyone able to help on installing packages?

2012-09-23 Thread Oscar Benjamin
On Sep 23, 2012 6:56 PM, John Mordecai Dildy jdild...@gmail.com wrote: Hello everyone out there. Ive been trying to install packages like distribute, nose, and virturalenv and believe me it is a hard process to do. I tried everything I could think of to install. I have done the following:

Re: Anyone able to help on installing packages?

2012-09-23 Thread Oscar Benjamin
Please send your reply to the mailing list (python-list@python.org) rather than privately to me. On 23 September 2012 20:57, John Dildy jdild...@gmail.com wrote: When I give input at the start of terminal using the command pip install virtualenv: Downloading/unpacking virtualenv Running

Re: List Problem

2012-09-23 Thread Oscar Benjamin
On 23 September 2012 22:31, jimbo1qaz jimmyli1...@gmail.com wrote: I have a nested list. Whenever I make a copy of the list, changes in one affect the other, even when I use list(orig) or even copy the sublists one by one. I have to manually copy each cell over for it to work. Link to broken

Re: Editing Inkscape SVG files with Python?

2012-09-23 Thread Oscar Benjamin
On 23 September 2012 23:53, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I have some SVG files generated with Inkscape containing many text blocks (over 100). I wish to programmatically modify those text blocks using Python. Is there a library I should be using, or any other

Re: Java singletonMap in Python

2012-09-23 Thread Oscar Benjamin
On 24 September 2012 00:14, Mark Lawrence breamore...@yahoo.co.uk wrote: Purely for fun I've been porting some code to Python and came across the singletonMap[1]. I'm aware that there are loads of recipes on the web for both singletons e.g.[2] and immutable dictionaries e.g.[3]. I was

Re: Pass numeric arrays from C extensions to Python

2012-09-23 Thread Oscar Benjamin
On 24 September 2012 02:39, JBT jianbao@gmail.com wrote: Hi, I am looking for a way to pass numeric arrays, such as *float a[100]; double b[200];*, from C extension codes to python. The use case of this problem is that you have data stored in a particular format, NASA common data format

Re: Anyone able to help on installing packages?

2012-09-24 Thread Oscar Benjamin
On 24 September 2012 21:27, John Mordecai Dildy jdild...@gmail.com wrote: Anyone have Ideas on nose and distribute? Your post has no context and simply asks a very vague question. Had you explained what you tried and what happened and perhaps shown an error message I might have been able to

Re: python file API

2012-09-24 Thread Oscar Benjamin
On 24 September 2012 22:35, zipher dreamingforw...@gmail.com wrote: For some time now, I've wanted to suggest a better abstraction for the file type in Python. It currently uses an antiquated C-style interface for moving around in a file, with methods like tell() and seek(). But after

Re: python file API

2012-09-24 Thread Oscar Benjamin
On 24 September 2012 23:41, Mark Adam dreamingforw...@gmail.com wrote: seek() and tell() can raise exceptions on some files. Exposing pos as an attribute and allowing it to be manipulated with attribute access gives the impression that it is always meaningful to do so. It's a good

Re: For Counter Variable

2012-09-24 Thread Oscar Benjamin
On 25 September 2012 01:17, Dwight Hutto dwightdhu...@gmail.com wrote: Is the animated GIF on your website under 60MB yet? yeah a command line called convert, and taking out a few jpegs used to convert, and I can reduce it to any size, what's the fucking point of that question other than

Re: python file API

2012-09-25 Thread Oscar Benjamin
On Sep 25, 2012 9:28 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Tue, 25 Sep 2012 08:22:05 +0200, Ulrich Eckhardt ulrich.eckha...@dominolaser.com declaimed the following in gmane.comp.python.general: Am 24.09.2012 23:49, schrieb Dave Angel: And what approach would you use for

Re: python file API

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 08:27, Mark Lawrence breamore...@yahoo.co.uk wrote: On 25/09/2012 03:32, Mark Adam wrote: On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin oscar.j.benja...@gmail.com wrote: try: f.pos = 256 except IOError: print('Unseekable file') Something along

Re: python file API

2012-09-25 Thread Oscar Benjamin
On 25 September 2012 11:51, Mark Lawrence breamore...@yahoo.co.uk wrote: On 25/09/2012 11:38, Oscar Benjamin wrote: On 25 September 2012 08:27, Mark Lawrence breamore...@yahoo.co.uk wrote: On 25/09/2012 03:32, Mark Adam wrote: On Mon, Sep 24, 2012 at 5:55 PM, Oscar Benjamin

  1   2   3   4   5   6   7   >