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 wrote: > On 11 October 2013 00:25, Chris Angelico wrote: >> On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: >> >> I've never been well-up on complex numbers; can you elaborate on this, >> please? All I know is that I was taught that the square root of -1 is >>

Re: I am never going to complain about Python again

2013-10-10 Thread Oscar Benjamin
On 10 October 2013 18:48, Neil Cerutti 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 any erro

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 wrote: > On 11 October 2013 12:27, Steven D'Aprano > wrote: >> On Fri, 11 Oct 2013 00:25:27 +1100, Chris Angelico wrote: >> >>> On Fri, Oct 11, 2013 at 12:09 AM, Roy Smith wrote: BTW, one of the earliest things that turned me on to Python was when I disc

Re: converting letters to numbers

2013-10-16 Thread Oscar Benjamin
On Oct 16, 2013 11:54 PM, "MRAB" 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, 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 numpy.linalg.matrix_rank?

Re: strange array size problem

2013-10-18 Thread Oscar Benjamin
On 18 October 2013 16:52, 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 the additio

Re: Python Front-end to GCC

2013-10-21 Thread Oscar Benjamin
On 21 October 2013 08:46, Steven D'Aprano 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 all. The

Re: Python Front-end to GCC

2013-10-22 Thread Oscar Benjamin
On 22 October 2013 00:41, Steven D'Aprano wrote: > On Mon, 21 Oct 2013 10:55:10 +0100, Oscar Benjamin wrote: > >> On 21 October 2013 08:46, Steven D'Aprano wrote: > >>> On the contrary, you have that backwards. An optimizing JIT compiler >>> can

Re: python -c commands on windows.

2013-10-22 Thread Oscar Benjamin
On 21 October 2013 21:47, Terry Reedy wrote: > Manual says "-c > 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: > C:\Programs\Python33>pyth

Re: Python Front-end to GCC

2013-10-22 Thread Oscar Benjamin
On 22 October 2013 13:00, Steven D'Aprano wrote: > On Tue, 22 Oct 2013 10:14:16 +0100, Oscar Benjamin wrote: > >> On 22 October 2013 00:41, Steven D'Aprano >> wrote: >>> >>> Are you suggesting that gcc is not a decent compiler? >> >> No.

Re: Python Front-end to GCC

2013-10-22 Thread Benjamin Kaplan
On Tue, Oct 22, 2013 at 8:04 AM, Mark Janssen wrote: > I love it. Watch this... > > [context] A language specification in BNF is just syntax. It doesn't say anything about semantics. So how could this be used to produce executable C code for a program? BNF is used to produce parser

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Oscar Benjamin
On 24 October 2013 01:09, Tim Daneliuk 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 but it is the sam

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Oscar Benjamin
On 24 October 2013 12:58, Tim Daneliuk 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 could easily offe

Re: Maintaining a backported module

2013-10-25 Thread Oscar Benjamin
On Oct 24, 2013 9:38 PM, "Terry Reedy" 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 modu

Re: Cookie issue(cant fix it with anyhting)

2013-10-27 Thread Benjamin Schollnick
27;] ) >> cookieID = cookie['name'].value >> except: >> cookieID = 'visitor' As it has been said before, change the except to be an explicit error check. The all purpose except is hiding an error condition from you. Take a look at this: http

[RELEASE] Python 2.7.6 release candidate 1

2013-10-27 Thread Benjamin Peterson
final release will follow in a week. Enjoy, Benjamin Peterson 2.7 Release Manager -- https://mail.python.org/mailman/listinfo/python-list

Re: Parsing multiple lines from text file using regex

2013-10-28 Thread Oscar Benjamin
On 28 October 2013 00:35, Marc 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 n

Re: Talking to a 'C' program

2013-11-08 Thread Oscar Benjamin
On 8 November 2013 14:23, John Pote 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 RS232 and an

[RELEASE] Python 2.7.6

2013-11-10 Thread Benjamin Peterson
/ As always, report bugs to http://bugs.python.org/ Have a nice November, Benjamin Peterson 2.7 Release Manager [1] http://bugs.python.org/issue19435 -- https://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] [RELEASE] Python 2.7.6

2013-11-10 Thread Benjamin Peterson
2013/11/10 Victor Stinner : > 2013/11/10 Benjamin Peterson : >> All the changes in Python 2.7.6 are described in full detail in the Misc/NEWS >> file of the source tarball. You can also view online at >> >> http://hg.python.org/cpython/raw-file/99d03261c1ba/Misc/

Re: generator/coroutine terminology

2015-03-14 Thread Oscar Benjamin
On 12 March 2015 at 16:52, Rustom Mody wrote: > > On Thursday, March 12, 2015 at 9:58:07 PM UTC+5:30, Steven D'Aprano wrote: >> Rustom Mody wrote: >> >> > >> > Say I have a simple yielding function: >> > >> > def foo(x): >> >yield x+1 >> >yield x+2 >> > >> > And I have >> > >> > g = foo(2)

Re: Auto-completion: why not module name?

2015-03-17 Thread Oscar Benjamin
On 17 March 2015 at 08:10, Steven D'Aprano wrote: > On Tuesday 17 March 2015 03:23, candide wrote: > > You might like my tab completion and command history module: > > http://code.google.com/p/tabhistory/ > > I've been using it on Linux for about three or four years, and although I > don't promise

Re: Brilliant or insane code?

2015-03-17 Thread Oscar Benjamin
On 18 March 2015 at 00:35, Mark Lawrence wrote: > I've just come across this > http://www.stavros.io/posts/brilliant-or-insane-code/ as a result of this > http://bugs.python.org/issue23695 > > Any and all opinions welcomed, I'm chickening out and sitting firmly on the > fence. It seems fine to me

Re: Python 2.7 issue with decimal value 0.0

2015-03-25 Thread Oscar Benjamin
On 25 March 2015 at 14:20, Larry Martell wrote: > I have an app that works with 2.6, but in 2.7 it is failing. I traced > it down to an issue with decimal.Decimal being passed a value of 0.0. > It 2.6 this is fine, but in 2.7 it throws an exception: > > TypeError: Cannot convert float to Decimal.

Re: Best way to calculate fraction part of x?

2015-03-26 Thread Oscar Benjamin
On 23 March 2015 at 12:52, Steven D'Aprano wrote: > I have a numeric value, possibly a float, Decimal or (improper) Fraction, > and I want the fractional part. E.g. fract(2.5) should give 0.5. > > Here are two ways to do it: > > py> x = 2.5 > py> x % 1 > 0.5 > py> x - int(x) > 0.5 > > x % 1 is sig

pypi submission?

2015-04-06 Thread Benjamin Schollnick
Folks, I’m having issues with submitting to pypi. I can register and upload my package. nerv:~ Benjamin$ pip search directory_caching Directory_Caching - A Caching library for Directories & Files nerv:~ Benjamin$ but, if you try to install it using pip: pip install directory_cac

Re: pypi submission?

2015-04-07 Thread Benjamin Schollnick
> On Apr 6, 2015, at 6:47 PM, Dylan Evans wrote: > > On 6 April 2015 at 23:21:02, Benjamin Schollnick ([email protected]) > wrote: >> And I’ve been messing around with different config files, etc, trying to >> solve the problem >> myself. >> Can any

Re: Converting text file to different encoding.

2015-04-17 Thread Oscar Benjamin
On 17 April 2015 at 14:51, wrote: > On Friday, April 17, 2015 at 6:50:08 PM UTC+5:30, [email protected] > wrote: >> I am having few files in default encoding. I wanted to change their >> encodings, >> preferably in "UTF-8", or may be from one encoding to any other encoding. >> >> I was try

Re: multiprocessing module and matplotlib.pyplot/PdfPages

2015-04-23 Thread Oscar Benjamin
On 21 April 2015 at 16:53, Paulo da Silva wrote: > On 21-04-2015 11:26, Dave Angel wrote: >> On 04/20/2015 10:14 PM, Paulo da Silva wrote: >>> I have program that generates about 100 relatively complex graphics and >>> writes then to a pdf book. >>> It takes a while! >>> Is there any possibility o

[RELEASE] Python 2.7.10 release candidate 1

2015-05-11 Thread Benjamin Peterson
consider testing 2.7.10rc1 with your application and reporting bugs to https://bugs.python.org Regards, Benjamin -- https://mail.python.org/mailman/listinfo/python-list

Re: How to properly apply OOP in the bouncing ball code

2015-05-12 Thread Oscar Benjamin
On 11 May 2015 at 16:22, Tommy C wrote: > Thanks for your help. > > I have updated the code as follows, there are no more errors but the images > will not move at all, as all the images are staying at the upper left corner. > Please advice, thanks. > > > import sys, pygame > > pygame.init() > >

Re: Slices time complexity

2015-05-19 Thread Oscar Benjamin
On 19 May 2015 at 11:15, Serhiy Storchaka wrote: > On 19.05.15 12:45, Steven D'Aprano wrote: >> >> On Tuesday 19 May 2015 05:23, Mario Figueiredo wrote: >>> >>> From the above link it seems slices work in linear time on all cases. >> >> >> I wouldn't trust that is always the case, e.g. deleting a

Re: Why does the first loop go wrong with Python3

2015-05-19 Thread Oscar Benjamin
On 19 May 2015 at 13:24, Cecil Westerhof wrote: > I have the following code: > from __future__ import division, print_function > > import subprocess > > p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE) > for line in iter(p.stdout.readline, ''): > pr

Re: Slices time complexity

2015-05-19 Thread Oscar Benjamin
On 19 May 2015 at 09:50, Chris Angelico wrote: > On Tue, May 19, 2015 at 6:39 PM, Marko Rauhamaa wrote: >> For example, you could explain Python's object references as pointers >> (memory addresses) if you considered that helpful. (That's how Lisp >> textbooks often explain cons cells.) > > Sorta

Re: Slices time complexity

2015-05-20 Thread Oscar Benjamin
On 20 May 2015 at 10:56, Bartc wrote: > > However, I was so impressed with how (C)Python does things (working > exclusively with pointers, doing assignments by simply copying pointers, and > using reference counting to manage memory), that I'm experimenting with > letting my language work the same

remote control of a cmd.Cmd() loop (help requested)

2015-05-22 Thread Benjamin Risher
First, the snippet provided is a contrived example of a much larger program. http://pastebin.com/xRqBE5BY (written in python3 with access to 3.4 if necessary) The goal: To connect to a listening socket and send commands to the cmd.Cmd() loop running, then show the output to both stdout and t

remote control of a cmd.Cmd() loop (help requested)

2015-05-22 Thread Benjamin Risher
First, the snippet provided is a contrived example of a much larger program. http://pastebin.com/xRqBE5BY (written in python3 with access to 3.4 if necessary) The goal: To connect to a listening socket and send commands to the cmd.Cmd() loop running, then show the output to both stdout and the

[RELEASE] Python 2.7.10

2015-05-23 Thread Benjamin Peterson
://bugs.python.org Enjoy your 2 digit versions, Benjamin (on behalf of 2.7.10's contributors) -- https://mail.python.org/mailman/listinfo/python-list

Re: a more precise distance algorithm

2015-05-27 Thread Oscar Benjamin
On 27 May 2015 at 19:00, Brian Blais wrote: > On Mon, May 25, 2015 at 11:11 PM, Steven D'Aprano wrote: >> >> Let's compare three methods. >> >> def naive(a, b): >> return math.sqrt(a**2 + b**2) >> >> def alternate(a, b): >> a, b = min(a, b), max(a, b) >> if a == 0: return b >> if

Re: Returning a custom file object (Python 3)

2015-05-28 Thread Oscar Benjamin
On 28 May 2015 at 03:16, Steven D'Aprano wrote: > I'd like to return a custom file object, say my own subclass. I can easily > subclass the file object: > > > from io import TextIOWrapper > class MyFile(TextIOWrapper): > pass > > > but how do I tell open() to use MyFile? Does the below do wha

Re: Question About Image Processing in Python

2015-05-28 Thread Oscar Benjamin
On 28 May 2015 at 11:34, Serge Christian Ibala wrote: > Hello All, > > I want to know which version of Python is compatible (or can be associated > with which version of which "tools or package" for image processing) > > I am working under Window and it is so complicated to find out which version

Re: zip as iterator and bad/good practices

2015-06-13 Thread Oscar Benjamin
On 13 June 2015 at 08:17, Steven D'Aprano wrote: > On Sat, 13 Jun 2015 13:32:59 +0800, jimages wrote: > >> I am a newbie. I also have been confused when I read the tutorial. It >> recommends make a copy before looping. Then I try. >> #-- >> Test = [1, 2] >> For i in Test: >

Re: Keypress Input

2015-06-15 Thread Oscar Benjamin
On 15 June 2015 at 06:23, John McKenzie wrote: > > Thank to the others who joined in and posted replies. > > Michael, your assumption is correct. To quote my original post, "and I > want this working on a Raspberry Pi." Doing a superficial look at curses > and getch it looks excessively complica

Re: Set a flag on the function or a global?

2015-06-16 Thread Oscar Benjamin
On 16 June 2015 at 09:18, Steven D'Aprano wrote: > > The primary use-case (at least *my* use-case, and hopefully others) is to > have "from module import edir as dir" in their Python startup file. That > means that when running interactively, they will get the enhanced version of > dir, but when r

Re: Keypress Input

2015-06-18 Thread Oscar Benjamin
On Wed, 17 Jun 2015 at 02:23 Michael Torrie wrote: > On 06/16/2015 02:49 PM, Grant Edwards wrote: > > On 2015-06-16, John McKenzie wrote: > > > >> It never occurred to me something so simple as keystrokes would not > >> be present in Python, a language rated as being terrific by everyone > >> I

Re: Catching exceptions with multi-processing

2015-06-19 Thread Oscar Benjamin
On 19 June 2015 at 15:01, Fabien wrote: > Folks, > > I am developing a tool which works on individual entities (glaciers) and do > a lot of operations on them. There are many tasks to do, one after each > other, and each task follows the same interface: > > def task_1(path_to_glacier_dir): > o

Re: Bug in floating point multiplication

2015-07-03 Thread Oscar Benjamin
On 2 July 2015 at 18:29, Jason Swails wrote: > > As others have suggested, this is almost certainly a 32-bit vs. 64-bit > issue. Consider the following C program: > > // maths.h > #include > #include > > int main() { > double x; > int i; > x = 1-pow(0.5, 53); > > for (i = 1; i <

Re: Writing a python editor for blind developers

2015-07-06 Thread Oscar Benjamin
Hi Germano, You may want to use the jedi package which you can find at this link: https://pypi.python.org/pypi/jedi/ I'm not personally involved with the jedi package but I use it within my own editor Vim and my understanding is that it should be useful for Python autocompletion support in any ID

Re: Bug in floating point multiplication

2015-07-06 Thread Oscar Benjamin
On Sat, 4 Jul 2015 at 02:12 Jason Swails wrote: > On Fri, Jul 3, 2015 at 11:13 AM, Oscar Benjamin < > [email protected]> wrote: > >> On 2 July 2015 at 18:29, Jason Swails wrote: >> >> Where is the 32 bit one looks like: >> >> $ objdump -

Re: Fast capture and 2D image stacking as 3D numpy array with Python and Raspberry Pi

2015-07-07 Thread Oscar Benjamin
On Mon, 6 Jul 2015 at 22:36 Agustin Cruz wrote: > I'm working on a Python - Raspberry Pi project in which I need to take > about 30 images per second (no movie) and stack each 2D image to a 3D array > using numpy array, without saving each 2D capture as a file (because is > slow). > > I found thi

Re: Can I copy/paste Python code?

2015-07-21 Thread Oscar Benjamin
On Tue, 21 Jul 2015 at 17:16 Ben Bacarisse wrote: > Christian Gollwitzer writes: > > > On 21.07.2015 04:55, Chris Angelico wrote: > >> Sounds like a flaw in the PDF - it creates indentation in some way > >> other than leading spaces/tabs. > > > > PDF never uses tabs and spaces for indentation. I

Re: OT Re: Math-embarrassment results in CS [was: Should non-security 2.7 bugs be fixed?]

2015-07-22 Thread Oscar Benjamin
On Wed, 22 Jul 2015 at 18:01 Steven D'Aprano wrote: > > I think that the critical factor there is that it is all in the past tense. > Today, I believe, the vast majority of mathematicians fall into two camps: > > (1) Those who just use numbers without worrying about defining them in some > deep o

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Oscar Benjamin
On Tue, 28 Jul 2015 at 15:01 Victor Hooi wrote: > I have a line that looks like this: > > 14 *0330 *0 760 411|0 0 770g 1544g 117g > 1414 computedshopcartdb:103.5% 0 30|0 0|119m97m > 1538 ComputedCartRS PRI 09:40:26 > > I'd like to spl

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Oscar Benjamin
On Sat, 1 Aug 2015 22:06 Lukas Barth wrote: Nice idea! But I actually really need those "canonic rotations", since I'm hashing them somewhere. Do you really need the canonical rotation or just a hash that is invariant under rotations? I don't know of a solution to the former that is better

Re: Most pythonic way of rotating a circular list to a canonical point

2015-08-01 Thread Oscar Benjamin
On Sun, 2 Aug 2015 00:05 Oscar Benjamin wrote: On Sat, 1 Aug 2015 22:06 Lukas Barth wrote: Nice idea! But I actually really need those "canonic rotations", since I'm hashing them somewhere. Do you really need the canonical rotation or just a hash that is invariant under rota

Re: how to determine for using c extension or not ?

2015-08-03 Thread Oscar Benjamin
On Mon, 3 Aug 2015 at 15:58 umedoblock wrote: > > I use "bisect.bisect.__module__" sentence to determine for using c > extension or not. > > Why do you want to know if it uses the C extension? It shouldn't really matter. -- Oscar -- https://mail.python.org/mailman/listinfo/python-list

Re: memory control in Python

2015-08-18 Thread Oscar Benjamin
On 15 August 2015 at 00:41, Ping Liu wrote: > Dear All, Hi Ping Liu, > I am working on an optimization problem, where we are trying to minimize > some indicators like energy usage, energy cost, CO2 emission. In this > problem, we have a bunch of energy conversion technologies for electricity > a

Re: Bug!

2015-08-21 Thread Oscar Benjamin
On Fri, 21 Aug 2015 20:43 Chris Angelico wrote: On Sat, Aug 22, 2015 at 5:31 AM, Miguel Alejandro Fernandez wrote: > > *use a computer with WindowsXP Python 3.5 does not support Windows XP. I suggest installing a better-supported operating system (or failing that, a better-supported version

Re: Atomic file save -- code review and comments requested

2015-09-02 Thread Oscar Benjamin
On Wed, 2 Sep 2015 19:06 Steven D'Aprano wrote: Howdy, I have a utility function for performing atomic file saves, and I'd like to ask for a code review and comments. I have published this on ActiveState: https://code.activestate.com/recipes/579097-safely-and-atomically-write-to-a-file/ under

Re: How to set the history commands visible ?

2015-09-14 Thread Oscar Benjamin
On 14 September 2015 at 09:24, Chris Angelico wrote: > On Mon, Sep 14, 2015 at 6:01 PM, Laura Creighton wrote: >> Since you are a gmail user, you should be able to see this: >> > import sys > import os > import tkinter > from __future__ import print_function > for i in range(3

Re: multiprocessing speedup

2015-09-29 Thread Oscar Benjamin
On Tue, 29 Sep 2015 at 02:22 Rita wrote: > I am using the multiprocessing with apply_async to do some work. Each task > takes a few seconds but I have several thousand tasks. I was wondering if > there is a more efficient method and especially when I plan to operate on a > large memory arrays (n

Re: Issue: cannot successfully install Python 3 on Windows 7

2015-09-29 Thread Oscar Benjamin
On Tue, 29 Sep 2015 at 10:22 Gilad Mayani wrote: > Dear Python staff, > > I am trying to install the latest version of Python 3 on my machine, in > which I already have Python 2.7.3 installed. > I did this by downloading the installer from the 'Download Python 3.5.0' > button from https://www.pyt

Re: Generating a vector from successive multiplications of another vector from an initial value

2015-10-01 Thread Oscar Benjamin
On Thu, 1 Oct 2015 21:51 Paulo da Silva wrote: Hi all. What is the fastest way to do the following: I have an initial value V and a vector vec of (financial) indexes. I want to generate a new vector nvec as V, V*vec[0], V*vec[0]*vec[1], V*vec[0]*vec[1]*vec[2], ... A numpy vectorized solution

Re: packaging code with compiled libraries

2015-10-06 Thread Oscar Benjamin
On 5 October 2015 at 20:43, Tim wrote: > > I have a package I want to share but have a question about packaging. > > Mostly the package is pure python code, but it also requires some binary > libraries (*.so, *.dll, *.dylib). I want to bundle these libs so users don't > have to compile. The pac

Re: Planet Scipy blog

2015-10-08 Thread Oscar Benjamin
On Thu, 8 Oct 2015 15:29 Laura Creighton wrote: In a message of Thu, 08 Oct 2015 15:10:21 +0100, Mark Lawrence writes: >On 08/10/2015 14:39, beliavsky--- via Python-list wrote: >> There used to be a blog about SciPy at https :// planet.scipy.

Re: Installation problem

2015-10-08 Thread Oscar Benjamin
On Thu, 8 Oct 2015 22:30 eryksun wrote: On 10/8/15, Tim Golden wrote: > > What happens if you do [Windows] + R (ie Start > Run), enter "python" > and click OK? The new installer for 3.5 doesn't create an "App Paths" key for "python.exe" like the old installer used to do (see the old Tools/msi/m

Re: Installation problem

2015-10-08 Thread Oscar Benjamin
On Thu, 8 Oct 2015 22:41 eryksun wrote: > On 10/8/15, Oscar Benjamin wrote: > > On Thu, 8 Oct 2015 22:30 eryksun wrote: > > > > The new installer for 3.5 doesn't create an "App Paths" key for > > "python.exe" like the old installer used to

Re: can't install Python 3.5 on windows

2015-10-09 Thread Oscar Benjamin
On Fri, 9 Oct 2015 08:48 Jay Brown wrote: Dear Python: I have been trying to install Python on my Windows computer. I tried both Python 2.7 and 3.5. No luck with either one. If I try to run Python I get a message asking me if I want to repair Python. The program never runs. Can you help? Hi

Re: write csv to object and read into pandas

2015-10-15 Thread Oscar Benjamin
On 15 October 2015 at 09:16, Peter Otten <[email protected]> wrote: > > def preprocess(filename): > with open(filename) as f: > for row in csv.reader(f): > # do stuff > yield row > > rows = preprocess("pandas.csv") Take the with statement outside of the generator

Re: Cryptographically strong random numbers

2015-10-16 Thread Oscar Benjamin
On Fri, 16 Oct 2015 18:16 Marko Rauhamaa wrote: Steven D'Aprano : > Python-Dev is arguing about which of the following three functions should be > included: > > randbelow(end): > return a random integer in the half-open interval 0...end > (including 0, excluding end) > > randint(start, e

Re: How to rearrange array using Python?

2015-10-20 Thread Oscar Benjamin
On Tue, 20 Oct 2015 20:01 Martin Schöön wrote: It has been a while. I have mastered solving Kenken and Sudoku using Python-constraint. I still have no clue on how to tell the solver how to constrain the number of occupants in rooms: I have made up an simple example with nine persons and three ro

Re: Defamation

2015-10-22 Thread Oscar Benjamin
On 22 October 2015 at 09:05, Chris Angelico wrote: > On Thu, Oct 22, 2015 at 11:45 AM, John O'Hagan wrote: >> On Wed, 21 Oct 2015 00:09:18 +1100 >> Steven D'Aprano wrote: >> >> >>> I don't believe that the Python mailing list archives are hosted in a >>> country under the jurisdiction of Europea

Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Oscar Benjamin
On 22 October 2015 at 11:56, Peter Brittain wrote: > On Thursday, October 22, 2015 at 10:24:11 AM UTC+1, Laura Creighton wrote: >> Fredrik Lundh's console implementation >> http://effbot.org/zone/console-handbook.htm >> might be of interest in that case, but I think it is 'old versions >> of windo

Re: Defamation

2015-10-22 Thread Oscar Benjamin
On 22 October 2015 at 12:36, Laura Creighton wrote: > > The UK libel reform act of 2013, I see, may be responsible for > the decline in libel tourism. > http://www.libelreform.org/ Yes I think so. From Wikipedia: """ A court does not have jurisdiction to hear and determine any action, unless the

Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Oscar Benjamin
On 22 October 2015 at 13:42, Gisle Vanem wrote: > "Chris Angelico" wrote: > >> On Thu, Oct 22, 2015 at 10:22 PM, Gisle Vanem wrote: >>> >>> IOError: [Errno 13] Permission denied: >>> 'g:\\Programfiler\\Python27\\Lib\\site-packages\\win32\\win32api.pyd' >>> >>> - >>> >>> BTW, this is on Pyth

Re: LU decomposition

2015-11-03 Thread Oscar Benjamin
On 1 November 2015 at 10:04, gers antifx wrote: > > I have to write a LU-decomposition. My Code worked so far but (I want to > become better:) ) I want to ask you, if I could write this LU-decomposition > in a better way? > > def LU(x): > L = np.eye((x.shape[0])) > n = x.shape[0] > f

Re: Irregular last line in a text file, was Re: Regular expressions

2015-11-04 Thread Oscar Benjamin
On 4 November 2015 at 03:39, Steven D'Aprano wrote: > > Better would be this: > > def chomp(lines): > for line in lines: > yield line.rstrip() # remove all trailing whitespace > > > with open(...) as f: > for line in chomp(f): ... with open(...) as f: for line in map(str.rstr

Re: Calulation in lim (1 + 1 /n) ^n when n -> infinite

2015-11-09 Thread Oscar Benjamin
On 9 November 2015 at 12:21, Salvatore DI DIO wrote: > I was trying to show that this limit was 'e' > But when I try large numbers I get errors > > def lim(p): > return math.pow(1 + 1.0 / p , p) > lim(5) > 2.718281748862504 lim(9) > 2.7182820518605446 > > > What

Re: Matplotlib error: Value Error: x and y must have same first dimension

2015-11-13 Thread Oscar Benjamin
On 13 November 2015 at 08:34, Laura Creighton wrote: > In a message of Thu, 12 Nov 2015 17:54:28 -0800, Abhishek writes: >>I am trying to run some Python code for the last few hours. How can I achieve >>the effect of "dot divide" from Matlab, in the following code? I am having >>trouble working

Re: What is the meaning of Py_INCREF a static PyTypeObject?

2015-11-13 Thread Oscar Benjamin
On 13 November 2015 at 03:08, Xiang Zhang <[email protected]> wrote: > I think the meaning of Py_INCREF a static type object is to prevent it from > being deallocated when it is Py_DECREFed somehow later. Just as you said, it > may be somehow deallocated when using. > > NoddyType is a static stru

Re: Which type should be used when testing static structure appartenance

2015-11-17 Thread Oscar Benjamin
On 17 November 2015 at 14:27, Nicolas Évrard wrote: > Hello, > > I saw the following retweet by Raymond Hettinger in this morning: > >https://twitter.com/sanityinc/status/666485814214287360 > >Programming tip: many of those arrays and hashes in your code >should actually be sets. Match

Re: Writing SOME class methods in C

2015-11-18 Thread Oscar Benjamin
On 18 November 2015 at 07:50, Daniel Haude wrote: > > I'm trying to implement some (but not all) methods of a Python class in C. > What I've found on the Net is: > - how to implement entire modules in C so that I can import that module and >use the C functions (successfully done it, too). >

Re: What is a function parameter =[] for?

2015-11-19 Thread Oscar Benjamin
On 19 November 2015 at 18:19, BartC wrote: >>> >>> if you write A=B then something of B needs to have been copied into >>> A, even if it's just the reference that B contains. Otherwise it would be >>> difficult to get A to refer to the same object as B. >> >> Please, PLEASE, go and read/watch Ned'

[RELASE] Python 2.7.11 release candidate 1

2015-11-21 Thread Benjamin Peterson
bugs to https://bugs.python.org If no serious problems are found, 2.7.11 final will be released in two weeks. Regards, Benjamin Peterson (on behalf of Python 2.7.11's contributors) -- https://mail.python.org/mailman/listinfo/python-list

[RELEASE] Python 2.7.8

2014-07-01 Thread Benjamin Peterson
http://bugs.python.org/ Till next time, Benjamin Peterson 2.7 Release Manager (on behalf of all of Python's contributors) [1] http://bugs.python.org/issue21652 [2] http://bugs.python.org/issue21831 [3] http://bugs.python.org/issue21766 [4] http://bugs.python.org/issue21672 --

Re: Will IronPython / WPF work on Mac OS X?

2014-08-04 Thread Benjamin Kaplan
On Aug 4, 2014 6:23 AM, wrote: > > Hello, > I am thinking of using IronPython to build an Python application. Using WPF in Visual Studio to draw the GUI and create the XAML. Can I then run this Python application on a Mac OS X (10.8)? > Thanks. > -- Nope. IronPython on Mac runs on top of Mono, s

Help improving the future of debugging

2014-08-25 Thread Benjamin Siegmund
. The survey is, of course, fully anonymous and will take about 15 minutes to fill out. Feel free to redistribute this message to anyone who you think might be interested. The survey can be reached at: http://www.uni-potsdam.de/skopie-up/index.php/689349 Thank you for your interest, Benjamin

Re: Installing 2.6 on Win 7

2011-09-09 Thread Benjamin Kaplan
On Sep 9, 2011 4:07 PM, "ray" wrote: > > I have not found binaries for this install. The page > http://www.python.org/download/windows/ > takes me to > http://www.python.org/download/releases/ > which goes to > http://www.python.org/download/releases/2.6.7/ > Here are Gzip and Bzip tar balls. Th

Re: Python 2.5 zlib trouble

2011-09-24 Thread Benjamin Kaplan
On Sat, Sep 24, 2011 at 7:08 PM, Jesramz wrote: > > I installed it from here: http://www.python.org/getit/releases/2.5.6/ > > What do you think a solution might be? > There is no binary installer on that page. That means you downloaded the source code and compiled it yourself. Yes, you didn't pat

Re: Python 2.5 zlib trouble

2011-09-26 Thread Benjamin Kaplan
On Mon, Sep 26, 2011 at 2:16 PM, Jesramz wrote: > > I appreciate all the help, but I am still a little confused. Sorry, > I'm a lay person. > > Should I download zlib1g-dev and install it to get the zlib module? > > and Alter the configure script to avoid future issues? > > Also about getting zlib

Re: new to python question

2011-09-28 Thread Benjamin Kaplan
On Wed, Sep 28, 2011 at 5:06 PM, The Geek wrote: > I'm clearly not understanding something about scope in python...  Any help > is appreciated > In the following script I'm attempting to create 2 Foo objects, for each Foo > object I create 2 Bars and add them to Foo's bar array > Something hokey i

Re: guppy

2011-11-09 Thread Benjamin Kaplan
On Wed, Nov 9, 2011 at 2:08 PM, Juan Declet-Barreto wrote: > > I am trying to build guppy on Python 2.5, but am getting an "initializer > element is not constant" error from gcc. I have found very little on this > issue in the fora when looking for the general cause of the error; there is > eve

Re: The python implementation of the "relationships between classes".

2011-11-10 Thread Benjamin Kaplan
On Thu, Nov 10, 2011 at 1:06 PM, Jerry Zhang wrote: > > > I just did an example code to describe what i am looking for. > /**/ > # ... > > class Head: >     def __init__(self): >     self.size = 5 >

Re: Both Python 2.5.2 and 2.7.2 flop the same way under Win 7

2011-11-17 Thread Benjamin Kaplan
On Thu, Nov 17, 2011 at 11:21 PM, W. eWatson wrote: > > On 11/17/2011 7:59 PM, Dave Angel wrote: >> >> On 11/17/2011 03:31 PM, W. eWatson wrote: >>> >>> On 11/17/2011 9:39 AM, John Gordon wrote: >>> Can you add IDLE manually to the associated applications list? >>> Tried that by se

Re: scraping a tumblr.com archive page

2011-11-20 Thread Benjamin Kaplan
On Sun, Nov 20, 2011 at 1:06 PM, Jabba Laci wrote: > Hi, > > I want to extract the URLs of all the posts on a tumblr blog. Let's > take for instance this blog: http://loveyourchaos.tumblr.com/archive . > If I download this page with a script, there are only 50 posts in the > HTML. If you scroll do

Re: Misleading error message of the day

2011-12-08 Thread Benjamin Kaplan
On Thu, Dec 8, 2011 at 1:42 PM, Roy Smith wrote: > (some, >  very, >  long, >  list, >  of, >  variable, >  names, >  to, >  get, >  the, >  stuff, >  unpacked, >  into) = function_that_should_return_a_14_tuple() > > raises > > ValueError: too many values to unpack > > Quick, what's the bug?  Did

Re: Misleading error message of the day

2011-12-08 Thread Benjamin Kaplan
On Thu, Dec 8, 2011 at 2:09 PM, Ethan Furman wrote: > Benjamin Kaplan wrote: >> >> On Thu, Dec 8, 2011 at 1:42 PM, Roy Smith wrote: >>> >>> (some, >>>  very, >>>  long, >>>  list, >>>  of, >>>  variable,

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

2011-12-20 Thread Benjamin Kaplan
On Dec 20, 2011 3:32 PM, "Steven D'Aprano" < [email protected]> wrote: > > On Tue, 20 Dec 2011 14:45:06 -0500, Nathan Rice wrote: > > > PyPi: http://pypi.python.org/pypi/elementwise/0.111220 > > Version 0.111220? What do you do, bump the version number after every > keystroke

Re: Which libraries for Python 2.5.2

2011-12-28 Thread Benjamin Kaplan
On Wed, Dec 28, 2011 at 10:04 PM, W. eWatson wrote: > On 12/28/2011 12:55 PM, W. eWatson wrote: >> >> On 12/28/2011 9:37 AM, Ian Kelly wrote: >>> >>> On Wed, Dec 28, 2011 at 9:33 AM, W. eWatson >>> wrote: Well, thing went slightly awry. The link gave me two choices. Download msv...d

Re: .format vs. %

2011-12-31 Thread Benjamin Kaplan
On Dec 31, 2011 1:46 PM, "davidfx" wrote: > > Thanks for your response. I know the following code is not going to be correct but I want to show you what I was thinking. > > formatter = "%r %r %r %r" > > print formatter % (1, 2, 3, 4) > > What is the .format version of this concept? > format is a

<    6   7   8   9   10   11   12   13   14   15   >