Re: [matplotlib-devel] unused variables

2014-03-06 Thread Skip Montanaro
On Thu, Mar 6, 2014 at 7:47 AM, Federico Ariza  wrote:
> Stupid simple question
> Is there a policy/tradition/convention to name unused variables inside the 
> code?

While Eric indicates there is no policy, for the Python parts of your
code, I recommend you follow whatever the default is that pylint or
one of the other lint-like checkers recommend. Pylint likes a leading
underscore, but if you have a different natural preference, I
recommend you post your query at [email protected]. It's where
all the cool static checker folk hang out. I haven't read PEP 8 in a
long while. Does Guido express a preference there?

Skip (not a cool static checker guy)

--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] unused variables

2014-03-06 Thread Skip Montanaro
On Thu, Mar 6, 2014 at 2:38 PM, Ryan May  wrote:
> I don't think a leading _ is the way to go, because that's a common
> convention for internal class variables--property variables that you don't
> intend to be part of any supported API.

But leading underscores like this are only used as attributes of
classes. I believe the OP was asking about unused local variables.
Something more like this:

mode, _ino, dev, nlink, uid, gid, size, _atime, _mtime, _ctime =
os.stat("/etc/hosts")

(Ignore that os.stat returns a posix.stat_result object on Unix-y systems.)

Skip

--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] unused variables

2014-03-06 Thread Skip Montanaro
On Thu, Mar 6, 2014 at 2:51 PM, Nelle Varoquaux
 wrote:
> The convention is to use a simple _.
>
>  mode, _, dev, nlink, uid, gid, size, _, _, _ = os.stat("/etc/hosts")

Which is "pylint-compliant", but removes any description to future
readers (who might decide to use them) what the meaning of those
various unused values are.

Skip

--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] unused variables

2014-03-06 Thread Skip Montanaro
On Thu, Mar 6, 2014 at 3:13 PM, Nelle Varoquaux
 wrote:
> If I need to understand what exactly os.stat returns, I just read the
> documentation, and not rely on some possibly misleading variable
> names.

Despite our wish that it wasn't so, it is likely that there is far
more undocumented than documented code out in the wild, or behind
firewalls where we can't see it. I just used os.stat as an example of
a well-known function that returns multiple values. (Precisely, so
people wouldn't have to run to the documentation or that I would have
to provide a more-fleshed-out example.) In my experience, there's no
real need to be intentionally obscure by not giving a variable a
meaningful, whether or not you intend/expect to use it. Besides, open
source code can serve as a living example of good coding practices.
Might as well do our best in that regard.

Just sayin'...

Skip

--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] unused variables

2014-03-06 Thread Skip Montanaro
On Thu, Mar 6, 2014 at 3:58 PM, Chris Barker  wrote:
> it looks like pylint, anyway, will accept that.

Yes, pylint used to only accept a leading underscore by default as a
flag that a variable was unused. When I switched from pychecker to
pylint a few years ago, all my carefully crafted "unused_" variables
got flagged by pylint. I suggested adding that as another default
prefix, and they agreed.

Skip

--
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] No output when using webagg backend

2014-05-07 Thread Skip Montanaro
Apologies for those of you seeing this for a second time. I've
received no response on matplotlib-users, so I'm turning to the
experts.

In one message, I wrote:

I'm trying to use the webagg backend for the first time, and seem to
be bumping into a common problem - nothing appears. The first time I
tried, I got a complaint that tornado was missing, so I installed it.
After that, I get to try plotting. Here's my example:

>>> import matplotlib
>>> matplotlib.use('webagg')
>>> import matplotlib.pyplot as plt
>>> plt.plot(range(10))
[]
>>> plt.show()
Created new window in existing browser session.
Press Ctrl+C to stop server
^CServer stopped

When I execute plt.show(), a new tab opens in my browser (Chrome, on
Linux) with this URL: http://127.0.0.1:8988. That page has a single
link (text: "Figure 1"). If I click that link, I get this URL:
http://127.0.0.1:8988/1, but nothing appears. The page source contains
a bunch of JavaScript references. For instance:






I see those JavaScript files at appropriate places in the
.../backends/web_backend directory. What am I missing?

then followed that up with a bit more information:

I tried this at home on my Mac. Tornado was already installed, so I
updated it to 3.2.1, and ran a Matplotlib app I have which allows me
to set the backend on the command line. I get the exact same behavior
as at work on my Linux desktop. I get a page at 127.0.0:8988 with a
"Figure 1" link. Clicking that takes me to 127.0.0.1:8988/1, which is
a blank page.

Chrome is my default web browser on both Linux and the Mac. I manually
visited the page from both Firefox and Safari, clicked the link,
and... nothing. The same behavior as on Chrome.

Then I had the bright idea to look at the JavaScript console. It shows
this error message:

  Uncaught SyntaxError: Unexpected token &

Clicking that error took me to this line:

var fig = new figure('1', websocket_url_prefix);

Are those entities supposed to be '1'? What bit of code generates
that JavaScript?

Can someone provide a bit of direction? I can't find the code that
generates the above snippet of JavaScript, but Chrome, at least,
doesn't like it.

Thx,

Skip

--
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] No output when using webagg backend

2014-05-12 Thread Skip Montanaro
On Wed, May 7, 2014 at 9:04 AM, Skip Montanaro  wrote:
> I'm trying to use the webagg backend for the first time, and seem to
> be bumping into a common problem - nothing appears.

I'm guessing that the complete lack of response both here and on
matplotlib-users means nobody uses the webagg backend?

Skip Montanaro

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] No output when using webagg backend

2014-05-12 Thread Skip Montanaro
On Mon, May 12, 2014 at 10:31 AM, Benjamin Root  wrote:
> No, it gets used. We just have a huge backlog of issue tickets to go
> through.
>
> At first glance, I think this problem has already been reported and fixed in
> master. Can you try building from source the master branch on github and
> seeing if that fixes your problem?

Sorry, wasn't aware of the backlog.

Yes, I downloaded and built 1.4.x. That does seem to solve the problem.

Thanks!

Skip

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] webagg backend in web application server

2014-05-21 Thread Skip Montanaro
The nascent 1.4.x code is working fine for me to fire up my
interactive graphs served by a Tornado server. I'm interested in
providing an interface via a web application server like Django
though. I've only begun to look at the webagg backend code, but if I
read the comments correctly at the top of the files, it would seem
that I need to create a backend_webdjango.py module which relies on
the backend_webagg_core module for the heavy lifting, and interfaces
with the Django environment. Is this about correct? Has anyone
implemented a proof-of-concept of matplotlib running inside any web
application server?

Thx,

Skip

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Date overhaul?

2015-01-08 Thread Skip Montanaro
I'm real naive about this stuff, but I have always wondered why
matplotlib didn't just use datetime objects, or at least use
timezone-aware datetime objects as an "interchange" format to get the
timezone stuff right.

Skip

--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel