Re: Trees

2015-01-19 Thread Mario Figueiredo
In article , zacharygilmar...@gmail.com says... > > Why aren't there trees in the python standard library? I don't know much about python development process and strategies, but I suspect it shouldn't be much different from any other language I know of. So here's my tentative answer: Once gen

Re: Trees

2015-01-21 Thread Mario Figueiredo
Hello Terry, It is not play with words. A tree is a recursive - nested - hierachical data structure with the restriction of no cycles or alternate pathways. Python collections whose members are general objects, including collections, can be nested. The resulting structures *are* tree structures

Re: How to "wow" someone new to Python

2015-01-21 Thread Mario Figueiredo
Chris, Scenario: You're introducing someone to Python for the first time. S/he may have some previous programming experience, or may be new to the whole idea of giving a computer instructions. You have a couple of minutes to show off how awesome Python is. What do you do? Some ideas where give

Re: How to "wow" someone new to Python

2015-01-21 Thread Mario Figueiredo
In article , alan@scooby- doo.csail.mit.edu says... > Even in a 64-bit Java, the _type_ returned by String.length() is > 'int', and is thus at most (2**31 - 1). This isn't a problem for > strings, which never get that long in practice, but for some other > Java datatypes (e.g., Buffer) it is a rea

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Mario Figueiredo
In article , ros...@gmail.com says... > > Bad idea. Better to pick a language that makes it easy to get things > right, and then work on the fun side with third-party libraries, than > to tempt people in with "hey look how easy it is to do X" and then > have them stuck with an inferior or flawed

Re: What killed Smalltalk could kill Python

2015-01-21 Thread Mario Figueiredo
In article <873873ae91@jester.gateway.sonic.net>, no.email@nospam.invalid says... > > Steven D'Aprano writes: > > In 2009, Robert Martin gave a talk at RailsConf titled "What Killed > > Smalltalk Could Kill Ruby"... http://www.youtube.com/watch?v=YX3iRjKj7C0 > > That's an hour-long video;

Re: Python is DOOMED! Again!

2015-01-22 Thread Mario Figueiredo
In article <54c0a571$0$13002$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > The point isn't that there are no other alternative interpretations > possible, or that annotations are the only syntax imaginable, but that > they're not hard to guess what they m

Re: Python is DOOMED! Again!

2015-01-22 Thread Mario Figueiredo
Rick, Python is the only thing that is pure in the programming world. The only language that offers the cleanest and most intuit-able syntax, AND YOU"RE JUST GOING TO THROW IT ALL AWAY SO YOU CAN BE A LAPDOG OF SATAN? Nonsense. You are just used to it. I can read C with the same feeling of in

Re: Python is DOOMED! Again!

2015-01-22 Thread Mario Figueiredo
Chris, Hold on a moment, how often do you really do this kind of thing with "might be one of them or a sequence"? Is it really that important that I give a more real-life example, or can't you just get the problem from a ad-hoc example? I could replace the variable names with spam, ham and

Re: Python is DOOMED! Again!

2015-01-22 Thread Mario Figueiredo
Chris, I'd rather see a real-world example that can't be solved with either better design or some simple aliases. (And yes, the type hinting does allow for aliases.) Python is a duck-typing language, Chris. It is in its nature -- and we have been taught -- to ignore types and care only about

Re: Python is DOOMED! Again!

2015-01-22 Thread Mario Figueiredo
Chris, On Thu, Jan 22, 2015 at 9:46 PM, Nicholas Cole wrote: Hang on! The particular example may not make a lot of sense but there are plenty of places in ordinary Python where functions can accept different objects in arguments and return different things. The point here is that that will be

Re: Python is DOOMED! Again!

2015-01-22 Thread Mario Figueiredo
In article , random...@fastmail.us says... > How is that the opposite direction? It's a short jump from there to > "pylint [or whatever tool] will consider a lack of type hinting to be > something to warn for" and "managers/customers will consider this > warning to mean your program has failed and

Re: Python is DOOMED! Again!

2015-01-22 Thread Mario Figueiredo
In article , sturla.mol...@gmail.com says... > > On 22/01/15 20:10, Mario Figueiredo wrote: > > > Customers don't have access to static analysis output and project > > managers should know better than to demand static analysis without > > properly contextualiz

Re: Python is DOOMED! Again!

2015-01-22 Thread Mario Figueiredo
In article , rantingrickjohn...@gmail.com says... > python was meant to be a gateway to intuitive programming bliss. > Python was meant to be the "lingua franca" of the Programming world. And it failed miserably on both instances. Like any other programming language before and after it which p

Re: Python is DOOMED! Again!

2015-01-22 Thread Mario Figueiredo
In article <6eb91c4b-92ff-44a8-b5a9-6ef04c71f...@googlegroups.com>, rantingrickjohn...@gmail.com says... > > So if the purpose is "static analysis", what is the > justification for injecting new syntax into function sigs? 1. Annotations where created exactly for this purpose. So there's some pr

Re: Python is DOOMED! Again!

2015-01-22 Thread Mario Figueiredo
In article , ian.g.ke...@gmail.com says... > > On Thu, Jan 22, 2015 at 3:27 PM, Chris Kaynor > wrote: > > Or use Any, which is basically the same thing: > > > > def adder(a: Any, b: Any) -> Any: > > return a + b > > Yeah, but this just seems like extra noise since it's not going to > help

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-23 Thread Mario Figueiredo
In article <5afad59b-5e8c-4821-85cf-9e971c8c7...@googlegroups.com>, rantingrickjohn...@gmail.com says... > > On Thursday, January 22, 2015 at 10:04:29 PM UTC-6, Chris Angelico wrote: > > > It's worth pointing out, too, that the idea isn't > > panaceaic - it's just another tool in the box. Any ti

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-23 Thread Mario Figueiredo
In article <12d74fb6-f7d7-4ff0-88d3-6076a5dc7...@googlegroups.com>, rantingrickjohn...@gmail.com says... > > Injecting polarity into debates is dangerous, because, then > we get off into the emotional weeds and a solution may never > be found -- just observe the polarization of American > politic

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-23 Thread Mario Figueiredo
In article <4b3b498a-c9b0-443d-8514-87ccd8e98...@googlegroups.com>, rantingrickjohn...@gmail.com says... > > (Example modified for PEP8 compliance ;-) > > @typehint(arg1:str, arg2:int, returns:bool) > def myfunction(arg1, arg2): > return True > > Of course "@typehi

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-23 Thread Mario Figueiredo
In article , mar...@gmail.com says... > > > So I'd rather see: > > def myfunction(arg1, arg2): > """ > Normal docstring. > """ > "@typehint: (str, int) -> bool" > return True > Actually that is idiotic. Much better is: def myfunction(arg1, arg2):

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-23 Thread Mario Figueiredo
In article , sohcahto...@gmail.com says... > > > def myfunction(arg1, arg2): > > """ > > Normal docstring... > > @typehint: (str, int) -> bool > > """ > > return True > > > > I really like that implementation. > > Its unobtrusive and doesn't clutter th

Re: Python is DOOMED! Again!

2015-01-24 Thread Mario Figueiredo
Steven D'Aprano, Rick, you seem to be under the misapprehension that a reductio ad absurdum argument is a fallacy. It is not. From Webster's dictionary: Indirect demonstration, or Negative demonstration (called also reductio ad absurdum), in which the correct conclusion is an inference from the

__bases__ misleading error message

2015-01-24 Thread Mario Figueiredo
Consider the following code at your REPL of choice class Super: pass class Sub: pass foo = Sub() Sub.__bases__ foo.__bases__ The last statement originates the following error: AttributeError: 'Sub' object has no attribute '__ba

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-24 Thread Mario Figueiredo
In article <54c39e48$0$12996$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > I'm not sure if you're making a general observation or one which is > specific > to Python. Plenty of languages have static analysis as a language feature. > Are you arguing they are

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-24 Thread Mario Figueiredo
In article , mar...@gmail.com says... > > In article <54c39e48$0$12996$c3e8da3$54964...@news.astraweb.com>, > steve+comp.lang.pyt...@pearwood.info says... > > > > def myfunction(arg1, arg2): > > """ > > Normal docstring. > > @typehint: (str, int) -> bool""" > > return True > >

Re: __bases__ misleading error message

2015-01-24 Thread Mario Figueiredo
In article , tjre...@udel.edu says... > > AttributeError: 'Sub' object has no attribute '__bases__' > > In this message, 'Sub' is an adjective, modifying 'object, not naming > it. If you attend to the last line of the traceback > My first reaction is to look at 'Sub' as a noun, not an

Re: __bases__ misleading error message

2015-01-24 Thread Mario Figueiredo
In article <54c39366$0$13006$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > AttributeError: 'Sub' instance has no attribute '__bases__', > > AttributeError: 'foo' object has no attribute '__bases__' > > The first would be nice. The second is

Re: __bases__ misleading error message

2015-01-24 Thread Mario Figueiredo
In article , tjre...@udel.edu says... > > > "__main__" > > from module import a_name > > A module is a namespace associating names with objects. This statememt > says to import the a_name to object association from module and add it > to __main__ > > > y = a_name + 1 > > This

Re: __bases__ misleading error message

2015-01-24 Thread Mario Figueiredo
In article , ian.g.ke...@gmail.com says... > > On Sat, Jan 24, 2015 at 2:14 PM, Mario Figueiredo wrote: > > But that begs the OT question: > > No, it doesnt. http://en.wikipedia.org/wiki/Begging_the_question Cute. > I'm not sure I'm understanding wha

Re: __bases__ misleading error message

2015-01-24 Thread Mario Figueiredo
In article , ros...@gmail.com says... > > Let me explain by way of analogy. [snipped] Gotcha! Thanks for the explanation :) -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-24 Thread Mario Figueiredo
In article <54c2299d$0$13005$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > I don't think that a raise of 0.10001 (10%), > 0.035003 (3.5%) or 0.070007 (7%) is quite what > people intended. > > (Don't use binary floating p

Re: __bases__ misleading error message

2015-01-24 Thread Mario Figueiredo
In article , ian.g.ke...@gmail.com says... > > No, you're being told that the *object* doesn't know the names of the > variables that it's bound to. In the context above, the variable is > right there under that name in the globals dict, as can be seen in the > disassembly: [snipped] Yes. I got

Re: __bases__ misleading error message

2015-01-24 Thread Mario Figueiredo
In article , ros...@gmail.com says... > Awesome! I'm always a bit wary of analogies... sometimes they're > really helpful, other times they're unhelpful and confusing. Yeah. Your's was all it took :) The thing with analogies is to never take them literally. They are analogies, after all. But th

Re: Python is DOOMED! Again!

2015-01-24 Thread Mario Figueiredo
In article , ros...@gmail.com says... > > On Sun, Jan 25, 2015 at 10:20 AM, Rick Johnson > wrote: > > Besides, why does he need *ME* to lick his boots when he > > already has plenty of fan-boys over at python-ideas and > > python-dev lining up. This community is *NOT*, and should > > never be, a

Re: __bases__ misleading error message

2015-01-25 Thread Mario Figueiredo
In article <54c4606a$0$13002$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > It doesn't. Your explanation was great Steven. Thank you. But raises one question... > > Assigning a value to a variable ("m = 42", hex 2A) results in the compiler > storing that

Re: __bases__ misleading error message

2015-01-25 Thread Mario Figueiredo
In article <54c4dae1$0$13005$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > [...] Most excellent. Thanks for the hard work, explaining this to me. :) Knowing Python internals is something that will end benefiting me in the long run. There's much to be gained

Object destruction delayed on interactive prompt

2015-01-25 Thread Mario Figueiredo
Consider the following class: class A: def __init__(self, value): self.value = value def __del__(self): print("'A' instance being collected...") def __repr__(self): return str(self.value) If ran as a script, the destructor behavior

Re: Object destruction delayed on interactive prompt

2015-01-25 Thread Mario Figueiredo
In article , mar...@gmail.com says... > [...] Forgot to mention this is Python 3.4.2 -- https://mail.python.org/mailman/listinfo/python-list

Re: Object destruction delayed on interactive prompt

2015-01-25 Thread Mario Figueiredo
In article , pyt...@mrabarnett.plus.com says... > In the REPL, the result of an expression is bound to '_': > > >>> x1 = A(12) > >>> x1 # _ will be bound to the result. > 12 > >>> x1 = 'string' > >>> # At this point, _ is still bound to the object. > >>> 0 # This will bind _ to another objec

Re: Python is DOOMED! Again!

2015-01-27 Thread Mario Figueiredo
In article , random...@fastmail.us says... > > On Mon, Jan 26, 2015, at 19:11, Steven D'Aprano wrote: > > random...@fastmail.us wrote: > > - lexical analysis has to look for twice as many files (it has to > > hit the hard drive for a stub file before looking at the source), > > and we know f

Re: Is there a more elegant way to spell this?

2015-01-27 Thread Mario Figueiredo
In article , jpiit...@ling.helsinki.fi says... > > If you mean literally some_predicate, then perhaps this. > > if some_predicate: >for x in seq: > handle(x) > Careful. See Chris Warrick answer for the correct position of the 'if' statement. -- https://mail.python.org/mailman/listi

An object is an instance (or not)?

2015-01-27 Thread Mario Figueiredo
This is a follow up from a previous discussion in which it is argued that the following code produces the correct error message terminology, considering that in Python an object is also an instance. >>> class Sub: >>> pass >>> foo = Sub() >>> foo.__bases__ [...]

Re: Python is DOOMED! Again!

2015-01-27 Thread Mario Figueiredo
In article , ros...@gmail.com says... > > On Wed, Jan 28, 2015 at 4:59 AM, Mario Figueiredo wrote: > > An optional feature says nothing of its requirements. The requirements > > for PEP 484 are heavy. Not only will they force an update to the > > interpreter, but will

Re: An object is an instance (or not)?

2015-01-27 Thread Mario Figueiredo
In article <80a9f882-6b13-45a7-b514-8c47b3a4c...@googlegroups.com>, andre.robe...@gmail.com says... > > You keep writing "an object is not an instance", making statements > such as "the terminology keeps indicating that in Python an object is > an instance" and yet, none of the examples you show

Re: Python is DOOMED! Again!

2015-01-27 Thread Mario Figueiredo
In article , ros...@gmail.com says... > > On Wed, Jan 28, 2015 at 7:58 AM, Mario Figueiredo wrote: > > Looking at PEP 3107, i'm left wondering: what if I have for instance > > already annotated my functions for parameter marshalling, following the > > syntax expe

Re: Python is DOOMED! Again!

2015-01-27 Thread Mario Figueiredo
In article , ros...@gmail.com says... > > Sure you can! But this is *itself* a weak argument, unless you > actually have a codebase that uses it. Wait. Are you saying that unless I show you a codebase that requires marshalling and static analysis, you will ignore the fact that a project, no ma

Re: Python is DOOMED! Again!

2015-01-27 Thread Mario Figueiredo
I can now start to understand the criticism of how Python is evolving coming from many corners, either long term python educators like Mark Lutz. -- https://mail.python.org/mailman/listinfo/python-list

Re: An object is an instance (or not)?

2015-01-27 Thread Mario Figueiredo
In article , andre.robe...@gmail.com says... > > It is appropriate to refer to an instance as an object. It might not > be appropriate to refer to an object as an instance ... but Python > does not do so as your explicit examples demonstrate, and contrary to > your claim. I'll try one more ti

Re: An object is an instance (or not)?

2015-01-27 Thread Mario Figueiredo
In article <9a2cf6ca-2eb8-4a87-9e83-e87d90d5f...@googlegroups.com>, andre.robe...@gmail.com says... > > **This is a follow up from a previous discussion in which it is argued > that the following code produces the correct error message terminology ** > > I pointed out to you that the word objec

Re: An object is an instance (or not)?

2015-01-27 Thread Mario Figueiredo
In article , n...@nedbatchelder.com says... > > A common mistake is to believe that "OOP" is a well-defined term. It's > not it's a collection of ideas that are expressed slightly differently > in each language. A common mistake is thinking just because OOP has different implementations, it

Re: An object is an instance (or not)?

2015-01-27 Thread Mario Figueiredo
In article , ben+pyt...@benfinney.id.au says... > > > This is why I say that even in Python, where a class is an object, > > > an object is not always an instance. The language itself forces that > > > distinction. > > You have not, to my knowledge, shown any object (in Python 2.2 or later) > whi

Re: An object is an instance (or not)?

2015-01-27 Thread Mario Figueiredo
In article , ros...@gmail.com says... > > On Wed, Jan 28, 2015 at 10:22 AM, Ned Batchelder > wrote: > > I don't know what the difference is between "object" and "instance". An > > object is an instance of a class. The two words are interchangeable as far > > as I know. > > My understanding i

Re: An object is an instance (or not)?

2015-01-27 Thread Mario Figueiredo
In article , ros...@gmail.com says... > > On Wed, Jan 28, 2015 at 11:17 AM, Mario Figueiredo wrote: > > Means the object is capable of participating in inheritance and/or > > polymorphism. An instance of an object is capable of doing so, per its > > class definitions

Re: An object is an instance (or not)?

2015-01-27 Thread Mario Figueiredo
In article , breamore...@yahoo.co.uk says... > > Mario and Andre, when you have to write code to meet the deadline to get > the stage payment, does either of your bosses really care whether or not > you are dealing with an object, an instance, or a piece of dead meat > dropped by the neighbour

Re: An object is an instance (or not)?

2015-01-27 Thread Mario Figueiredo
In article , ben+pyt...@benfinney.id.au says... > > Mario Figueiredo writes: > > > It is true that a class object is an instance of 'type'. But this is a > > special type (can't avoid the pun). > > Nevertheless it is a class, and can do everything t

Re: Is there a more elegant way to spell this?

2015-01-27 Thread Mario Figueiredo
In article <54c8339f$0$13008$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > (3) _ is also commonly used as a "don't care" variable name: > > a, _, b, _ = get_four_items() # but I only care about two of them > According to the following link, it is actually

Re: Is there a more elegant way to spell this?

2015-01-28 Thread Mario Figueiredo
In article , ben+pyt...@benfinney.id.au says... > > More accurately (and as acknowledged in that guide), a single underscore > *is* a common name for a ?don't care? name, but is better avoided for > that purpose because it's also commonly used for other purposes. > > In other words: That guide i

Re: An object is an instance (or not)?

2015-01-28 Thread Mario Figueiredo
In article , breamore...@yahoo.co.uk says... > > The thing that bothers me is that many people, some of them with maybe > 20 years of Python experience, have repeatedly stated Python concepts > with respect to the terms class, instance and object. Instead of > accepting their knowledge of the

Re: Python is DOOMED! Again!

2015-01-28 Thread Mario Figueiredo
In article <54c83ab4$0$12982$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > Mario Figueiredo wrote: > > > Static analysis cannot and should not clutter executable code. > > (1) It isn't clutter. The human reader uses

Re: Python is DOOMED! Again!

2015-01-29 Thread Mario Figueiredo
In article , breamore...@yahoo.co.uk says... > > C and C++ are weakly and statically typed languages. Python is a > strongly and dynamically typed language. Therefore anything following > based on the above paragraph alone is wrong. > Indeed. I confused strongly/weakly with static. I feel a

Re: Python is DOOMED! Again!

2015-01-29 Thread Mario Figueiredo
In article <54c980cd$0$12981$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > Ian, that's obvious. Just open your eyes: > > Scala > def addInt( a:Int, b:Int ) : Int > > Python > def addInt( a:int, b:int ) -> int: > > > They're COMPLETELY different. In Scal

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

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

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

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

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

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

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

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

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

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

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

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

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

  1   2   >