Re: Relaxed, or best-efforts JSON parser for Python?

2015-10-11 Thread Random832
Victor Hooi writes: > My question, is there a more lenient, or relaxed JSON parser available > for Python, that will try to do a best-efforts parsing of non-spec > JSON? In an answer to a similar question on StackExchange, using YAML was suggested. http://stackoverflow.com/questions/9104930 Is

Re: Strong typing implementation for Python

2015-10-11 Thread Michael Torrie
On 10/11/2015 06:34 PM, Steven D'Aprano wrote: > That's called type inference, and there's nothing innovative about Swift to > include that as a feature. Type inference is *old*. The theory behind type > inference goes back to 1958, and languages such as ML and OCaml have > included it for decades,

Re: Relaxed, or best-efforts JSON parser for Python?

2015-10-11 Thread MRAB
On 2015-10-12 01:56, Victor Hooi wrote: Hi, I'm attempting to parse MongoDB loglines. The formatting of these loglines could best be described as JSON-like... For example - arrays Anyhow, say I had the following logline snippet: { Global: { acquireCount: { r: 2, w: 2 } }, Database: { ac

Relaxed, or best-efforts JSON parser for Python?

2015-10-11 Thread Victor Hooi
Hi, I'm attempting to parse MongoDB loglines. The formatting of these loglines could best be described as JSON-like... For example - arrays Anyhow, say I had the following logline snippet: { Global: { acquireCount: { r: 2, w: 2 } }, Database: { acquireCount: { w: 2 } }, Collection: { acq

Re: Strong typing implementation for Python

2015-10-11 Thread Steven D'Aprano
On Mon, 12 Oct 2015 10:24 am, Vladimir Ignatov wrote: > Hi, > >> You might like to investigate Boo, which is a .NET-based >> language with a Python-like syntax: > > AFAIK Unity just dropped Boo support from version 5.0 because > virtually nobody used it. What's Unity? I've never heard of it. Wh

Re: How do I extend a class that I never instantiate myself?

2015-10-11 Thread Chris Angelico
On Mon, Oct 12, 2015 at 10:09 AM, wrote: > On Saturday, October 10, 2015 at 11:32:24 PM UTC-7, Chris Angelico wrote: >> If you REALLY want to look like Ruby, > > Ha! This thread has provided so many interesting monkey-patching techniques, > but this might be the most perverse. Very cute. Thank

Re: Strong typing implementation for Python

2015-10-11 Thread Vladimir Ignatov
Hi, > You might like to investigate Boo, which is a .NET-based > language with a Python-like syntax: AFAIK Unity just dropped Boo support from version 5.0 because virtually nobody used it. Those little known niche languages are destined to extinct. Interesting language is Apple's Swift. While it

Re: How do I extend a class that I never instantiate myself?

2015-10-11 Thread speeze . pearson
On Saturday, October 10, 2015 at 11:32:24 PM UTC-7, Chris Angelico wrote: > If you REALLY want to look like Ruby, Ha! This thread has provided so many interesting monkey-patching techniques, but this might be the most perverse. Very cute. -- https://mail.python.org/mailman/listinfo/python-list

Re: Strong typing implementation for Python

2015-10-11 Thread Gregory Ewing
On 9 October 2015 at 17:26, John Michael Lafayette wrote: I would like Python to also be able to also do this: Animal a = Factory.make("dog")# okay. Dog is Animal. Dog d = Factory.make("dog") # okay. Dog is Dog. Cat c = Factory.make("cat") # Runtime error. Dog is

Re: How do I extend a class that I never instantiate myself?

2015-10-11 Thread speeze . pearson
On Saturday, October 10, 2015 at 3:55:17 PM UTC-7, Steven D'Aprano wrote: > # Solution 1: inject a new method into each and every instance in the tree. > > node.foo = MethodType(foo, node) Ooh, interesting. I'll meditate on that for a while. > # Solution 2: hack the node type of each instanc

Re: How do I extend a class that I never instantiate myself?

2015-10-11 Thread speeze . pearson
On Saturday, October 10, 2015 at 10:40:15 AM UTC-7, Ian wrote: > name mangling Awesome! I didn't know this was a feature. > There's nothing wrong with [functional programming] IMO. In fact, Python > does this in the standard library, e.g. len(objects) rather than > objects.len(). ...good point.

Re: Static typing implementation for Python

2015-10-11 Thread Ben Finney
Random832 writes: > Ben Finney writes: > > The opposite of string typing is weak typing. > > Well, I would say *string* typing [as used in, for example, sh and tcl] > is actually a form of weak typing. I infer a smile as you write that, but to clarify for others: I made a typo, and meant to con

Re: Static typing implementation for Python

2015-10-11 Thread Chris Angelico
On Mon, Oct 12, 2015 at 8:33 AM, Random832 wrote: > Ben Finney writes: >> The opposite of string typing is weak typing. > > Well, I would say *string* typing [as used in, for example, sh and tcl] > is actually a form of weak typing. But anyway, the other issue is that > strong typing is meaningle

Re: Static typing implementation for Python

2015-10-11 Thread Random832
Ben Finney writes: > The opposite of string typing is weak typing. Well, I would say *string* typing [as used in, for example, sh and tcl] is actually a form of weak typing. But anyway, the other issue is that strong typing is meaningless. In general it seems like weak typing means "the existence

Re: Strong typing implementation for Python

2015-10-11 Thread gal kauffman
> You can run your code inside a class definition, abuse metaclassing to replace the namespace with yourown dict and override the __setitem__ function. Then you can implement a var function so it inspect into it's caller namespace, and inserts the given key into it. This hack doesn't apply on any s

Re: Strong typing implementation for Python

2015-10-11 Thread Matt Wheeler
On 9 October 2015 at 17:26, John Michael Lafayette wrote: > I would like Python to have a strong typing feature that can co-exist with > the current dynamic typing system. Currently Python is like this: > > var animal = Factory.make("dog") # okay. > var dog = Factory.make("dog") # o

Re: Problem with Python 3.5.0

2015-10-11 Thread Matt Wheeler
On 11 October 2015 at 18:12, eetix letix wrote: > Hi, > > I'm sorry but the last version of Python (3.5.0) had a problem. I start and > I meet this problem : > a=5 if a>0: > . . . print("a is a positive.") > . . . if a<0: > ^ > SyntaxError: invalid syntax > > Normally

Re: Problem with Python 3.5.0

2015-10-11 Thread Vincent Vande Vyvre
Le 11/10/2015 19:12, eetix letix a écrit : Hi, I'm sorry but the last version of Python (3.5.0) had a problem. I start and I meet this problem : >>>a=5 >>>if a>0: . . . print("a is a positive.") . . . if a<0: ^ SyntaxError: invalid syntax >>> Normally this should work but pr

Re: Problem with Python 3.5.0

2015-10-11 Thread Joel Goldstick
On Sun, Oct 11, 2015 at 1:12 PM, eetix letix wrote: > Hi, > > I'm sorry but the last version of Python (3.5.0) had a problem. I start > and I meet this problem : > > >>>a=5 > >>>if a>0: > . . . print("a is a positive.") > . . . if a<0: > ^ > SyntaxError: invalid syntax > >>> > No

Re: Problem encountered using v3.5

2015-10-11 Thread Laura Creighton
In a message of Sat, 10 Oct 2015 16:16:14 -0700, Ben S writes: >http://stackoverflow.com/questions/33041621/python-attributeerror-when-calling-nltk-brown-corpus > >I am going to install the 32 bit python v3.5 to see if that works. > >Thanks, >Ben This looks like this nltk bug. https://github.com/

Re: installation Python

2015-10-11 Thread Joel Goldstick
On Sun, Oct 11, 2015 at 10:13 AM, Zrinko Budimir wrote: > Hi, > > What is the difference between Python 3.5.0 and 3.5.0rc4? > What is rc4? > > -- > Zrinko Budimir > > -- > https://mail.python.org/mailman/listinfo/python-list > > rc = release candidate. If the final version is available, use that

installation Python

2015-10-11 Thread Zrinko Budimir
Hi, What is the difference between Python 3.5.0 and 3.5.0rc4? What is rc4? -- Zrinko Budimir -- https://mail.python.org/mailman/listinfo/python-list

Problem with Python 3.5.0

2015-10-11 Thread eetix letix
Hi, I'm sorry but the last version of Python (3.5.0) had a problem. I start and I meet this problem : >>>a=5 >>>if a>0: . . . print("a is a positive.") . . . if a<0: ^ SyntaxError: invalid syntax >>> Normally this should work but problem

Problem encountered using v3.5

2015-10-11 Thread Ben S
Working on a Windows 7 64 bit machine, I installed 64 bit python v3.5. Was able to pip install a number of basic packages like numpy, pyamml, and nltk (off the Christoph Gohlke page). Did not test numpy or the other packages too much, but did explore nltk and encountered major flaw: Much of the f

Re: Understanding WSGI together with Apache

2015-10-11 Thread Peter Otten
Johannes Bauer wrote: > I'm seeing some weird crosstalk between them which I do not understand. > In particular, crosstalk concerning the locales of the two. One > application needs to output, e.g., date information using a German > locale. It uses locale.setlocale to set its LC_ALL to de_DE.UTF-8