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 <[email protected]> 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 < [email protected] > wrote: >> 2016-03-14 15:59 GMT+01:00 Oscar Benjamin < [email protected] &

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: Basic asyncio usage

2014-11-24 Thread Benjamin Risher
On Wednesday, March 26, 2014 6:35:31 AM UTC-5, Piotr Husiatyński wrote: > Hi, > I have posted the same question to python-tutor list *, but I'm trying > my luck here as advised. > > I'm trying to get more familiar with asyncio library. Using python > 3.4, I wrote simple echo server (see attachemen

Re: Basic asyncio usage

2014-11-25 Thread Benjamin Risher
On Monday, November 24, 2014 10:26:42 AM UTC-6, Marko Rauhamaa wrote: > Benjamin Risher : > > > I was wondering if you ever made progress with your asyncio project. > > I'm currently digging around for examples and reference material and > > came across your post. >

[RELEASE] Python 2.7.9 release candidate 1

2014-11-26 Thread Benjamin Peterson
for December 10th. Enjoy, Benjamin 2.7 release manager on behalf on python-dev and all of Python's contributors -- https://mail.python.org/mailman/listinfo/python-list

Asyncio problem, looking for advice.

2014-11-27 Thread Benjamin Risher
Hello all, I'm working on a project to learn asyncio and network programming. What I'm trying to do is forward a connection from myself to another machine. Kind of like an asynchronous python implementation of fpipe. In a nutshell: 1 --> start a server listening on localhost 2 --> connect

Re: Asyncio problem, looking for advice.

2014-11-28 Thread Benjamin Risher
On Friday, November 28, 2014 6:12:20 AM UTC-6, Akira Li wrote: > Benjamin Risher writes: > > > Hello all, > > > > I'm working on a project to learn asyncio and network programming. What > > I'm trying to do is forward a connection from myself t

Is cmd.Cmd.cmdloop() integration with asyncio server possible?

2014-12-08 Thread Benjamin Risher
I'm working on an asyncio server project. I'd also like to have a cmd.Cmd style command loop interface for spawning instances of the server. As far as I've seen, running an asyncio server requires ... loop.run_forever() ... And cmd.Cmd.cmdloop() is a blocking loop, so I'm not able to call the

Is cmd.Cmd.cmdloop() integration with asyncio server possible?

2014-12-09 Thread Benjamin Risher
I'm working on an asyncio server project. I'd also like to have a cmd.Cmd style command loop interface for spawning instances of the server. As far as I've seen, running an asyncio server requires ... loop.run_forever() ... And cmd.Cmd.cmdloop() is a blocking loop, so I'm not able to call the

[RELEASE] Python 2.7.9

2014-12-10 Thread Benjamin Peterson
rt bugs to https://bugs.python.org/ I would like to thank the people who made the above security and usability improvements listed above possible. Among others, Alex Gaynor, David Reid, Nick Coghlan, and Donald Stufft wrote many PEPs and a lot of code to bring those features to 2.7.9. Thank you.

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

2014-02-23 Thread Benjamin Kaplan
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wrote: > On 24/02/2014 11:09 AM, Mark Lawrence wrote: >> >> On 24/02/2014 00:55, alex23 wrote: >>> >>> >>> for _ in range(5): >>> func() >> >> >> the obvious indentation error above > > > Stupid cut&paste :( > -- Your message came through fine for

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 +, 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: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-11 Thread Benjamin Kaplan
On Sat, May 10, 2014 at 11:56 PM, Ross Gayler wrote: > > Hi, > > I want to install Python on a PC with 16GB of RAM and the 64 bit version of > Windows 7. > I want Python to be able to use as much as possible of the RAM. > > When I install the 64 bit version of Python I find that sys.maxint == 2**

Directory Caching, suggestions and comments?

2014-05-15 Thread Benjamin Schollnick
ith the return_sort_* functions, since they return two different tuples, one goal was to try to keep everything in the dictionary, but I couldn't think of a better method. So any suggestions are welcome. - Benjamin """ Directory Caching system. Used to ca

[RELEASED] Python 2.7.7 release candidate 1

2014-05-18 Thread Benjamin Peterson
sting release. Assuming no horrible bugs are found, 2.7.7 final will be released in two weeks time. Please consider testing your applications and libraries with the release candidate and reporting bugs to http://bugs.python.org/ Enjoy, Benjamin Peterson 2.7 Release Manager [1] http://bugs.pytho

[RELEASE] Python 2.7.7

2014-06-01 Thread Benjamin Peterson
s the implementation of PEP 466, Network Security Enhancements for Python 2.7.x. Downloads are at https://python.org/download/releases/2.7.7/ This is a production release. As always, please report bugs to http://bugs.python.org/ Build great things, Benjamin Peterson 2.7 Release Manage

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: Resolving import errors reported by PyLint in modules using Python.NET

2013-08-08 Thread Benjamin Kaplan
On Thu, Aug 8, 2013 at 10:17 PM, wrote: > PyLint can't figure out imports of .NET code being referenced in my Python > scripts that use Python.NET. I can kind of see why; you have to evaluate > some clr.AddReference calls for the imports to even succeed. I wonder if I > have any recourse. G

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: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread Benjamin Kaplan
On Sat, Aug 24, 2013 at 9:47 AM, David M. Cotter wrote: > > > What _are_ you using? > i have scripts in a file, that i am invoking into my embedded python within a > C++ program. there is no terminal involved. the "print" statement has been > redirected (via sys.stdout) to my custom print clas

Re: List getting extended when assigned to itself

2013-08-24 Thread Benjamin Kaplan
On Sat, Aug 24, 2013 at 8:52 PM, Krishnan Shankar wrote: > Hi Python Friends, > > I came across an example which is as below, > var = [1, 12, 123, 1234] var > [1, 12, 123, 1234] var[:0] > [] var[:0] = var var > [1, 12, 123, 1234, 1, 12, 123, 1234] > > Here in var[:0]

Re: New way of writing socket servers in #Linux kernel 3.9 (and in #Python too)

2013-08-24 Thread Benjamin Kaplan
On Sat, Aug 24, 2013 at 7:08 PM, Michael Torrie wrote: > #Linux, #Python? This this hash tag stuff is getting out of hand, don't > you think? Didn't you hear? In an effort to redefine itself for the modern Internet, Usenet is adding support for hash tags and limiting posts to 140 characters beca

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: How to exit a cgi file after a download

2013-09-04 Thread Benjamin Kaplan
On Sep 4, 2013 1:29 PM, "Ferrous Cranus" wrote: > > Python help. > > I use the following code in a cgi file > to give the client a download link to > download a file. > > --- > > print "%s" % (' Down > Load ') > > > > A click on "Down Load" opens a pop up browser > window which allows the use

Re: NameError: global name '' is not defined , but a bit differences

2013-09-04 Thread Benjamin Kaplan
On Wed, Sep 4, 2013 at 9:17 PM, Mohsen Pahlevanzadeh wrote: > Dear all , > > i get the error : > > NameError: global name 'ui' is not defined > > Complete question is at : > http://stackoverflow.com/questions/18627608/nameerror-global-name-is-not-defined-but-differences > > Before answering, Thank

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

2013-09-11 Thread Benjamin Kaplan
On Wed, Sep 11, 2013 at 5:37 PM, Mark Janssen wrote: >> Unicode is not 16-bit any more than ASCII is 8-bit. And you used the >> word "encod[e]", which is the standard way to turn Unicode into bytes >> anyway. No, a Unicode string is a series of codepoints - it's most >> similar to a list of ints t

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: Python GUI?

2013-09-12 Thread Benjamin Kaplan
On Sep 12, 2013 9:06 AM, wrote: > > On Thursday, September 12, 2013 6:05:14 AM UTC+1, Michael Torrie wrote: > > On 09/11/2013 02:55 PM, [email protected] wrote: > > > > > PyQT -- You have a GUI designer, so I'm not going to count that > > > > What do you mean? Gtk has a GUI designer too. what

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: Python GUI?

2013-09-17 Thread Benjamin Kaplan
On Tue, Sep 17, 2013 at 7:55 AM, rusi wrote: > On Thursday, September 12, 2013 10:21:49 PM UTC+5:30, Benjamin Kaplan wrote: > >> The main difference between wx and qt is that qt looks native on every >> platform >> while wx *is* native on every platform (it uses

Re: Python GUI?

2013-09-17 Thread Benjamin Kaplan
On Tue, Sep 17, 2013 at 9:51 AM, rusi wrote: > On Tuesday, September 17, 2013 9:49:28 PM UTC+5:30, Benjamin Kaplan wrote: >> On Tue, Sep 17, 2013 at 7:55 AM, rusi wrote: >> >> > On Thursday, September 12, 2013 10:21:49 PM UTC+5:30, Benjamin Kaplan >> > wrote:

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 <[email protected]> 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, [email protected] 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 <[email protected]> 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

Code suggestions?

2013-09-21 Thread Benjamin Schollnick
o far, this rewrite has tremendously simplified the code for the image gallery. If there is any interest, I'm willing to github unified or the image gallery. - Benjamin import os import os.path from stat import * import time class Unified_Directory: ""

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: Select fails when cookie tried to get a numeric value

2013-10-05 Thread Benjamin Rovny
On Oct 5, 2013 8:42 AM, "Νίκος Αλεξόπουλος" wrote: > > # initialize cookie > cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') ) > cookie.load( cookie ) > vip = cookie.get('ID') > > ... > ... > > # if browser cookie does not exist, set it > vip = random.randrange(0, 1) > coo

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" < [email protected]> 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 >

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