Re: Linux Mint installation of Python 3.5

2015-09-29 Thread Mario Figueiredo
On 09/30/2015 03:44 AM, Chris Angelico wrote: > > The easiest way to install something from source is to use 'make > altinstall' for the final step. That should install you a 'python3.5' > binary without touching the 'python3' binary. That said, though, it's > entirely possible that upgrading 'pyt

Linux Mint installation of Python 3.5

2015-09-29 Thread Mario Figueiredo
Hello everyone, Under Linux Mint it is not a good idea to just go ahead and replace the system installed Python versions and their packages. And yet I wish to both update the 3.4 modules and install Python 3.5. I understand that for the first I just need to use virtualenv. But how can I safely in

Re: Python handles globals badly.

2015-09-12 Thread Mario Figueiredo
On 12-09-2015 18:09, MRAB wrote: > On 2015-09-12 17:29, Dennis Lee Bieber wrote: >> But no one had tested the algorithm with the rate of change the >> Ariane >> 5 could produce -- so an algorithm that was developed for, and safe with, >> the smaller Ariane suddenly went "something's wrong -- ab

Re: Python handles globals badly.

2015-09-12 Thread Mario Figueiredo
On 12-09-2015 05:38, Mark Lawrence wrote: > > Nothing to do with this being untested software then? Actually it was > so I'd put that down to a programmer error. "The code always worked > before so it's bound to work this time". Such a pity that this > particular launch wasn't the same as anyth

Re: Python handles globals badly.

2015-09-11 Thread Mario Figueiredo
On 12-09-2015 03:35, Mark Lawrence wrote: > > Ada took over from CORAL in the UK, at least in military projects. It > was also used in the aircraft industry. My old work mates tell me that > its completely died a death, to be replaced by C++. Someone please > remind me never to fly again. Alrigh

Re: Python handles globals badly.

2015-09-09 Thread Mario Figueiredo
On 09-09-2015 18:55, Steven D'Aprano wrote: > On Wed, 9 Sep 2015 11:09 am, Mario Figueiredo wrote: > >> You know, it is a pointless exercise to try and downplay programming >> languages (any programming language) that has proven its worth by being >> generally adopted

Re: Python handles globals badly.

2015-09-08 Thread Mario Figueiredo
On 09-09-2015 02:26, Ben Finney wrote: Mario Figueiredo writes: Note: You know, it is a pointless exercise to try and downplay programming languages (any programming language) that has proven its worth by being generally adopted by the programming community. Adoption is the sign of a

Re: Python handles globals badly.

2015-09-08 Thread Mario Figueiredo
On 09-09-2015 01:25, Vladimir Ignatov wrote: It's different from the rest 99.9% of languages for no particular reason. ( => perfect example of "design smell" => not a good example to follow) Assuming that some programming language makes design choices "for no apparent reason" is your first hi

Re: Python handles globals badly.

2015-09-08 Thread Mario Figueiredo
On 08-09-2015 12:55, Vladimir Ignatov wrote: I had some experience programming in Lua and I'd say - that language is bad example to follow. Indexes start with 1 (I am not kidding) What is so bad about that? It's different from the rest 99.9% of languages for no particular reason. ( => perfe

Re: Uninstall

2015-08-04 Thread Mario Figueiredo
On Wed, Aug 5, 2015 at 3:08 AM, Mario Figueiredo wrote: > > But being an asshole does not. That is something one chooses to become. Your answer squarely puts you in the group of people that chose to be in life to be a pain to others [...] An ugly mistyping there completely changed the mean

Re: Uninstall

2015-08-04 Thread Mario Figueiredo
On Tue, Aug 4, 2015 at 11:06 PM, Ned Batchelder wrote: > > On Tuesday, August 4, 2015 at 2:32:16 PM UTC-4, sohca...@gmail.com wrote: > > milos: "You can't uninstall Python because it will break things" > > Grant: "Actually, you CAN uninstall Python, but it will break things" > > > > I really fucki

Re: Uninstall

2015-08-04 Thread Mario Figueiredo
On Tue, Aug 4, 2015 at 9:01 PM, Mark Lawrence wrote: > On 04/08/2015 19:31, sohcahto...@gmail.com wrote: > >> On Tuesday, August 4, 2015 at 7:29:29 AM UTC-7, Grant Edwards wrote: >> >>> On 2015-08-04, milos zorica wrote: >>> >>> you can't fully uninstall python from OSX, linux, BSD as there are

Re: Slices time complexity

2015-05-20 Thread Mario Figueiredo
On Wed, 20 May 2015 21:47:46 +0100, Mark Lawrence wrote: >Please provide the figures to back up this claim. Nothing personal but >we've had problems with the RUE (amongst others) making nonsensical >claims, please don't take us down that path, thank you. Alright. My apologies. This answer of

Re: Slices time complexity

2015-05-20 Thread Mario Figueiredo
On Wed, 20 May 2015 03:07:03 +1000, Steven D'Aprano wrote: >Yes, a slice can be expensive, if you have (say) a ten billion element list, >and take a slice list[1:]. Since nothing seems to surprise you and you seem so adamant on calling anyone being surprised by it, maybe I will surprise you if y

Re: Slices time complexity

2015-05-18 Thread Mario Figueiredo
On Mon, 18 May 2015 13:49:45 -0600, Ian Kelly wrote: >> Other languages implement slices. I'm currently being faced with a Go >> snippet that mirrors the exact code above and it does run in linear >> time. >> >> Is there any reason why Python 3.4 implementation of slices cannot be >> a near const

Re: Slices time complexity

2015-05-18 Thread Mario Figueiredo
On Tue, 19 May 2015 05:36:44 +1000, Chris Angelico wrote: >What's the point of optimizing slicing to allow you to use a poor >algorithm, instead of fixing your algorithm? > Chris, thank you for your input. But the code isn't really the question, is it? It's just an example. It was being used ea

Slices time complexity

2015-05-18 Thread Mario Figueiredo
I'd like to understand what I'm being told about slices in https://wiki.python.org/moin/TimeComplexity Particularly, what's a 'del slice' and a 'set slice' and whether this information pertains to both CPython 2.7 and 3.4. >From the above link it seems slices work in linear time on all cases. And

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-26 Thread Mario Figueiredo
On Sun, 26 Apr 2015 18:55:27 + (UTC), Denis McMahon wrote: >The first thing you need to do is create a small self contained example >of your problem. > >State the problem: Plot does not create the output you expect. > >Give an example: > >plot( [1,11], [5,5] ) > >Explain what you expect the

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-26 Thread Mario Figueiredo
On Sun, 26 Apr 2015 11:17:07 +0100, Dave Farrance wrote: > >Moving average. Try: > >def movingaverage(interval, window_size): >window= numpy.ones(int(window_size))/float(window_size) >return numpy.convolve(interval, window, 'same') > >y_av = movingaverage(y,10) > >Note that you'd get prob

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Mario Figueiredo
On Sat, 25 Apr 2015 23:12:19 + (UTC), Denis McMahon wrote: >Sorry, but given a choice of 5 plot methods in matplotlib and no hint as >to which one you're calling, I'm not inclined to go and look at the >arguments of all of them. There's actually around 8 I think. The individual graphs type

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Mario Figueiredo
Ok. Ermm, it seems I needed to ask to finally have an epiphany. The problem is that defaultdict is unordered. Once I get the data ordered, I can finally plot the curve. Although this presents another problem... import decimal from random import expovariate from collections import defaultdict deci

Re: [Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Mario Figueiredo
On Sat, 25 Apr 2015 23:33:10 +0100, Mario Figueiredo wrote: > >Trying to plot this data into a frequency curve is proving too >challenging and I just can't understand why. > >plot(list(results.keys()), list(results.values())) > The above should read: results = ge

[Matplotlib] Ploting an exponential distribution frequency curve

2015-04-25 Thread Mario Figueiredo
I'm trying to plot the curve of an exponential distribution without much success. I'm missing something very basic I feel, but just can't figure it out after numerous tries, so I'm turning out to you. This is the function generating the frequency of individual outcomes: import decimal fro

Re: Python 3 success story

2015-03-30 Thread Mario Figueiredo
On Mon, 30 Mar 2015 19:28:16 -0400, Terry Reedy wrote: > >So I suggested going ahead and testing PyBrain by using it. This >appears to have worked out well. I believe the only 2-3 issue she ran >into was a '/' that needed to become '//', that either 2to3 or I missed >in the initial conversion

Re: Python 2/3 versus Perl 5/6

2015-03-28 Thread Mario Figueiredo
On Sat, 28 Mar 2015 21:32:31 +1100, Steven D'Aprano wrote: >The famous Perl coder Allison Randal writes about why Perl is not dead (it's >just pining for the fjords *wink* ) and contrasts the Perl 5/6 split to >Python 2/3: A shame Allison doesn't frequent these groups. I would have a few questio

Re: Proposal for new minor syntax

2015-03-28 Thread Mario Figueiredo
On Sat, 28 Mar 2015 13:38:20 +, BartC wrote: > >(I'm not sure how this all applies to the loop_node.next example, but >even here I don't count the "." as an operator, but syntax. Neiter the language. The dot symbol is a delimiter in the python grammar. Not an operator. And also defined as a

Re: Proposal for new minor syntax

2015-03-27 Thread Mario Figueiredo
On Sat, 28 Mar 2015 10:39:04 +1100, Ben Finney wrote: >Jamie Willis writes: > >> This could be written as: >> >> hello = "hello world " >> hello .= strip() > >?1, “.=” is visually too similar to “=”. can't be much worse than hello = "hello world", I think the dot next to

Re: test1

2015-03-26 Thread Mario Figueiredo
On Thu, 26 Mar 2015 18:56:25 -0700 (PDT), Tiglath Suriol wrote: > >How disappointing, I was expecting something worth opposing. > And that's bad? Successfully opposing a troll is like getting a medal for winning an argument with Spencer Pratt. Delusional pricks like you are only worth the 2 or

Re: Cannot Uninstall 3.4

2015-03-26 Thread Mario Figueiredo
On Thu, 26 Mar 2015 18:52:41 -0500, T Younger wrote: >I have 3.4.1 (8/14) and replaced it with 3.4.2 (12/14) >Neither of these uninstalled or I do not believe even had the option. > >I now wanted to update to 3.4.3 and the uninstall fails, provided the >message that the installer is missing a pro

Re: test1

2015-03-26 Thread Mario Figueiredo
On Thu, 26 Mar 2015 14:06:28 -0700 (PDT), marcuslom...@gmail.com wrote: > >I posted two test messages containing code. They are still there, > are you blind as well as dumb? > >Your post is also off-topic, so what are you whining about, girl? > >You can ignore my posts almost effortlessly, the

Re: Fwd: test1

2015-03-26 Thread Mario Figueiredo
On Thu, 26 Mar 2015 13:58:36 -0700 (PDT), marcuslom...@gmail.com wrote: >I just needed to save some code and there was no email at hand > LOL. What an imbecile. You gotta love trolls sometimes. They exist with the sole purpose to make you feel good about yourself. -- https://mail.python.org/m

Re: module attributes and docstrings

2015-03-26 Thread Mario Figueiredo
On Tue, 24 Mar 2015 15:33:41 -0400, Terry Reedy wrote: > >You have discovered one of advantages of a def statement over a >name=lambda assignment statement. In Python, there is no good reason to >use the latter form and PEP 8 specifically discourages it: "Always use a >def statement instead o

Re: module attributes and docstrings

2015-03-26 Thread Mario Figueiredo
Sorry for the late reply. We experienced a 3 day blackout following one of the most amazing thunderstorms I've witnessed in my life. On Tue, 24 Mar 2015 22:49:49 +1100, Steven D'Aprano wrote: >On Tue, 24 Mar 2015 07:55 pm, Mario Figueiredo wrote: > >> Reading PEP

module attributes and docstrings

2015-03-24 Thread Mario Figueiredo
Reading PEP 257 and 258 I got the impression that I could document module attributes and these would be available in the __doc__ attribute of the object. So things like the one below are something I got used to do, but that don't work after all, as I learned today: value_factory = lambda _, r

Re: [OT] Weaknesses of distro package managers - was Re: Python 2 to 3 conversion - embrace the pain

2015-03-20 Thread Mario Figueiredo
On Fri, 20 Mar 2015 15:59:01 +0100, Mario Figueiredo wrote: > >Ah. So you are on the Python 3 unicode support sucks bandwagon too? > >Bet you guys have a whole lot of fun there. Rave parties, trashing, >getting mad at something. Sounds fun. > >Over here, on the Python 3 un

Re: [OT] Weaknesses of distro package managers - was Re: Python 2 to 3 conversion - embrace the pain

2015-03-20 Thread Mario Figueiredo
On Fri, 20 Mar 2015 02:40:26 -0700 (PDT), wxjmfa...@gmail.com wrote: > >Python 3.x is excellent. >Probably, the best language to show a >poor and buggy Unicode implementation >(Character Encoding Model). > >When I think other computer languages or >Unicode related tools are all doing wrong. >That's

Re: Python 2 to 3 conversion - embrace the pain

2015-03-19 Thread Mario Figueiredo
On Thu, 19 Mar 2015 22:03:02 -0400, Dennis Lee Bieber wrote: >On Thu, 19 Mar 2015 16:23:04 -0700, Paul Rubin >declaimed the following: > >>Steven D'Aprano writes: >> >>> Anyone remember the big backwards incompatible changes made to Visual >>> Basic? How long did that take to settle down after

Re: Python 2 to 3 conversion - embrace the pain

2015-03-17 Thread Mario Figueiredo
On Tue, 17 Mar 2015 04:36:01 +, Mark Lawrence wrote: > >Of course we could avoid all of these problems if we were to bring back >the mainframe or mini and the dumb terminal. > >Take cover, incoming :) No kidding. Installing only the software you coded (or from source) may be a little too mu

Re: Python 2 to 3 conversion - embrace the pain

2015-03-17 Thread Mario Figueiredo
On Tue, 17 Mar 2015 22:26:58 +1100, Steven D'Aprano wrote: > >> >> Can you give an example? I wouldn't count things like gets, which >> aren't as much changes in the language, as recognition that using it was >> buggy from the start. > >That's exactly the point. `gets` is dangerous and needs to

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Mario Figueiredo
On Tue, 17 Mar 2015 14:42:42 +1100, Ben Finney wrote: >Mario Figueiredo writes: > >> On Tue, 17 Mar 2015 09:02:38 +1100, Chris Angelico >> wrote: >> > >> >Imagine you need a PostgreSQL database for your Python application - >> >which also means you

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Mario Figueiredo
On Tue, 17 Mar 2015 14:49:36 +1100, Chris Angelico wrote: > >The simpler you can make those instructions, the easier it is for >people to use your program. So on Windows, that probably means you >have to bundle everything into a big fat .exe or .msi installer, which >is what leads to DLL Hell whe

Re: generator/coroutine terminology

2015-03-16 Thread Mario Figueiredo
On Mon, 16 Mar 2015 19:52:59 -0700 (PDT), Rustom Mody wrote: > >When we go from 'simple-generators' to coroutine-generators there seem to be >bigger conceptual problems and implementation-gaffes. >Quite frankly I hardly understand this part. There's a line after which terminology just becomes pe

Re: [OT] Weaknesses of distro package managers - was Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Mario Figueiredo
On Mon, 16 Mar 2015 21:05:03 -0600, Michael Torrie wrote: >On 03/16/2015 09:01 PM, Mark Lawrence wrote: >> Reading this makes me realise how lucky I am not having to worry about >> such issues. > >How so? Speaking for myself (I know you didn't ask me) what you call the "dismal world of windows"

Re: Python 2 to 3 conversion - embrace the pain

2015-03-16 Thread Mario Figueiredo
On Tue, 17 Mar 2015 09:02:38 +1100, Chris Angelico wrote: > >Imagine you need a >PostgreSQL database for your Python application - which also means you >need psycopg2, of course. How do you go about writing installation >instructions? > >* WINDOWS * >1) Install the latest Python 3 from https://www

Re: Python 2 to 3 conversion - embrace the pain

2015-03-15 Thread Mario Figueiredo
On Sun, 15 Mar 2015 19:43:38 -0400, Roy Smith wrote: > >The big problem continues to be the legacy projects. People made >decisions years ago about what packages to use, and those decisions are >hard to get away from. There is a lot of production code out there >which still uses third-party

Re: Python 2 to 3 conversion - embrace the pain

2015-03-15 Thread Mario Figueiredo
On Sun, 15 Mar 2015 12:05:21 -0700, John Nagle wrote: >On 3/14/2015 1:00 AM, Marko Rauhamaa wrote: > >Some of the bugs I listed are so easy to hit that I suspect those >packages aren't used much. Those bugs should have been found years >ago. Fixed, even. I shouldn't be discovering them in

Re: Code hosting providers

2015-03-13 Thread Mario Figueiredo
On Fri, 13 Mar 2015 23:13:17 -0400, Gene Heskett wrote: > >> >> That's taking things too far. And when people speak of hosting your >> own server, they don't necessarily mean hosting in your home computer. >> Speaking for myself, I refuse to collaborate on any project that is >> hosted on some dud

Re: Code hosting providers

2015-03-13 Thread Mario Figueiredo
On Fri, 13 Mar 2015 19:38:09 -0400, Gene Heskett wrote: > >Running your own server is a piece of cake, and if I, at 80 yo, can do >it, I don't see a single reason you can't do likewise. The code I >write, for what is called a legacy computer, is just one of the things I >share at the link in

Re: Code hosting providers (was: Google Code Shutting Down)

2015-03-13 Thread Mario Figueiredo
On Fri, 13 Mar 2015 12:37:30 +1100, Ben Finney wrote: > >Any service which doesn't run their service on free software is one to >avoid http://mako.cc/writing/hill-free_tools.html>; free software >projects need free tools to remain that way. > > >GitLab https://about.gitlab.com/> is a good option:

Re: Google Code Shutting Down

2015-03-12 Thread Mario Figueiredo
On Thu, 12 Mar 2015 15:26:08 -0700 (PDT), Josh English wrote: >I've been hosting Python projects on Google Code, and they're shutting down. > >Damn. > >What is the recommended replacement for Code Hosting that works reliably with >PyPi and pip? Essentially anywhere where either Git, Bazaar, Mer

Re: __new__() does not return anything, on singletong pattern

2015-03-12 Thread Mario Figueiredo
On Thu, 12 Mar 2015 22:04:30 +1100, Steven D'Aprano wrote: > >3-4 seconds to instantiate is a bit worrying, but you should look at >improving the efficiency of loading a map rather than insisting that there >should be only one map instance. Particularly in the map editor, what if >the user wants

Re: __new__() does not return anything, on singletong pattern

2015-03-12 Thread Mario Figueiredo
On Thu, 12 Mar 2015 21:41:16 +1300, Gregory Ewing wrote: >Mario Figueiredo wrote: >> But PyCharm flags the assignment >> with a warning telling me that generate() does not return anything and >> the I lose code completion on the mmap variable. > >My guess is t

Re: __new__() does not return anything, on singletong pattern

2015-03-12 Thread Mario Figueiredo
On Thu, 12 Mar 2015 22:29:24 +1100, Steven D'Aprano wrote: > >I would have a loadfile() method which takes a filename on disk, opens the >file and passes the contents (or the open file object) to another method, >load() to do the actual work: > > >class Map: >def __new__(cls, width, height, f

Re: __new__() does not return anything, on singletong pattern

2015-03-12 Thread Mario Figueiredo
On Thu, 12 Mar 2015 21:40:03 +1300, Gregory Ewing wrote: >Mario Figueiredo wrote: > >> A different application, a map editor, needs to also instantiate an >> object of the class Map. But in this case the map needs to either be >> empty (if the user wants to create a new

Re: __new__() does not return anything, on singletong pattern

2015-03-12 Thread Mario Figueiredo
On Thu, 12 Mar 2015 21:38:00 +1300, Gregory Ewing wrote: > >I would just provide a function: > >_map = None > >def get_map(): >global _map >if _map is None: > _map = Map() >return _map > >and document the fact that you shouldn't call Map() >directly. Oh, you are so right! Been

Re: __new__() does not return anything, on singletong pattern

2015-03-12 Thread Mario Figueiredo
On Wed, 11 Mar 2015 16:47:32 -0700, Ethan Furman wrote: > >You're code is good. Thanks for taking a weight off my shoulder. > > The only question is if you /really/ need a singleton -- and only > you can answer that (although plenty of folks will tell you you > don't ;) . Yeah. I debated that

Re: __new__() does not return anything, on singletong pattern

2015-03-12 Thread Mario Figueiredo
On Thu, 12 Mar 2015 16:31:12 +1100, Steven D'Aprano wrote: >Mario Figueiredo wrote: > > >If this is supposed to be a singleton, you can't create more instances. The >point of a singleton that there is only one instance (or perhaps a small >number, two or thr

__new__() does not return anything, on singletong pattern

2015-03-11 Thread Mario Figueiredo
I'm fairly new to Python, so I don't know if the following is me abusing the programming language idioms, or simply a mistake of my IDE code inspection routine. I have a singleton Map class which is defined like so: class Map: _instance = None def __new__(cls): if Map._instan

Re: [Python 3.4] Rationale for readonly slice data attributes

2015-03-07 Thread Mario Figueiredo
On Thu, 5 Mar 2015 23:36:47 -0700, Ian Kelly wrote: > >I'm not following what it is that you want to accomplish in this >example by modifying the slice object. Yeah. That code doesn't show anything. It was just meant to illustrate what I was doing, not how. But in retrospect it just made my post

Re: Python Worst Practices

2015-03-07 Thread Mario Figueiredo
On Fri, 6 Mar 2015 21:09:24 +1100, Chris Angelico wrote: > >there was a time (maybe times, I don't remember) when >Microsoft tried hard to require "managed code" everywhere (aka ".NET >runtime only"), and the push-back was so strong that they had to >abandon the requirement. But somehow, people ac

[Python 3.4] Rationale for readonly slice data attributes

2015-03-05 Thread Mario Figueiredo
What is the rationale behind making the slice class data attributes readonly? I've built a __getitem__ method for a Map class that contains a list of Cell instance objects. __getitem__ maps this list into a matrix:: # get cell at cartesian coordinates 12, 4 # will map to the 1048th positi

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-05 Thread Mario Figueiredo
On Thu, 05 Mar 2015 07:19:42 +0200, Marko Rauhamaa wrote: > >Where I work, people do use voice still occasionally to communicate. > Communications skills... the bane of any software developer. Pronunciation is just another obstacle to cross on top of the natural barrier that is transmitting compl

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-04 Thread Mario Figueiredo
On Wed, 4 Mar 2015 17:34:04 -0800 (PST), Xrrific wrote: >I am trying to impress a girl who is learning python and want ask her out at >the same time. > >Could you please come up with something witty incorporating a simple python >line like If...then... but..etc. How about not using python at al

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-04 Thread Mario Figueiredo
On Wed, 04 Mar 2015 15:16:18 +0200, Marko Rauhamaa wrote: > >No, the ultimate irony is that people don't understand what is being >talked about. > Care to summarize then? Because the one thing I'm seeing is your assertion that people should write identifiers in a more standard way following an

Re: [Python 3.4.3, pip 6.0.8 ] Error installing Sphinx (on markupsafe install)

2015-03-03 Thread Mario Figueiredo
On Tue, 03 Mar 2015 07:15:19 +, Mark Lawrence wrote: >Further the output above tells me that you've not got >Visual Studio 2010 installed. I do. It's my principal development suite. But you put me in the right track. I took a closer look at the error messages and also noticed the reference

[Python 3.4.3, pip 6.0.8 ] Error installing Sphinx (on markupsafe install)

2015-03-02 Thread Mario Figueiredo
Anyone else having problems installing Sphinx as of late? It installed perfectly fine for me under windows just a few weeks ago. But currently I get an error when trying to install it: I'm including the full error output. $ pip install -U sphinx --no-cache-dir Collecting sphinx Downloading Sph

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-02 Thread Mario Figueiredo
On Mon, 2 Mar 2015 19:51:31 -0800 (PST), Rustom Mody wrote: > >I dont know what you are saying Mario or even whom you are addressing I was replying directly to Marko. I don't think it is possible to establish a standard dialect for variable names in English or any other language. It doesn't even

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-02 Thread Mario Figueiredo
On Mon, 02 Mar 2015 17:30:42 +0200, Marko Rauhamaa wrote: >Steven D'Aprano : > >> But for Britons to use American English is, in a way, to cease to be >> Britons at all. > >Did Hugh Laurie have to turn in his British passport? The concepts behind an actor performing and a programmer programming

Re: suggestions for functional style (singleton pattern?)

2015-03-02 Thread Mario Figueiredo
On Mon, 02 Mar 2015 11:19:06 +0100, Fabien wrote: >On 01.03.2015 06:05, Michael Torrie wrote: >> A module*is* a singleton pattern, particularly one >> that maintains state. I use sometimes use this feature for sharing >> config and other data between other modules (global state when it's >> r

Re: Python Worst Practices

2015-03-01 Thread Mario Figueiredo
On Sun, 01 Mar 2015 22:45:12 +0200, Marko Rauhamaa wrote: > >Fact remains I can easily understand what Chinese, Mexican, Italian, >Russian or Malay colleagues say in English. For some reason, Australian >and Indian speakers don't give me trouble, either. The Irish accent is >borderline, but the Br

Re: Python Worst Practices

2015-03-01 Thread Mario Figueiredo
On Sun, 1 Mar 2015 11:23:51 -0800 (PST), wxjmfa...@gmail.com wrote: > >http://www.unicode.org/reports/tr31/ > >Python is doing very on that sile. > >jmf > I'm glad Annex 31 agrees that I can name identifiers even in hebrew if I really want to. For a moment there I was shaking when I opened the li

Re: Python Worst Practices

2015-03-01 Thread Mario Figueiredo
On Sun, 01 Mar 2015 19:52:32 +0200, Marko Rauhamaa wrote: > >I mean, nobody's taking away your native language. It's just that >everybody's got to learn a foreign language. The learning curve >shouldn't be too steep for a native Brit. That's fine. But could you please point us to the ISO that det

Re: suggestions for functional style (singleton pattern?)

2015-03-01 Thread Mario Figueiredo
On Mon, 02 Mar 2015 02:04:40 +1100, Steven D'Aprano wrote: >Mario Figueiredo wrote: > >> (warning: Didn't bother prove-reading and spell chocking. Sorry...) > >Warning: didn't bother reading. Not sorry at all. Ohh.. how hurtful of you. It was 4:45 am when I pos

Re: suggestions for functional style (singleton pattern?)

2015-02-28 Thread Mario Figueiredo
On Sat, 28 Feb 2015 16:12:54 -0700, y...@zioup.com wrote: >Hi, > >For some scripts, I write in a a more functional way, using a lot of small >functions outside of any class. Although it makes the code clearer for >specific cases, I have found that it makes debugging and using the repl in >general

Re: Bug in timsort!?

2015-02-25 Thread Mario Figueiredo
On Wed, 25 Feb 2015 17:44:04 +0100, Sturla Molden wrote: >I am not joking about that. It is more the hype this gets that indicates >TimSort is already broken today, and even on your cell phone. > But it IS broken.The only hype I'm witnessing is this fantasy created by some that there's a hype

Re: Bug in timsort!?

2015-02-25 Thread Mario Figueiredo
On Wed, 25 Feb 2015 17:04:10 +0100, Peter Otten <__pete...@web.de> wrote: > >These guys found a bug that is subtler than what most of us have dealt with >in a widely used piece of code originally developed by one of the smarter >members of the python "community". > >I bow my head to them and say

py.test can't resolve imports

2015-02-24 Thread Mario Figueiredo
I cannot seem to solve this problem from either the pytest documentation or from other places on the web which provide tutorials on pytest, such as http://pythontesting.net/start-here/ I have the following project setup: /project /project/project<-- script files (with __init__.py)

Re: try pattern for database connection with the close method

2015-02-22 Thread Mario Figueiredo
On Sat, 21 Feb 2015 16:22:36 +0100, Peter Otten <__pete...@web.de> wrote: > >Why would you care about a few lines? You don't repeat them, do you? Put the >code into a function or a context manager and invoke it with Thanks for the suggestions that followed. -- https://mail.python.org/mailman/li

Re: try pattern for database connection with the close method

2015-02-22 Thread Mario Figueiredo
On Sun, 22 Feb 2015 13:15:09 -0600, Skip Montanaro wrote: > >Sorry, I haven't paid careful attention to this thread, so perhaps >this has already been suggested, however... Can't you write your own >class which delegates to the necessary sqlite3 bits and has a context >manager with the desired be

Re: try pattern for database connection with the close method

2015-02-22 Thread Mario Figueiredo
On Sun, 22 Feb 2015 19:07:03 +, Mark Lawrence wrote: > >Looks like you're correct. Knock me down with a feather, Clevor Trevor. It took me by surprise when I first encountered it too. The rationale apparently is that the context manager is strictly a transactional feature, allowing for mult

Re: try pattern for database connection with the close method

2015-02-22 Thread Mario Figueiredo
On Sat, 21 Feb 2015 12:22:58 +, Mark Lawrence wrote: > >Use your context manager at the outer level. > >import sqlite3 as lite > >try: > with lite.connect('data.db') as db: > try: > db.execute(sql, parms) > except lite.IntegrityError: > raise ValueError('invalid da

try pattern for database connection with the close method

2015-02-20 Thread Mario Figueiredo
Hello all, I'm using the following pattern for db access that requires me to close the connection as soon as it is not needed: import sqlite3 as lite try: db = lite.connect('data.db') except lite.DatabaseError: raise OSError('database file corrupt

Re: 'Lite' Databases (Re: sqlite3 and dates)

2015-02-19 Thread Mario Figueiredo
On Thu, 19 Feb 2015 12:26:04 -0800 (PST), ru...@yahoo.com wrote: > >I'll point out that five people in this thread (by my >count) have said that Postgresql requires a significant >amount of work to setup and use. Only you and Steven claim >the opposite. Well, I claim the opposite too. >Or I c

Re: python implementation of a new integer encoding algorithm.

2015-02-19 Thread Mario Figueiredo
On Thu, Feb 19, 2015 at 11:28 AM, Mark Lawrence wrote: > > No thanks as I won't be able to find any more candidates for my dream team. > > I'm glad you like me here. -- https://mail.python.org/mailman/listinfo/python-list

Re: python implementation of a new integer encoding algorithm.

2015-02-19 Thread Mario Figueiredo
On Thu, Feb 19, 2015 at 9:06 AM, Mark Lawrence wrote > > > The opinions being expressed seem to be along the lines of "reinventing > round wheels is a waste of time. Reinventing square or even triangular > wheels is really pointless". > You obviously don't value the word 'exercise'. > If you d

Re: 'Lite' Databases (Re: sqlite3 and dates)

2015-02-18 Thread Mario Figueiredo
On Thu, 19 Feb 2015 03:43:36 +, Mark Lawrence wrote: >After a wonderful relationship lasting many happy years I dumped Firefox >a few weeks ago for Chrome. A few anxious moments gave me pause for >thought, but overall I'm happy to have changed. However is anybody >aware of a "new kid on t

Re: python implementation of a new integer encoding algorithm.

2015-02-18 Thread Mario Figueiredo
A lot of patronizing egos running around in these groups. This is a sad thread... What is being asked is for help, not whether this is useful or needed. Jan-Hein is after some directions, not whether your bloody opinion on how he should use his free time. If the interest and usability of a projec

Re: 'Lite' Databases (Re: sqlite3 and dates)

2015-02-18 Thread Mario Figueiredo
On Thu, 19 Feb 2015 18:22:57 +1300, Gregory Ewing wrote: > >How does sqlite3 miss parameterized queries? It supports >DB-API parameter subsitution with '?' according to the >docs. It's actually parameterized views that I meant. Not queries. SQLite misses the ability to write parameterized views.

Re: 'Lite' Databases (Re: sqlite3 and dates)

2015-02-18 Thread Mario Figueiredo
On Wed, 18 Feb 2015 15:32:36 -0800, memilanuk wrote: > >Is there anything *good* that sits in between the two extremes of SQLite >and PostgreSQL? > >I've tinkered with MySQL years ago (in conjunction with PHP) and was a >little unhappy with some of the things MariaDB is backwards compatible wi

Re: Help setting up Sphinx

2015-02-16 Thread Mario Figueiredo
On Tue, 17 Feb 2015 00:55:29 +0100, Mario Figueiredo wrote: > >What am I missing in order to get item.py properly parsed by sphinx? Nevermind. I found the problem. In order to document the source code it needs to be used in conjunction with sphinx-apidoc. -- https://mail.python.org/m

Help setting up Sphinx

2015-02-16 Thread Mario Figueiredo
I answered the prompts: > Root path for the documentation [.]: docs > Separate source and build directories (y/n) [n]: > Name prefix for templates and static dir [_]: > Project name: SmUDGE > Author name(s): Mario Figueiredo > Project version: 0.1 > Project release [0.1]: > So

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Mario Figueiredo
On Tue, 17 Feb 2015 01:11:01 +1100, Chris Angelico wrote: >So what you have here is not "super() is weird", but "multiple >inheritance is messy, and this is how Python handles it". > I'd say the diamond pattern is messy. MI is otherwise a pretty peaceful kid without it. I don't find the C3 line

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Mario Figueiredo
On Mon, 16 Feb 2015 08:14:00 -0500, Roy Smith wrote: >In article , > Mario Figueiredo wrote: > >> It's not been an easy ride trying to decide whether or not to use super. >> I started learning python from a Mark Lutz book that advised me against >> it. > &g

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Mario Figueiredo
In article <54e14cfe$0$12997$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > If this is a type error, why aren't you using TypeError? Or at least > inheriting from TypeError? > Yeah. It's not that I'm gaining much from that abstraction. It's not even an ab

Flagging classes as not intended for direct initialization

2015-02-15 Thread Mario Figueiredo
Hello everyone, [Python 3.X] I have the following factory model for the initialization of a class tree (code abbreviated for simplicity). # item.py class BadItemType(Exception): pass class Item: def __init__(self, _data): class Container(Item): def __init__(self, _data): I

Re: Dictionary from sqlite3.Row and PyCharm unresolved reference

2015-02-13 Thread Mario Figueiredo
In article , __pete...@web.de says... > > self.data = dict(row) I didn't realize from the documentation it could be this simple. Thanks. > > And now an unsolicited remark: if you have more than one instance of Unknown > you might read the data outside the initialiser or at least keep the > c

Dictionary from sqlite3.Row and PyCharm unresolved reference

2015-02-13 Thread Mario Figueiredo
Currently i'm using the following code to transform a row fetched from an sqlite database into a dictionary property: def __init__(self, id_): self.id = id_ self.data = None ... conn = sqlite3.connect('data') conn.row_factory = sqlite3.Row row = conn.

Re: Python is DOOMED! Again!

2015-01-30 Thread Mario Figueiredo
In article , breamore...@yahoo.co.uk says... > > No, they're not always weakly typed. The aim of the spreadsheet put up > by Skip was to sort out (roughly) which languages belong in which camp. > I do not regard myself as suitably qualified to fill the thing out. > Perhaps by now others hav

Re: Python is DOOMED! Again!

2015-01-30 Thread Mario Figueiredo
In article <54ca5bbf$0$12992$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > > Why should I feel guilty? You wrote: > > > "Static analysis cannot and should not clutter executable code." > > > But what are type declarations in statically typed languages

Re: Python is DOOMED! Again!

2015-01-30 Thread Mario Figueiredo
In article <54ca5bbf$0$12992$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > Why should I feel guilty? You wrote: > > > "Static analysis cannot and should not clutter executable code." > > > But what are type declarations in statically typed languages lik

  1   2   >