Re: issue w/ python 3.5.7

2016-03-13 Thread Oscar Benjamin
On 13 Mar 2016 18:01, "Steven D'Aprano" wrote: > > On Mon, 14 Mar 2016 03:56 am, lucile.m...@free.fr wrote: > > > Hello, > > We would like to get the procedure to launch the software "python.exe". > > The only options we have acsess are: modify, repair and uninstall. Thanks > > for your help, Rgds

Re: Loading error message

2016-03-13 Thread Oscar Benjamin
On 13 Mar 2016 17:06, "BobFtz--- via Python-list" wrote: > > Hello > > I have just downloaded and installed a copy of the 3.5.1 programme but when > I come to run the programme I get an error message that says that > .api-ms-win-crt-runtime-l 1-1-0.dll is missing. > > I have un-installed and

Re: Loading error message

2016-03-14 Thread Oscar Benjamin
On 14 March 2016 at 12:07, Arie van Wingerden wrote: > that is weird. I am using Windows 10 and get exactly the same "warnings" > when I run PyInstaller. > But the update you mention is only available for up to Windows 8.1. > > What about Windows 10 then?? I'm not sure what you mean. Windows 10 s

Re: Simple exercise

2016-03-14 Thread Oscar Benjamin
On 14 March 2016 at 14:35, Rick Johnson wrote: > > I would strongly warn anyone against using the zip function > unless ... > I meant to say: absolutely, one hundred percent *SURE*, that > both sequences are of the same length, or, absolutely one > hundred percent *SURE*, that dropping values is n

Re: looping and searching in numpy array

2016-03-14 Thread Oscar Benjamin
On 10 March 2016 at 13:02, Peter Otten <__pete...@web.de> wrote: > Heli wrote: > >> I need to loop over a numpy array and then do the following search. The >> following is taking almost 60(s) for an array (npArray1 and npArray2 in >> the example below) with around 300K values. >> >> >> for id in np

Re: Loading error message

2016-03-14 Thread Oscar Benjamin
I've fixed the quoting below. Can you not top-post please Arie? On 14 March 2016 at 16:59, Arie van Wingerden wrote: > 2016-03-14 15:59 GMT+01:00 Oscar Benjamin : >> >> On 14 March 2016 at 12:07, Arie van Wingerden wrote: >> > that is weird. I am using Window

Re: Re[2]: Loading error message

2016-03-14 Thread Oscar Benjamin
On 14 March 2016 at 17:15, Arie van Wingerden wrote: > I've fixed the quoting below. Can you not top-post please Arie? > On 14 March 2016 at 16:59, Arie van Wingerden < xapw...@gmail.com > wrote: >> 2016-03-14 15:59 GMT+01:00 Oscar Benjamin < oscar.j.benja...@gmail.com &

Re: Improving performance in matrix operations

2016-03-14 Thread Oscar Benjamin
On 9 March 2016 at 20:09, Drimades wrote: > I'm doing some tests with operations on numpy matrices in Python. As an > example, it takes about 3000 seconds to compute eigenvalues and eigenvectors > using scipy.linalg.eig(a) for a matrix 6000x6000. Is it an acceptable time? I don't know really bu

Re: Simple exercise

2016-03-15 Thread Oscar Benjamin
On 14 March 2016 at 23:59, Steven D'Aprano wrote: > On Tue, 15 Mar 2016 02:06 am, Oscar Benjamin wrote: > >> On 14 March 2016 at 14:35, Rick Johnson >> wrote: >>> >>> I would strongly warn anyone against using the zip function >>> unless >>

Re: problem with python 3.5.0

2016-03-18 Thread Oscar Benjamin
On 18 Mar 2016 17:42, "Mark Lawrence" wrote: > > On 18/03/2016 16:56, nasrin maarefi via Python-list wrote: >> >> HelloI installed the python 3.5.0(32bit) on 64bit win10 but I dont know how to install numpy pakage for this? I did not find something good on internet. could you please guide me?wher

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Oscar Benjamin
On 27 Mar 2016 10:56, "Steven D'Aprano" wrote: > > > My C is a bit rusty, so excuse me if I get the syntax wrong. I have a > function: > > void foo(int n) { > int i = n + 1; > bar(i); > } > > There's a possible overflow of a signed int in there. This is undefined > behaviour. Now, you migh

Re: Calling the source command from subprocess.popen to update the os.environ.

2016-03-27 Thread Oscar Benjamin
On 27 Mar 2016 17:01, "Ben Finney" wrote: > > Hongyi Zhao writes: > > > I use the following code the update the os.environ: > > > > import os > > from subprocess import check_output > > > > # POSIX: name shall not contain '=', value doesn't contain '\0' > > output = check_output("source /home/wer

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-27 Thread Oscar Benjamin
On 27 Mar 2016 23:11, "Ben Bacarisse" wrote: > > Steven D'Aprano writes: > > > On Sun, 27 Mar 2016 05:13 pm, Paul Rubin wrote: > > > >> Steven D'Aprano writes: > >>> For example, would you consider that this isolated C code is > >>> "meaningless"? > >>> int i = n + 1; > >> > >> It's meaningful a

Re: list comprehension return a list and sum over in loop

2014-12-12 Thread Oscar Benjamin
On 12 December 2014 at 06:22, KK Sasa wrote: > Hi there, > > The list comprehension is results = [d2(t[k]) for k in xrange(1000)], where > d2 is a function returning a list, say [x1,x2,x3,x4] for one example. So > "results" is a list consisting of 1000 lists, each of length four. Here, what > I

Re: Working with the set of real numbers

2014-02-13 Thread Oscar Benjamin
On 12 February 2014 10:07, Ben Finney wrote: > Chris Angelico writes: > >> On Wed, Feb 12, 2014 at 7:56 PM, Ben Finney >> wrote: >> > So, if I understand you right, you want to say that you've not found >> > a computer that works with the *complete* set of real numbers. Yes? >> >> Correct. [...

Re: extend methods of decimal module

2014-02-19 Thread Oscar Benjamin
On 19 February 2014 15:30, Mark H. Harris wrote: > Would it be possible to extend the methods of the decimal module just a bit > to include atan(), sin(), cos(), and exp() ? > > The module has methods for ln() and sqrt(); and that's great! > > I have done some rudimentary searching of the pep his

Re: Cross-platform way to get default directory for binary files like console scripts?

2014-02-20 Thread Oscar Benjamin
On 20 February 2014 14:27, Piotr Dobrogost wrote: > Is there cross-platform way to get default directory for binary files > (console scripts for instance) the same way one can use sys.executable to get > path to the Python's interpreter in cross-platform way? > > Context: > There's Python script

Re: Cross-platform way to get default directory for binary files like console scripts?

2014-02-20 Thread Oscar Benjamin
On 20 February 2014 15:34, Piotr Dobrogost wrote: > On Thursday, February 20, 2014 4:22:53 PM UTC+1, Oscar Benjamin wrote: > >> You can find the default location in this roundabout way: > > I'm wondering if there's some API to get this info as what you showed is

Re: Cross-platform way to get default directory for binary files like console scripts?

2014-02-20 Thread Oscar Benjamin
On 20 February 2014 15:42, Ned Batchelder wrote: > > As roundabout and advanced as that code is, it doesn't give the right answer > for me. It returns None. On my Mac, after activating a virtualenv: > > Python 2.7.2 (default, Oct 11 2012, 20:14:37) > [GCC 4.2.1 Compatible Apple Clang 4.0

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Oscar Benjamin
On 25 February 2014 22:36, Tim Chase wrote: > On 2014-02-25 22:21, Duncan Booth wrote: >> > It would save some space if I didn't have to duplicate all the >> > keys into sets (on the order of 10-100k small strings), instead >> > being able to directly perform the set-ops on the dicts. But >> > ot

Re: extend methods of decimal module

2014-02-27 Thread Oscar Benjamin
On 27 February 2014 12:07, Mark H. Harris wrote: > > I have created a project here: > > https://code.google.com/p/pythondecimallibrary/ > > I wrote a dmath.py library module for use with the C accelerated decimal > module, that I would like to see merged into the C Python distribution so > that

Re: extend methods of decimal module

2014-02-27 Thread Oscar Benjamin
On 27 February 2014 15:42, Mark H. Harris wrote: > On Thursday, February 27, 2014 8:42:55 AM UTC-6, Oscar Benjamin wrote: > >> >> Some points: > >Thanks so much... you have clarified some things I was struggling with... > >> 1) Why have you committed the code

Re: extend methods of decimal module

2014-02-27 Thread Oscar Benjamin
On 27 February 2014 23:00, Mark H. Harris wrote: > On Thursday, February 27, 2014 10:24:23 AM UTC-6, Oscar Benjamin wrote: > >>>>> from decimal import Decimal as D >> >>> D(0.1) >> Decimal('0.155511151231257827021181583404541015625&#x

Re: Tuples and immutability

2014-03-01 Thread Oscar Benjamin
On 27 February 2014 21:47, Nick Timkovich wrote: > On Thu, Feb 27, 2014 at 10:33 AM, Chris Angelico wrote: >> >> It's unintuitive, but it's a consequence of the way += is defined. If >> you don't want assignment, don't use assignment :) > > Where is `.__iadd__()` called outside of `list += X`? N

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Oscar Benjamin
On 3 March 2014 11:34, Mark H. Harris wrote: > hi folks, > > Python Decimal Library dmath.py v0.3 Released > > https://code.google.com/p/pythondecimallibrary/ Hi Mark, Is this available on PyPI? It seems there already is a "dmath" package on PyPI that was written by someone else some time ago so

Re: python decimal library dmath.py v0.3 released

2014-03-03 Thread Oscar Benjamin
On 3 March 2014 15:22, Mark H. Harris wrote: > On Monday, March 3, 2014 7:34:40 AM UTC-6, Oscar Benjamin wrote: >> On 3 March 2014 11:34, Mark H. Harris wrote: >> >> Is this available on PyPI? > > Python3.3 Decimal Library v0.3 is Released here: >

Re: Working with the set of real numbers

2014-03-04 Thread Oscar Benjamin
On 4 March 2014 19:58, Chris Angelico wrote: > On Wed, Mar 5, 2014 at 6:49 AM, Marko Rauhamaa wrote: >> Chris Angelico : >> >>> As far as I know, there's no simple way, in constant space and/or >>> time, to progressively yield more digits of a number's square root, >>> working in decimal. >> >> I

Re: Working with the set of real numbers

2014-03-04 Thread Oscar Benjamin
On 4 March 2014 21:18, Chris Angelico wrote: > On Wed, Mar 5, 2014 at 7:55 AM, Oscar Benjamin > wrote: >> I don't quite follow your reasoning here. By "cut-and-try" do you mean >> bisection? If so it gives the first N decimal digits in N*log2(10) >> iterat

Re: Working with the set of real numbers

2014-03-04 Thread Oscar Benjamin
On 4 March 2014 21:05, Marko Rauhamaa wrote: > Oscar Benjamin : > >> To me the obvious method is Newton iteration which takes O(sqrt(N)) >> iterations to obtain N digits of precision. This brings the above >> complexity below quadratic: >> >> #!/usr/bin/

Re: Working with the set of real numbers

2014-03-04 Thread Oscar Benjamin
On 4 March 2014 22:18, Chris Angelico wrote: > On Wed, Mar 5, 2014 at 9:02 AM, Oscar Benjamin > wrote: >> On 4 March 2014 21:18, Chris Angelico wrote: >>> On Wed, Mar 5, 2014 at 7:55 AM, Oscar Benjamin >>> wrote: >>> >>> epsilon = 0.000

Re: Working with the set of real numbers

2014-03-05 Thread Oscar Benjamin
On 4 March 2014 23:20, Dave Angel wrote: > > One problem with complexity claims is that it's easy to miss some > contributing time eaters. I haven't done any measuring on modern > machines nor in python, but I'd assume that multiplies take > *much* longer for large integers, and that divides ar

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Oscar Benjamin
On 5 March 2014 07:52, Steven D'Aprano wrote: > On Tue, 04 Mar 2014 23:25:37 -0500, Roy Smith wrote: > >> I stopped paying attention to mathematicians when they tried to convince >> me that the sum of all natural numbers is -1/12. > > I'm pretty sure they did not. Possibly a physicist may have tri

Re: Working with the set of real numbers (was: Finding size of Variable)

2014-03-05 Thread Oscar Benjamin
On 5 March 2014 17:43, Steven D'Aprano wrote: > On Wed, 05 Mar 2014 12:21:37 +0000, Oscar Benjamin wrote: >> >> The argument that the sum of all natural numbers comes to -1/12 is just >> some kind of hoax. I don't think *anyone* seriously believes it. > > Y

Re: Working with the set of real numbers

2014-03-06 Thread Oscar Benjamin
On 5 March 2014 12:57, Dave Angel wrote: > Oscar Benjamin Wrote in message: >> On 4 March 2014 23:20, Dave Angel wrote: >>> >>> On the assumption that division by 2 is very fast, and that a >>> general multiply isn't too bad, you could improve on New

Re: Testing interactive code using raw_input

2014-03-10 Thread Oscar Benjamin
On 10 March 2014 15:59, Steven D'Aprano wrote: > Does anyone have any good hints for testing interactive code that uses > raw_input, or input in Python 3? > > A simple technique would be to factor out the interactive part, e.g. like > this: > > # Before > def spam(): > answer = raw_input(promp

Re: which async framework?

2014-03-11 Thread Oscar Benjamin
On 11 March 2014 11:54, Marko Rauhamaa wrote: > Ian Kelly : > >> eventlet has 115k downloads from PyPI over the last month. gevent has >> 143k. Twisted has 147k. Tornado has 173k. >> >> I'd say that a lot of Python users are already doing non-blocking >> network I/O, in one form or another. > > Th

Re: Tuples and immutability

2014-03-12 Thread Oscar Benjamin
On 12 March 2014 03:25, Terry Reedy wrote: > On 3/11/2014 10:01 PM, Rick Johnson wrote: >> >> >> On Thursday, February 27, 2014 4:18:01 PM UTC-6, Ian wrote: >>> >>> x += y is meant to be equivalent, except possibly in-place and >>> more efficient, than x = x + y. > > > The manual actually says "An

Re: Correct idiom for determining path when frozen in 3.4

2014-03-17 Thread Oscar Benjamin
On 17 March 2014 08:44, Mark Summerfield wrote: > Hi, > > What is the correct idiom for getting the path to a top-level module in 3.3 > and 3.4 when the module might be frozen? > > At the moment I'm using this: > > if getattr(sys, "frozen", False): > path = os.path.dirname(sys.executa

Re: Unexpected results comparing float to Fraction

2013-08-01 Thread Oscar Benjamin
On 1 August 2013 07:32, Chris Angelico wrote: > On Thu, Aug 1, 2013 at 7:20 AM, Steven D'Aprano > 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 surprises me >> because in other operations, Fracti

Re: PEP 450 Adding a statistics module to Python

2013-08-10 Thread Oscar Benjamin
On 10 August 2013 12:50, Roy Smith wrote: > In article , > Skip Montanaro wrote: > >> Given that installing numpy or scipy is generally no more difficult >> that executing "pip install (scipy|numpy)" I'm not really feeling the >> need for a battery here... > > I just tried installing numpy in a

Re: PEP 450 Adding a statistics module to Python

2013-08-10 Thread Oscar Benjamin
On 10 August 2013 13:43, Roy Smith wrote: > > In article , > Oscar Benjamin wrote: > >> You should use apt-get for numpy/scipy on Ubuntu. Although >> unfortunately IIRC this doesn't work as well as it should since Ubuntu >> doesn't install the appr

Re: PEP 450 Adding a statistics module to Python

2013-08-13 Thread Oscar Benjamin
On Aug 13, 2013 7:22 PM, "Wolfgang Keller" 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 450 Adding a statistics module to Python

2013-08-16 Thread Oscar Benjamin
On 16 August 2013 17:31, 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 is that numpy

Re: PEP 450 Adding a statistics module to Python

2013-08-16 Thread Oscar Benjamin
On 16 August 2013 20:00, 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. >> >> It might be

Re: Matrix sort

2013-08-21 Thread Oscar Benjamin
On 21 August 2013 10:24, 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 > ... > ... > x

Re: python3 integer division debugging

2013-08-28 Thread Oscar Benjamin
On 28 August 2013 16:15, Neal Becker 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 and report suc

Re: print function and unwanted trailing space

2013-08-31 Thread Oscar Benjamin
On 31 August 2013 12:16, Steven D'Aprano 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 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 want to w

Re: Simplex Algorithm

2013-09-02 Thread Oscar Benjamin
On Sep 2, 2013 2:31 AM, "Tommy Vee" 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, I tried some

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 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. Basically, I want > to

Re: Importing Definitions

2013-09-06 Thread Oscar Benjamin
On 5 September 2013 19:06, Skip Montanaro 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

Re: Can I trust downloading Python?

2013-09-10 Thread Oscar Benjamin
On 10 September 2013 01:06, Steven D'Aprano 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 sites on the Internet and execu

Re: Weighted choices

2013-09-10 Thread Oscar Benjamin
On 10 September 2013 03:27, Jason Friedman 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 a tea

Re: why syntax change in lambda

2013-09-11 Thread Oscar Benjamin
On 11 September 2013 14:03, Neal Becker 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 "", line 1 >

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 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 William, I'm glad

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

2013-09-12 Thread Oscar Benjamin
On 12 September 2013 10:27, Skip Montanaro 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 JPMorgan w

Re: Qt connect and first connect or unicode

2013-09-17 Thread Oscar Benjamin
On 17 September 2013 05:12, Mohsen Pahlevanzadeh wrote: > Dear all, > > Unfortunately, i confused and need help... the following code is: > ### > ##CheckBox: > QtCore.QObject.connect(self.checkBox, > QtCore.SIGNAL(_fromUtf8("toggled(bool)")), lam

Re: statsmodels.api

2013-09-17 Thread Oscar Benjamin
On 17 September 2013 11:10, Davide Dalmasso 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 v.1600 32 bit > (Intel

Re: statsmodels.api

2013-09-17 Thread Oscar Benjamin
On 17 September 2013 13:13, Davide Dalmasso 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 "", line 1, in > from scipy.interpolate import interp1d

Re: statsmodels.api

2013-09-17 Thread Oscar Benjamin
On 17 September 2013 14:35, Josef Pktd 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 that and I'l

Re: statsmodels.api

2013-09-17 Thread Oscar Benjamin
On 17 September 2013 15:52, Josef Perktold 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 > Microsoft sdk). J

Re: scipy 11 and scipy 12

2013-09-18 Thread Oscar Benjamin
On 18 September 2013 03:48, Steven D'Aprano 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 install of p

Re: iterating over a file with two pointers

2013-09-18 Thread Oscar Benjamin
On 18 September 2013 13:56, Roy Smith wrote: > >> > On Wed, Sep 18, 2013 at 9:12 PM, nikhil Pandey >> > 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 >> >> few (say 20

Re: scipy 11 and scipy 12

2013-09-19 Thread Oscar Benjamin
On 19 September 2013 03:42, Steven D'Aprano 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 for a Windows user. > If

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, >

Re: linregress and polyfit

2013-09-19 Thread Oscar Benjamin
On 18 September 2013 20:57, Dave Angel 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, s

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 abo

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" 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 > C=(Cdifuana(M,A,D,x,tinicial)) > File "D:\Yan\Documents

Re: reload and work flow suggestions

2013-09-23 Thread Oscar Benjamin
On 23 September 2013 10:35, rusi 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 by intellisense

Re: parse list recurisively

2013-09-23 Thread Oscar Benjamin
On 23 September 2013 13:53, 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? http://sscce.org

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, 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 loop through each

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

2013-10-02 Thread Oscar Benjamin
On 2 October 2013 00:45, Rotwang 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 of any function

Re: Running code from source that includes extension modules

2013-10-03 Thread Oscar Benjamin
On 2 October 2013 23:28, Michael Schwarz 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 copy&past C code into it? For my current project, > this is

Re: ipy %run noob confusion

2013-10-04 Thread Oscar Benjamin
On 3 October 2013 18:42, 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 by: > >%py

Re: howto check programs and C libraries

2013-10-04 Thread Oscar Benjamin
On 4 October 2013 10:30, David Palao 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) against some > libra

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

2013-10-04 Thread Oscar Benjamin
On 2 October 2013 23:25, Terry Reedy 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 different

Re: class-private names and the Zen of Python

2013-10-08 Thread Oscar Benjamin
On Oct 8, 2013 2:26 PM, "Steven D'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 >

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: 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: 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

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

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, subhabrat...@gmail.com > 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

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() > >

<    1   2   3   4   5   6   7   >