Very strange issues with collections.Mapping

2018-01-18 Thread Jason Swails
Hello! I am running into a very perplexing issue that is very rare, but creeps up and is crashing my app. The root cause of the issue comes down to the following check returning true: isinstance([], collections.Mapping) Obviously you can get this behavior if you register `list` as a subclass of

Re: Computational Chemistry Analysis

2016-02-28 Thread Jason Swails
On Wed, Feb 24, 2016 at 8:01 PM, Feagans, Mandy wrote: > Dear Python, > > > Hi! I am a student interested in conducting computational analysis of > protein-ligand binding for drug development analysis. Recently, I read of > an individual using a python program for their studies of protein-ligand

Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO

2016-02-08 Thread Jason Swails
On Sun, Feb 7, 2016 at 2:58 AM, Chris Angelico wrote: > > Would writing a script to figure out whether there are more > statisticians or programmers be a statistician's job or a > programmer's? > ​Yes. -- https://mail.python.org/mailman/listinfo/python-list

Re: ts.plot() pandas: No plot!

2016-02-01 Thread Jason Swails
On Sun, Jan 31, 2016 at 9:08 PM, Paulo da Silva < p_s_d_a_s_i_l_v_a...@netcabo.pt> wrote: > Às 01:43 de 01-02-2016, Mark Lawrence escreveu: > > On 01/02/2016 00:46, Paulo da Silva wrote: > ... > > >> > > > > Is it as simple as adding a call to ts.show() ? > > > Thanks for the clue! > Not so simple

Re: Why generators take long time?

2016-01-19 Thread Jason Swails
On Tue, Jan 19, 2016 at 3:19 PM, Jason Swails wrote: > > I use generator expressions when > > - I *might* want to > ​I forgot to finish my thought here. I use generator expressions when I don't want to worry about memory, there's a decent chance of short-circuiting​,

Re: Why generators take long time?

2016-01-19 Thread Jason Swails
On Tue, Jan 19, 2016 at 2:27 AM, Arshpreet Singh wrote: > > I was playing with Generators and found that using Generators time is bit > more than list-comprehensions or I am doing it wrong? > > > Function with List comprehensions: > > def sum_text(number_range): > return sum([i*i for i in xra

Re: What use of these _ prefix members?

2016-01-12 Thread Jason Swails
On Tue, Jan 12, 2016 at 9:12 AM, me wrote: > On 2016-01-10, Peter Otten <__pete...@web.de> wrote: > class Derived(Base): > > ... def _init(self, x): > > ... super()._init(x) > > ... print("do something else with", x) > > ... > Derived(42) > > do something with 42 > >

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

2015-11-12 Thread Jason Swails
On Thu, Nov 12, 2015 at 3:05 AM, Xiang Zhang <18518281...@126.com> wrote: > Recently I am learning Python C API. > > When I read the tutorial < > https://docs.python.org/3/extending/newtypes.html#the-basics>, defining > new types, I feel confused. After PyType_Ready(&noddy_NoddyType) comes > Py_IN

Re: Stylistic question regarding no-op code and tests

2015-10-15 Thread Jason Swails
On Wed, Oct 14, 2015 at 10:07 PM, Ben Finney wrote: > Jason Swails writes: > > > What I recently realized, though, that what this construct allows is > > for the coverage testing package (which I have recently started > > employing for my project... thanks Ned and ot

Stylistic question regarding no-op code and tests

2015-10-14 Thread Jason Swails
Hi everyone, I'd like to get some opinions about some coding constructs that may seem at first glance to serve no purpose, but does have *some* non-negligible purpose, and I think I've come to the right place :). The construct is this: def my_function(arg1, arg2, filename=None): """ Some fun

Re: Strong typing implementation for Python

2015-10-12 Thread Jason Swails
On Mon, Oct 12, 2015 at 1:50 PM, Bartc wrote: > On 12/10/2015 18:20, Marko Rauhamaa wrote: > >> Bartc : >> >> (Example, calling fib(40) on the example below took 90 seconds on >>> Python 3.4, 11 seconds with PyPy, but only 1.8 seconds running the >>> equivalent with FreeBasic: >>> >> >> I don't k

Re: Script To Remove Files Made Either By Python Or Git

2015-10-09 Thread Jason Swails
On Fri, Oct 9, 2015 at 6:08 AM, Joshua Stokes wrote: > Hi > > Is there an available script to remove file created by either using the > Python module or by using git? > ​There's always this nugget: git clean -fxd This will get rid of *all* untracked files in the current directory of a git repo

Re: netcdf read

2015-09-01 Thread Jason Swails
On Tue, Sep 1, 2015 at 2:07 PM, Chris Angelico wrote: > On Wed, Sep 2, 2015 at 3:23 AM, wrote: > > I'm starting in the Python scripts. I run this script: > > > > > > import numpy as np > > > > import netCDF4 > > > > f = netCDF4.Dataset('uwnd.mon.ltm.nc','r') > > > > > > f.variables > > > > > >

Re: problem with netCDF4 OpenDAP

2015-08-14 Thread Jason Swails
> On Aug 14, 2015, at 3:18 AM, Tom P wrote: > > Thanks for the reply but that is not what the documentation says. > > http://unidata.github.io/netcdf4-python/#section8 > "Remote OPeNDAP-hosted datasets can be accessed for reading over http if a > URL is provided to the netCDF4.Dataset construc

Re: problem with netCDF4 OpenDAP

2015-08-13 Thread Jason Swails
On Thu, Aug 13, 2015 at 6:32 AM, Tom P wrote: > I'm having a problem trying to access OpenDAP files using netCDF4. > The netCDF4 is installed from the Anaconda package. According to their > changelog, openDAP is supposed to be supported. > > netCDF4.__version__ > Out[7]: > '1.1.8' > > Here's some

Re: How Do I ............?

2015-07-31 Thread Jason Swails
On Fri, Jul 31, 2015 at 9:21 PM, Steve Burrus wrote: > How Do I access tkinter in Python 3.4 anyway? I've tried and tried but > cannot do it. > ​You import it. If I play mind-reader for a second, I suspect you're trying to do in Python 3 what you did in Python 2. That won't work -- the Tkinte

Re: Is there a way to install ALL Python packages?

2015-07-22 Thread Jason Swails
On Tue, Jul 21, 2015 at 10:58 PM, ryguy7272 wrote: > On Monday, July 20, 2015 at 10:57:47 PM UTC-4, ryguy7272 wrote: > > I'd like to install ALL Python packages on my machine. Even if it takes > up 4-5GB, or more, I'd like to get everything, and then use it when I need > it. Now, I'd like to im

Re: Should non-security 2.7 bugs be fixed?

2015-07-22 Thread Jason Swails
I am a little late to the party, but I feel that I have something to contribute to this discussion. Apologies for the top-post, but it's really in response to any particular question; more of a "this is my story with Python 2.7". I still use primarily Python 2.7, although I write code using six t

Re: Bug in floating point multiplication

2015-07-06 Thread Jason Swails
On Mon, Jul 6, 2015 at 11:44 AM, Oscar Benjamin wrote: > On Sat, 4 Jul 2015 at 02:12 Jason Swails wrote: > >> On Fri, Jul 3, 2015 at 11:13 AM, Oscar Benjamin < >> oscar.j.benja...@gmail.com> wrote: >> >>> On 2 July 2015 at 18:29, Jason Swails wrote: >

Re: Should iPython Notebook replace Idle

2015-07-03 Thread Jason Swails
On Fri, Jul 3, 2015 at 10:01 PM, Sayth Renshaw wrote: > In future releases of Python should ipython Notebooks replace idle as the > default tool for new users to learn python? > This would as I see it have many benefits? > > 1. A nicer more usual web interface for new users. > 2. Would allow th

Re: Bug in floating point multiplication

2015-07-03 Thread Jason Swails
On Fri, Jul 3, 2015 at 11:13 AM, Oscar Benjamin wrote: > 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 > > #

Re: Bug in floating point multiplication

2015-07-02 Thread Jason Swails
On Thu, Jul 2, 2015 at 10:52 AM, Steven D'Aprano wrote: > Despite the title, this is not one of the usual "Why can't Python do > maths?" "bug" reports. > > Can anyone reproduce this behaviour? If so, please reply with the version > of > Python and your operating system. Printing sys.version will

Re: Memory error while using pandas dataframe

2015-06-10 Thread Jason Swails
On Mon, Jun 8, 2015 at 3:32 AM, naren wrote: > Memory Error while working with pandas dataframe. > > Description of Environment Windows 7 python 3.4.2 32-bit version pandas > 0.16.0 > > We are running into the error described below. Any help provided will be > sincerely appreciated. > > We are ab

Re: What is considered an "advanced" topic in Python?

2015-05-29 Thread Jason Swails
On Fri, May 29, 2015 at 5:06 PM, wrote: > > > For example, the new (in 3.4) Enum class uses a metaclass. > > > >class SomeEnum(Enum): > > first = 1 > > second = 2 > > third = 3 > > > > The metaclass changes normal class behavior to: > > > >- support iterating: list(SomeE

Re: Best way to calculate fraction part of x?

2015-03-24 Thread Jason Swails
On Mon, Mar 23, 2015 at 8:38 PM, Emile van Sebille wrote: > On 3/23/2015 5:52 AM, Steven D'Aprano wrote: > > Are there any other, possibly better, ways to calculate the fractional >> part >> of a number? >> > > float (("%6.3f" % x)[-4:]) ​In general you lose a lot of precision this way...​ --

Re: Brilliant or insane code?

2015-03-18 Thread Jason Swails
On Wed, 2015-03-18 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. I'll go

Re: Adding a 'struct' into new python type

2015-03-07 Thread Jason Swails
On Sat, Mar 7, 2015 at 4:15 AM, Lakshmipathi.G wrote: > Hi, > > I'm following this example : > http://nedbatchelder.com/text/whirlext.html#h_making_a_type and trying > to add > new data into 'CountDict' type > > Adding a simple 'char' works well. > > typedef struct { >PyObject_HEAD >PyObj

Re: Parallelization of Python on GPU?

2015-02-26 Thread Jason Swails
On Thu, Feb 26, 2015 at 4:10 PM, Sturla Molden wrote: > On 26/02/15 18:48, Jason Swails wrote: > >> On Thu, 2015-02-26 at 16:53 +, Sturla Molden wrote: >> >>> GPU computing is great if you have the following: >>> >>> 1. Your data structures ar

Re: Parallelization of Python on GPU?

2015-02-26 Thread Jason Swails
On Thu, 2015-02-26 at 16:53 +, Sturla Molden wrote: > GPU computing is great if you have the following: > > 1. Your data structures are arrays floating point numbers. It actually works equally great, if not better, for integers. > 2. You have a data-parallel problem. This is the biggest one

Re: Building C++ modules for python using GNU autotools, automake, whatever

2015-02-26 Thread Jason Swails
On Thu, 2015-02-26 at 07:57 -0800, af300...@gmail.com wrote: > Hi, > > I'm a complete neophyte to the whole use of GNU > autotools/automake/auto... . (I'm not sure what it should be called > anymore.) Regardless, I'm porting a library project, for which I'm a > team member, to using this toolset

Re: Parallelization of Python on GPU?

2015-02-26 Thread Jason Swails
On Thu, 2015-02-26 at 14:02 +1100, Steven D'Aprano wrote: > John Ladasky wrote: > > > > What I would REALLY like to do is to take advantage of my GPU. > > I can't help you with that, but I would like to point out that GPUs > typically don't support IEE-754 maths, which means that while they are

Re: Parallelization of Python on GPU?

2015-02-26 Thread Jason Swails
On Wed, 2015-02-25 at 18:35 -0800, John Ladasky wrote: > I've been working with machine learning for a while. Many of the > standard packages (e.g., scikit-learn) have fitting algorithms which > run in single threads. These algorithms are not themselves > parallelized. Perhaps, due to their uniq

Re: A question about how plot from matplotlib works

2015-02-19 Thread Jason Swails
On Thu, Feb 19, 2015 at 5:47 AM, ast wrote: > Hello > > import numpy as np import matplotlib.pyplot as plt x = np.arange(10) y = x**2 x >>> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) > >> y >>> array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81]) > >> plt.plot(x,y) >>> [

Neat little programming puzzle

2014-12-15 Thread Jason Swails
This was a problem posed to me, which I solved in Python. I thought it was neat and enjoyed the exercise of working through it; feel free to ignore. For people looking for little projects to practice their skills with (or a simple distraction), read on. You have a triangle of numbers such that ea

Re: Python extension using a C library with one 'hello' function

2014-11-04 Thread Jason Swails
On Tue, 2014-11-04 at 23:03 +0630, Veek M wrote: > okay got it working - thanks Jason! The 3.2 docs are slightly different. What did you need to do to get it working? -- https://mail.python.org/mailman/listinfo/python-list

Re: Python extension using a C library with one 'hello' function

2014-11-04 Thread Jason Swails
On Tue, Nov 4, 2014 at 11:09 AM, Veek M wrote: > static PyMethodDef hellomethods[] = { > {"hello", py_hello, METH_VARARGS, py_hello_doc}, > {NULL, NULL, 0, NULL}, > }; > > It's basically the METH_VARARGS field that's giving the problem. Switching > it to NULL gives, > SystemError: Bad cal

Re: Python extension using a C library with one 'hello' function

2014-11-04 Thread Jason Swails
On Tue, 2014-11-04 at 21:45 +0630, Veek M wrote: > Jason Swails wrote: > > > I've submitted a PR to your github repo showing you the changes > > necessary to get your module working on my computer. > > Segfaults :p which is an improvement :) What operating system

Re: Python extension using a C library with one 'hello' function

2014-11-04 Thread Jason Swails
On Tue, 2014-11-04 at 16:22 +0630, Veek M wrote: > https://github.com/Veek/Python/tree/master/junk/hello > doesn't work. > I have: > hello.c which contains: int hello(void); > hello.h > > To wrap that up, i have: > hello.py -> _hello (c extension) -> pyhello.c -> method py_hello() > > People usin

Re: [OT] Question about Git branches

2014-09-16 Thread Jason Swails
On Tue, 2014-09-16 at 10:59 +0200, Frank Millman wrote: > "Chris Angelico" wrote in message > news:CAPTjJmr5gh8=1zPjG_KdTmA2QgT_5jj=kh=jyvrfv1atl1e...@mail.gmail.com... > > On Tue, Sep 16, 2014 at 6:21 PM, Marko Rauhamaa wrote: > >> "Frank Millman" : > >> > >>> You are encouraged to make liberal

Re: Why does str not have a __radd__ method?

2014-08-13 Thread Jason Swails
On Wed, Aug 13, 2014 at 1:55 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > Ethan Furman wrote: > > > On 08/13/2014 09:00 AM, Steven D'Aprano wrote: > >> > >> What is the rationale for str not having __radd__ method? > > > > At a guess I would say because string only knows ho

Re: My sys.excepthook dies painfully

2014-07-23 Thread Jason Swails
On Wed, Jul 23, 2014 at 6:30 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Wed, 23 Jul 2014 13:02:51 -0700, Jason Swails wrote: > > > I'm not sure how the "mylogger" variable is getting set to None in your > > my_error_ha

Re: My sys.excepthook dies painfully

2014-07-23 Thread Jason Swails
On Jul 23, 2014, at 1:02 AM, Chris Angelico wrote: > On Wed, Jul 23, 2014 at 5:46 PM, Steven D'Aprano wrote: >> On Wed, 23 Jul 2014 07:14:27 +, Steven D'Aprano wrote: >> >>> I have some code which sets up a logger instance, then installs it as >>> sys.excepthook to capture any uncaught exc

Re: networkx plot random graph Error

2014-07-16 Thread Jason Swails
On Jul 15, 2014, at 3:11 AM, u2107 wrote: > I am trying to read a file with 3 columns with col 1 and 2 as nodes/edges and > column 3 as weight (value with decimal) > > I am trying to execute this code > > > import networkx as nx > > > G = nx.read_edgelist('file.txt', data=[("weight")]) >

Re: This Python 3 is killing Python thread is killing me.

2014-07-16 Thread Jason Swails
On Wed, Jul 16, 2014 at 1:27 PM, Mark Lawrence wrote: > > The difference between our most illustrious resident unicode expert and rr > is that the former has only said anything of use once, whereas the latter > does know about tkinter/IDLE. rr doesn't show up that often, the MIRUC has > been spe

Re: This Python 3 is killing Python thread is killing me.

2014-07-16 Thread Jason Swails
On Wed, Jul 16, 2014 at 11:40 AM, Mark Lawrence wrote: > On 16/07/2014 18:32, Deb Wyatt wrote: > >> Can you all stop already with the non python US bashing? Please? >> >> Deb in WA, USA >> >> > rr started it with a fairly impressive piece of trolling but as you've > asked so politely I will happ

Re: Matplotlib Colouring outline of histogram

2014-06-20 Thread Jason Swails
On Fri, Jun 20, 2014 at 10:27 AM, Jamie Mitchell < jamiemitchell1...@gmail.com> wrote: > > That's great Jason thanks for the detailed response, I went with the > easier option 1! > > I am also trying to put hatches on my histograms like so: > > plt.hist(dataset,bins=10,hatch=['*']) > > When it com

Re: Matplotlib Colouring outline of histogram

2014-06-20 Thread Jason Swails
On Fri, Jun 20, 2014 at 4:10 AM, Jamie Mitchell wrote: > Hi folks, > > Instead of colouring the entire bar of a histogram i.e. filling it, I > would like to colour just the outline of the histogram. Does anyone know > how to do this? > Version - Python2.7 > Look at the matplotlib.pyplot.hist fun

Re: Adding R squared value to scatter plot

2014-05-21 Thread Jason Swails
​​ On Wed, May 21, 2014 at 7:59 AM, Jamie Mitchell wrote: > I have made a plot using the following code: > > python2.7 > import netCDF4 > import matplotlib.pyplot as plt > import numpy as np > > > swh_Q0_con_sw=netCDF4.Dataset('/data/cr1/jmitchel/Q0/swh/controlperiod/south_west/swhcontrol_swes

Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread Jason Swails
On Tue, Apr 8, 2014 at 3:07 AM, James Brewer wrote: > I'm sure there will be a substantial amount of arrogance perceived from > this question, but frankly I don't think that I have anything to learn from > my co-workers, which saddens me because I really like to learn and I know > that I have a l

Re: Switching between cmd.CMD instances

2014-04-02 Thread Jason Swails
On Wed, Apr 2, 2014 at 1:03 AM, Josh English wrote: > I have a program with several cmd.Cmd instances. I am trying to figure out > what the best way to organize them should be. > > I've got my BossCmd, SubmissionCmd, and StoryCmd objects. > > The BossCmd object can start either of the other two, a

Re: Tkinter problem: TclError> couldn't connect to display ":0

2013-12-29 Thread Jason Swails
On Sun, Dec 29, 2013 at 10:29 PM, Steven D'Aprano wrote: > On Mon, 30 Dec 2013 10:30:11 +1100, Chris Angelico wrote: > > > On Mon, Dec 30, 2013 at 10:22 AM, Steven D'Aprano > > wrote: > >> So you need to X-forward from the remote machine to the machine you are > >> physically on, or perhaps it's

Re: How to make Tkinter Listbox entry insensitive?

2013-10-10 Thread Jason Swails
On Thu, Oct 10, 2013 at 2:29 PM, Skip Montanaro wrote: > > Removing inappropriate entries is not much of a hack. > > True, but then I have to go through the trouble of adding them back in > should they become valid again. :-) > It seems that this could be handled fairly straight-forwardly by sub

Re: Critic my module

2013-07-27 Thread Jason Swails
You've gotten plenty of good advice from people discussing the coding and coding style itself, I'll provide some feedback from the vantage point of a perspective user. On Thu, Jul 25, 2013 at 9:24 AM, Devyn Collier Johnson < devyncjohn...@gmail.com> wrote: > Aloha Python Users! > >I made a P

Re: Strange behaviour with os.linesep

2013-07-23 Thread Jason Swails
On Tue, Jul 23, 2013 at 9:26 AM, Vincent Vande Vyvre < vincent.vandevy...@swing.be> wrote: > Le 23/07/2013 15:10, Vincent Vande Vyvre a écrit : > > The '\n' are in the original file. >> >> I've tested these other versions: >> >> --**- >> def write(): >> strings = [

Re: tkinter progress bar

2013-07-23 Thread Jason Swails
On Tue, Jul 23, 2013 at 5:38 AM, wrote: > Dear Christian, > > Thanks for the help. Can you please add a source example as I am new with > Tkinter. > http://docs.python.org/2/library/ttk.html#progressbar You can do something like this: #!/usr/bin/env python import Tkinter as tk import ttk imp

Re: Strange behaviour with os.linesep

2013-07-23 Thread Jason Swails
On Tue, Jul 23, 2013 at 7:42 AM, Vincent Vande Vyvre < vincent.vandevy...@swing.be> wrote: > On Windows a script where de endline are the system line sep, the files > are open with a double line in Eric4, Notepad++ or Gedit but they are > correctly displayed in the MS Bloc-Notes. > > Example with

Re: Callable or not callable, that is the question!

2013-07-11 Thread Jason Swails
On Thu, Jul 11, 2013 at 9:05 AM, Ulrich Eckhardt < ulrich.eckha...@dominolaser.com> wrote: > Hello! > > I just stumbled over a case where Python (2.7 and 3.3 on MS Windows) fail > to detect that an object is a function, using the callable() builtin > function. Investigating, I found out that the o

Re: Important features for editors

2013-07-04 Thread Jason Swails
On Thu, Jul 4, 2013 at 2:52 PM, Ferrous Cranus wrote: > Στις 4/7/2013 9:40 μμ, ο/η Grant Edwards έγραψε: > > On 2013-07-04, ?? wrote: >> >>> >>> If you guys want to use it i can send you a patch for it. I know its >>> illegal thing to say but it will help you use it without buying it. >

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Jason Swails
On Thu, Jun 27, 2013 at 8:22 PM, Tim Chase wrote: > On 2013-06-28 09:02, Cameron Simpson wrote: > > On 27Jun2013 11:50, Ethan Furman wrote: > > | If the OP is writing an interactive shell, shouldn't `cmd` be used > > | instead of `argparse`? argparse is, after all, intended for > > | argument pa

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Jason Swails
On Thu, Jun 27, 2013 at 2:50 PM, Ethan Furman wrote: > > If the OP is writing an interactive shell, shouldn't `cmd` be used instead > of `argparse`? argparse is, after all, intended for argument parsing of > command line scripts, not for interactive work. > He _is_ using cmd. He's subclassed c

Re: Using Python to automatically boot my computer at a specific time and play a podcast

2013-06-16 Thread Jason Swails
On Sun, Jun 16, 2013 at 3:06 PM, C. N. Desrosiers wrote: > Hi, > > I'm planning to buy a Macbook Air and I want to use it as a sort of alarm. > I'd like to write a program that boots my computer at a specific time, > loads iTunes, and starts playing a podcast. Is this sort of thing possible > in

Re: Version Control Software

2013-06-16 Thread Jason Swails
On Sun, Jun 16, 2013 at 9:30 AM, Chris “Kwpolska” Warrick < kwpol...@gmail.com> wrote: > On Sun, Jun 16, 2013 at 1:14 AM, Chris Angelico wrote: > > Hmm. ~/cpython/.hg is 200MB+, but ~/pike/.git is only 86MB. Does > > Mercurial compress its content? A tar.gz of each comes down, but only > > to ~17

on git gc --aggressive [was Re: Version Control Software]

2013-06-16 Thread Jason Swails
On Sat, Jun 15, 2013 at 11:55 PM, rusi wrote: > On Jun 16, 4:14 am, Chris Angelico wrote: > > On Sun, Jun 16, 2013 at 12:16 AM, Roy Smith wrote: > > > The advantage of DVCS is that everybody has a full copy of the repo. > > > The disadvantage of the DVCS is that every MUST have a full copy of t

Re: My son wants me to teach him Python

2013-06-14 Thread Jason Swails
On Fri, Jun 14, 2013 at 3:21 AM, Chris Angelico wrote: > On Fri, Jun 14, 2013 at 4:13 PM, Steven D'Aprano > wrote: > > Here's another Pepsi Challenge for you: > > > > There is a certain directory on your system containing 50 text files, and > > 50 non-text files. You know the location of the dir

Re: My son wants me to teach him Python

2013-06-13 Thread Jason Swails
On Thu, Jun 13, 2013 at 11:33 PM, Rick Johnson wrote: > On Thursday, June 13, 2013 3:18:57 PM UTC-5, Joshua Landau wrote: > > > [...] > > GUI is boring. I don't give a damn about that. If I had it > > my way, I'd never write any interfaces again (although > > designing them is fine). Console inte

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Jason Swails
On Mon, Jun 10, 2013 at 7:26 PM, Dave Angel wrote: > On 06/10/2013 06:54 PM, Chris Angelico wrote: > >> On Tue, Jun 11, 2013 at 8:39 AM, Grant Edwards >> wrote: >> >>> On 2013-06-10, Terry Jan Reedy wrote: >>> >>> Another principle similar to 'Don't add extraneous code' is 'Don't rebind b

Re: Idiomatic Python for incrementing pairs

2013-06-08 Thread Jason Swails
On Sat, Jun 8, 2013 at 2:47 AM, Peter Otten <__pete...@web.de> wrote: > > You can hide the complexity in a custom class: > > >>> class T(tuple): > ... def __add__(self, other): > ... return T((a+b) for a, b in zip(self, other)) > ... > >>> t = T((0, 0)) > >>> for pair in [(1, 10), (

Re: Idiomatic Python for incrementing pairs

2013-06-07 Thread Jason Swails
On Fri, Jun 7, 2013 at 10:32 PM, Tim Chase wrote: > Playing around, I've been trying to figure out the most pythonic way > of incrementing multiple values based on the return of a function. > Something like > > def calculate(params): > a = b = 0 > if some_calculation(params): > a +

Re: python netcdf

2013-06-05 Thread Jason Swails
On Wed, Jun 5, 2013 at 9:07 PM, Sudheer Joseph wrote: > Dear Members, > Is there a way to get the time:origin attribute from a > netcdf file as string using the Python netcdf? > Attributes of the NetCDF file and attributes of each of the variables can be accessed via the dot-op

Re: Bools and explicitness [was Re: PyWart: The problem with "print"]

2013-06-04 Thread Jason Swails
On Tue, Jun 4, 2013 at 11:44 AM, Rick Johnson wrote: > > This implicit conversion seems like a good idea at first, > and i was caught up in the hype myself for some time: "Hey, > i can save a few keystrokes, AWESOME!". However, i can tell > you with certainty that this implicit conversion is folly

Re: PyWart: The problem with "print"

2013-06-03 Thread Jason Swails
ack, sorry for the double-post. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: The problem with "print"

2013-06-03 Thread Jason Swails
On Mon, Jun 3, 2013 at 1:12 PM, Ian Kelly wrote: > On Sun, Jun 2, 2013 at 6:16 PM, Jason Swails > wrote: > > I'm actually with RR in terms of eliminating the overhead involved with > > 'dead' function calls, since there are instances when optimizing in >

Re: PyWart: The problem with "print"

2013-06-03 Thread Jason Swails
On Mon, Jun 3, 2013 at 1:12 PM, Ian Kelly wrote: > On Sun, Jun 2, 2013 at 6:16 PM, Jason Swails > wrote: > > I'm actually with RR in terms of eliminating the overhead involved with > > 'dead' function calls, since there are instances when optimizing in >

Re: PyWart: The problem with "print"

2013-06-02 Thread Jason Swails
On Sun, Jun 2, 2013 at 11:10 PM, Dan Sommers wrote: > On Sun, 02 Jun 2013 20:16:21 -0400, Jason Swails wrote: > > > ... If you don't believe me, you've never hit a bug that 'magically' > > disappears when you add a debugging print statement ;-). >

Re: PyWart: The problem with "print"

2013-06-02 Thread Jason Swails
On Sun, Jun 2, 2013 at 1:20 PM, Chris Angelico wrote: > > Hmm. Could be costly. Hey, you know, Python has something for testing that. > > >>> timeit.timeit('debugprint("asdf")','def debugprint(*args):\n\tif not > DEBUG: return\n\tprint(*args)\nDEBUG=False',number=100) > 0.5838018519113444 > >

Python 2-3 compatibility

2013-06-02 Thread Jason Swails
Hello Everyone, I have a Python script that I wrote to support a project that I work on (that runs primarily on Unix OSes). Given its support role in this package, this script should not introduce any other dependencies. As a result, I wrote the script in Python 2, since every Linux currently sh

Re: Preparing sqlite, dl and tkinter for Python installation (no admin rights)

2013-04-18 Thread Jason Swails
On Thu, Apr 18, 2013 at 10:37 AM, James Jong wrote: > Thanks so much Chris. This is part of a super computer and I am afraid I > don't have access to a machine with sudo permissions and similar > architecture & OS. > > Is there any way to active higher level of verbosity during the build > proces

Re: In defence of 80-char lines

2013-04-04 Thread Jason Swails
On Thu, Apr 4, 2013 at 4:28 PM, jmfauth wrote: > On 4 avr, 03:36, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > > Although PEP 8 is only compulsory for the Python standard library, many > > users like to stick to PEP 8 for external projects. > > > > http://www.python.org/dev/peps/pep

Re: Python 3.3 Tkinter Fullscreen - Taskbar not Hiding

2013-04-04 Thread Jason Swails
On Thu, Apr 4, 2013 at 1:30 PM, Rotwang wrote: > On 04/04/2013 14:49, Jason Swails wrote: > >> I've added some comments about the code in question as well... >> >> On Wed, Apr 3, 2013 at 11:45 PM, > <mailto:teslafreque...@aol.com**>> wrote: >> >&

Re: Python 3.3 Tkinter Fullscreen - Taskbar not Hiding

2013-04-04 Thread Jason Swails
I've added some comments about the code in question as well... On Wed, Apr 3, 2013 at 11:45 PM, wrote: > Hi, I am working with Tkinter, and I have set up some simple code to run: > > import tkinter > import re > from tkinter import * > If you import everything from tkinter into your top-level n

Re: In defence of 80-char lines

2013-04-04 Thread Jason Swails
On Thu, Apr 4, 2013 at 8:39 AM, Roy Smith wrote: > In article , > Jason Swails wrote: > > > The only time I regularly break my rule is for regular expressions (at > some > > point I may embrace re.X to allow me to break those up, too). > > re.X is a pretty coo

Re: In defence of 80-char lines

2013-04-04 Thread Jason Swails
On Thu, Apr 4, 2013 at 7:09 AM, Tim Chase wrote: > On 2013-04-04 08:43, Peter Otten wrote: > > llanitedave wrote: > >> self.mainLabel.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, > faceName = "FreeSans")) > > > > I think I would prefer > > > > labelfont = wx.Font( > > pointSize=12, > >

Re: In defence of 80-char lines

2013-04-04 Thread Jason Swails
On Wed, Apr 3, 2013 at 9:36 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > Although PEP 8 is only compulsory for the Python standard library, many > users like to stick to PEP 8 for external projects. > But even the standard library breaks this rule on occasion. e.g., /usr/

Re: Tkinter

2013-04-03 Thread Jason Swails
On Tue, Apr 2, 2013 at 10:04 PM, Renato Barbosa Pim Pereira < renato.barbosa.pim.pere...@gmail.com> wrote: > Thanks for the advices, I need now one scrollbar to roll under screen, I > created the scrollbar but cant roll, please help me on this. > > http://pastebin.com/L6XWY6cm > You need to bind

Re: Tkinter

2013-04-02 Thread Jason Swails
Please keep response replies to the Python list (e.g., use 'reply all' or just send the email to python-list). Also, you should tell people what Python version you are using. I assume you are using Python 2 since Tkinter was renamed to tkinter in Python 3. Finally, do not top-post. Type your res

Re: Tkinter

2013-04-02 Thread Jason Swails
On Mon, Apr 1, 2013 at 5:12 PM, Renato Barbosa Pim Pereira < renato.barbosa.pim.pere...@gmail.com> wrote: > I need to create a button and a text box follows the text box to enter a > number, and this number is expected to create the same screen text boxes, and > these text boxes need to be referen

Re: Installation on Mac OSX 10.6.8 doesn't create the folder: /System/Library/Frameworks/Python.framework/Versions/2.7/

2013-04-02 Thread Jason Swails
On Tue, Apr 2, 2013 at 6:22 AM, kramer65 wrote: > Hello people, > > > I installed python 2.7 on Mac OSX 10.6.8 with no problems and it is > working fine. When I try to install Kivy however (www.kivy.org), I get an > error saying: > How did you install Python 2.7? How did you install Kivy? Not

Re: Why does 1**2**3**4**5 raise a MemoryError?

2013-03-31 Thread Jason Swails
On Sun, Mar 31, 2013 at 9:15 AM, Roy Smith wrote: > > > $ prtstat 29937 > > Process: mongodState: S (sleeping) > > [...] > > Memory > > Vsize: 1998285 MB > > RSS: 5428 MB > > RSS Limit: 18446744073709 MB > > If I counted the digits right, that 1.9 TB. I love the R

Re: Export data from python to a txt file

2013-03-29 Thread Jason Swails
On Fri, Mar 29, 2013 at 1:33 PM, Ana Dionísio wrote: > Hello!!! > > I have this lists a=[1,3,5,6,10], b=[a,t,q,r,s] and I need to export it to > a txt file and I can't use csv. > It would help if you showed exactly what you had in your program or in the Python interpreter. For instance a = [1,

Re: Decorator help

2013-03-27 Thread Jason Swails
On Wed, Mar 27, 2013 at 7:29 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > > The one doesn't follow from the other. Writing decorators as classes is > fairly unusual. Normally, they will be regular functions. If your > decorator needs to store so much state that it needs to

Re: Decorator help

2013-03-27 Thread Jason Swails
On Wed, Mar 27, 2013 at 3:49 PM, Joseph L. Casale wrote: > I have a class which sets up some class vars, then several methods that > are passed in data > and do work referencing the class vars. > > > I want to decorate these methods, the decorator needs access to the class > vars, so I thought >

Re: Python GUI questions

2013-03-19 Thread Jason Swails
On Tue, Mar 19, 2013 at 9:25 PM, maiden129 wrote: > On Tuesday, March 19, 2013 8:57:42 PM UTC-4, Rick Johnson wrote: > > On Tuesday, March 19, 2013 2:01:24 PM UTC-5, maiden129 wrote: > > > > > Hello, > > > > > > > > > > I'm using python 3.2.3 and I'm making a program that show > > > > > the of occ

Re: PyWart: NameError trackbacks are superfluous

2013-03-17 Thread Jason Swails
On Sat, Mar 16, 2013 at 2:27 PM, Rick Johnson wrote: > > [snip junk] > We don't need multiple layers of traces for NameErrors. Python does not > have *real* global variables; and thank Guido for that! All we need to know > is which module the error occurred in AND which line of that module > conta

Re: Is it correct this way to inherit from a list?

2013-03-03 Thread Jason Swails
On Sun, Mar 3, 2013 at 9:21 AM, Colin J. Williams wrote: > On 02/03/2013 9:30 PM, gialloporpora wrote: > >> Risposta al messaggio di Rick Johnson : >> >> What are you trying to achieve exactly? >>> >> >> >> I would like to implement a class (vector) to works with vectors, for >> example using sc

Re: Speeding up Python's exit

2013-03-01 Thread Jason Swails
On Fri, Mar 1, 2013 at 5:51 PM, Antoine Pitrou wrote: > Dave Angel davea.name> writes: > > > > Note he didn't say the python buffers would be flushed. It's the OS > > buffers that are flushed. > > Now please read my message again. The OS buffers are *not* flushed > according > to POSIX. > I ha

Re: Do you feel bad because of the Python docs?

2013-02-26 Thread Jason Swails
Just to throw in my 2c -- in the same way that 'a picture is worth a thousand words', an interactive interpreter is worth volumes of documentation (especially one with such a nice help()/__doc__ functionality). It's worth pointing out that 'interpreter' appears in the original rant once (according

Re: request of information

2013-02-17 Thread Jason Swails
On Sun, Feb 17, 2013 at 1:47 PM, leonardo selmi wrote: > > > > > > > > > > >> gentlemen: > >> > >> i am reading a book about python and now i am blocked, i can't store > functions in modules: i have a mac and am using version 2.7.3, i have > created a function and want to save it as a file using

Re: PyWart: Namespace asinitiy and the folly of the global statement

2013-02-11 Thread Jason Swails
On Mon, Feb 11, 2013 at 1:27 AM, Chris Angelico wrote: > On Mon, Feb 11, 2013 at 1:42 PM, alex23 wrote: > > On Feb 9, 2:25 pm, Michael Torrie wrote: > >> Rick seems to know his stuff > >> about Tk programming, but his knowledge of programming language theory > >> and formal computing seems quit

Re: confusion with decorators

2013-01-31 Thread Jason Swails
On Thu, Jan 31, 2013 at 6:16 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > > Normally, subclasses should extend functionality, not take it away. A > fundamental principle of OO design is that anywhere you could sensibly > allow an instance, should also be able to use a subcl

Re: confusion with decorators

2013-01-31 Thread Jason Swails
On Thu, Jan 31, 2013 at 11:00 AM, Jason Swails wrote: > > > On Thu, Jan 31, 2013 at 10:28 AM, Chris Angelico wrote: > >> >> >> Well, that surely isn't going to work, because it always decorates the >> >> same function, the global "fcn&quo

  1   2   >