Dynamic query in mongodb and variable

2016-07-11 Thread MG
Ciao, I have this function: def lockup_info(refer): info = [] amb = CONN.db..find({"reference": refer} for a in amb: print a How can I pass this value { "$exists": False } and tell python to not consider it as a string? var = '{ "$exists": Fals

Program outlining

2016-07-11 Thread Rustom Mody
Ive been trying to figure out the best outlining that emacs can give for programs. Outline-mode seems to be more for text than code Outshine mode inspired by above+org-mode seemed promising in that it seems to make org mode's wonderful TAB-behavior work for code. But I couldn’t get it to work So

Re: Program outlining

2016-07-11 Thread Rustom Mody
On Monday, July 11, 2016 at 6:26:01 PM UTC+5:30, Rustom Mody wrote: > Ive been trying to figure out the best outlining that emacs can give for > programs. Oops sorry! Wrong list!! -- https://mail.python.org/mailman/listinfo/python-list

Re: Dynamic query in mongodb and variable

2016-07-11 Thread Chris Angelico
On Mon, Jul 11, 2016 at 10:52 PM, MG wrote: > Ciao, > I have this function: > > > def lockup_info(refer): > info = [] > amb = CONN.db..find({"reference": refer} > for a in amb: > print a > > > > How can I pass this value { "$exists": False } and tell pyt

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Ian Kelly
On Sun, Jul 10, 2016 at 6:34 PM, Lawrence D’Oliveiro wrote: > On Sunday, July 10, 2016 at 7:22:42 PM UTC+12, Ian wrote: >> On Sat, Jul 9, 2016 at 11:54 PM, Lawrence D’Oliveiro wrote: >>> In printf-style formats, you can specify the number of digits for an >>> integer separately from the field widt

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Steven D'Aprano
On Tue, 12 Jul 2016 01:04 am, Ian Kelly wrote: > On Sun, Jul 10, 2016 at 6:34 PM, Lawrence D’Oliveiro > wrote: >> On Sunday, July 10, 2016 at 7:22:42 PM UTC+12, Ian wrote: >>> On Sat, Jul 9, 2016 at 11:54 PM, Lawrence D’Oliveiro wrote: In printf-style formats, you can specify the number of d

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Ethan Furman
On 07/11/2016 09:28 AM, Steven D'Aprano wrote: On Tue, 12 Jul 2016 01:04 am, Ian Kelly wrote: Er, what? I count *five* digits in "00123", not three. You seem to be assuming that "precision" can only refer to digits after the decimal place, but that's a dubious proposition. I will readily ad

Touch screen development in Python

2016-07-11 Thread Jahn
Hi , Does anyone use Python for developping applications that work with a touch screen? --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus -- https://mail.python.org/mailman/listinfo/python-list

Compression of random binary data

2016-07-11 Thread jonas . thornvall
What kind of statistic law or mathematical conjecture or is it even a physical law is violated by compression of random binary data? I only know that Shanon theorised it could not be done, but were there any proof? What is to say that you can not do it if the symbolic representation is riche

Re: Compression of random binary data

2016-07-11 Thread Joonas Liik
On 11 July 2016 at 20:52, wrote: > What kind of statistic law or mathematical conjecture or is it even a > physical law is violated by compression of random binary data? > > I only know that Shanon theorised it could not be done, but were there any > proof? Compression relies on some items in

Re: Touch screen development in Python

2016-07-11 Thread Wildman via Python-list
On Mon, 11 Jul 2016 19:21:56 +0200, Jahn wrote: > Hi , > Does anyone use Python for developping applications that work with a touch > screen? > http://www.technolabsz.com/2011/08/how-to-make-touch-screen-user-interface.html -- GNU/Linux user #557453 The cow died so I don't need your bull!

Re: Compression of random binary data

2016-07-11 Thread jonas . thornvall
Den måndag 11 juli 2016 kl. 20:09:39 UTC+2 skrev Waffle: > On 11 July 2016 at 20:52, wrote: > > What kind of statistic law or mathematical conjecture or is it even a > > physical law is violated by compression of random binary data? > > > > I only know that Shanon theorised it could not be done

Re: Compression of random binary data

2016-07-11 Thread MRAB
On 2016-07-11 18:52, jonas.thornv...@gmail.com wrote: What kind of statistic law or mathematical conjecture or is it even a physical law is violated by compression of random binary data? I only know that Shanon theorised it could not be done, but were there any proof? What is to say that you

Re: Compression of random binary data

2016-07-11 Thread jonas . thornvall
Den måndag 11 juli 2016 kl. 20:24:37 UTC+2 skrev jonas.t...@gmail.com: > Den måndag 11 juli 2016 kl. 20:09:39 UTC+2 skrev Waffle: > > On 11 July 2016 at 20:52, wrote: > > > What kind of statistic law or mathematical conjecture or is it even a > > > physical law is violated by compression of ran

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Ian Kelly
On Mon, Jul 11, 2016 at 10:28 AM, Steven D'Aprano wrote: > On Tue, 12 Jul 2016 01:04 am, Ian Kelly wrote: >> Your example showed a 3-digit number being formatted with a requested >> precision of 5 digits. The way this was done was by left-padding the >> number with 0s until there were 5 digits, >

Re: Compression of random binary data

2016-07-11 Thread Steven D'Aprano
On Tue, 12 Jul 2016 03:52 am, jonas.thornv...@gmail.com wrote: > What kind of statistic law or mathematical conjecture or is it even a > physical law is violated by compression of random binary data? The pigeon hole principle. If you have 100 pigeon holes, and 101 pigeons, then clearly at least

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Terry Reedy
On 7/11/2016 1:24 PM, Ethan Furman wrote: On 07/11/2016 09:28 AM, Steven D'Aprano wrote: On Tue, 12 Jul 2016 01:04 am, Ian Kelly wrote: Er, what? I count *five* digits in "00123", not three. You seem to be assuming that "precision" can only refer to digits after the decimal place, but that's

Re: Compression of random binary data

2016-07-11 Thread MRAB
On 2016-07-11 19:30, MRAB wrote: On 2016-07-11 18:52, jonas.thornv...@gmail.com wrote: What kind of statistic law or mathematical conjecture or is it even a physical law is violated by compression of random binary data? I only know that Shanon theorised it could not be done, but were there an

Re: Compression of random binary data

2016-07-11 Thread Nobody
On Mon, 11 Jul 2016 10:52:08 -0700, jonas.thornvall wrote: > What kind of statistic law or mathematical conjecture or is it even a > physical law is violated by compression of random binary data? You can't create an invertable mapping between a set with 2^N elements (e.g. the set of all N-bit bi

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Ian Kelly
On Mon, Jul 11, 2016 at 12:54 PM, Terry Reedy wrote: > In any case, I think it an improvement to say that '0x00123' has a field > width of 7 rather than a 'precision' of 5. > '{:#07x}'.format(0x123) # specifiy field width > '0x00123' "%#0.5x" % 0x123 # specify int precision > '0x00123'

Re: Compression of random binary data

2016-07-11 Thread Terry Reedy
On 7/11/2016 2:09 PM, Joonas Liik wrote: On 11 July 2016 at 20:52, wrote: What kind of statistic law or mathematical conjecture or is it even a physical law is violated by compression of random binary data? Off-topic, but... It is unclear whether you mean 'random' in the technical sense o

Re: Touch screen development in Python

2016-07-11 Thread Dietmar Schwertberger
On 11.07.2016 19:21, Jahn wrote: Does anyone use Python for developping applications that work with a touch screen? Yes. You should probably specify the platform and the type of applications that you're interested in. Mobiles (Android, iOS, Sailfish OS)? Windows 10 Tablets? Ubuntu Touc

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Michael Torrie
On 07/11/2016 01:27 PM, Ian Kelly wrote: > On Mon, Jul 11, 2016 at 12:54 PM, Terry Reedy wrote: >> In any case, I think it an improvement to say that '0x00123' has a field >> width of 7 rather than a 'precision' of 5. >> > '{:#07x}'.format(0x123) # specifiy field width >> '0x00123' > "%#0

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Random832
On Mon, Jul 11, 2016, at 16:06, Michael Torrie wrote: > I'm not sure I've ever seen a negative hex number in the wild. Usually > when I view a number in hex I am wanting the raw representation. -0x123 > with a width of 7 would be 0xFFEDD There's nothing "raw" about python int objects. To get what

Re: EuroPython 2016: Last day to get tickets at regular rate

2016-07-11 Thread Moritz Neeb
Actually this was not your last chance! I am offering one spare regular rate student ticket (120,-). Please contact me if interested. Cheers, Moritz On 07/07/2016 09:35 AM, M.-A. Lemburg wrote: > We will be switching to the on-desk rates for tickets tomorrow, so > today is your last chance to get

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Terry Reedy
On 7/11/2016 3:27 PM, Ian Kelly wrote: On Mon, Jul 11, 2016 at 12:54 PM, Terry Reedy wrote: In any case, I think it an improvement to say that '0x00123' has a field width of 7 rather than a 'precision' of 5. '{:#07x}'.format(0x123) # specifiy field width '0x00123' "%#0.5x" % 0x123 # speci

What is precision of a number representation? (was: Curious Omission In New-Style Formats)

2016-07-11 Thread Ben Finney
Ethan Furman writes: > I will readily admit to not having a maths degree, and so of course to > me saying the integer 123 has a precision of 5, 10, or 99 digits seems > like hogwash to me. Precision is not a property of the number. It is a property of the *representation* of that number. The re

Re: What is precision of a number representation?

2016-07-11 Thread Ethan Furman
On 07/11/2016 01:56 PM, Ben Finney wrote: Precision is not a property of the number. It is a property of the *representation* of that number. The representation “1×10²” has a precision of one digit. The representation “100” has a precision of three digits. The representation “00100” has a preci

Re: Touch screen development in Python

2016-07-11 Thread Laurent Pointal
Jahn wrote: > Hi , > Does anyone use Python for developping applications that work with a > touch screen? You should take a look at Kivy: https://kivy.org/ A+ L.Pointal. -- https://mail.python.org/mailman/listinfo/python-list

Re: What is precision of a number representation? (was: Curious Omission In New-Style Formats)

2016-07-11 Thread Chris Angelico
On Tue, Jul 12, 2016 at 6:56 AM, Ben Finney wrote: > Precision is not a property of the number. It is a property of the > *representation* of that number. > > The representation “1×10²” has a precision of one digit. > The representation “100” has a precision of three digits. > The representation “

Re: What is precision of a number representation?

2016-07-11 Thread Ethan Furman
On 07/11/2016 02:51 PM, Chris Angelico wrote: On Tue, Jul 12, 2016 at 6:56 AM, Ben Finney wrote: Precision is not a property of the number. It is a property of the *representation* of that number. The representation “1×10²” has a precision of one digit. The representation “100” has a precisio

Re: What is precision of a number representation?

2016-07-11 Thread Ethan Furman
On 07/11/2016 03:17 PM, Ethan Furman wrote: So, so far there is no explanation of why leading zeroes make a number more precise. An example of what I mean: 174 with a precision of 3 tells us that the tenths place could be any of 0-9, or, put another way, the actual number could be anywhere b

Re: What is precision of a number representation?

2016-07-11 Thread Ben Bacarisse
Ben Finney writes: > Ethan Furman writes: > >> I will readily admit to not having a maths degree, and so of course to >> me saying the integer 123 has a precision of 5, 10, or 99 digits seems >> like hogwash to me. > > Precision is not a property of the number. It is a property of the > *represe

Re: What is precision of a number representation? (was: Curious Omission In New-Style Formats)

2016-07-11 Thread Jan Coombs
On Tue, 12 Jul 2016 07:51:23 +1000 Chris Angelico wrote: [snip] > > Yep. Precision is also a property of a measurement, the same > way that a unit is. If I pace out the length of the main > corridor in my house, I might come up with a result of thirty > meters. The number is "30"; the unit is "m

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Gregory Ewing
I seem to remember Guido stating once that a design principle of the new formatting system was for the part after the colon to be the same as what you would put in an equivalent %-format, to make it easy for people to switch between them. If that principle still stands, then this would seem to be

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Gregory Ewing
Ethan Furman wrote: I will readily admit to not having a maths degree, and so of course to me saying the integer 123 has a precision of 5, 10, or 99 digits seems like hogwash to me. Seems to me insisting that the number after the dot be called "precision" in all cases is imposing a foolish con

Re: What is precision of a number representation? (was: Curious Omission In New-Style Formats)

2016-07-11 Thread Chris Angelico
On Tue, Jul 12, 2016 at 9:14 AM, Jan Coombs wrote: > Thees all look good, but you may get into trouble if you trust a > PC with them! > > If the language/PC uses floating point representation then it > will assign a fixed number of bits for the fractional part, and > this will be left aligned in a

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Ethan Furman
On 07/11/2016 04:47 PM, Gregory Ewing wrote: Ethan Furman wrote: I will readily admit to not having a maths degree, and so of course to me saying the integer 123 has a precision of 5, 10, or 99 digits seems like hogwash to me. Seems to me insisting that the number after the dot be called "pr

Re: Compression of random binary data

2016-07-11 Thread Michael Selik
On Mon, Jul 11, 2016, 10:56 AM wrote: > What kind of statistic law or mathematical conjecture or is it even a > physical law is violated by compression of random binary data? > If you get lucky, you might be able to achieve very good compression. > http://dilbert.com/strip/2001-10-25 Or are y

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Ian Kelly
On Mon, Jul 11, 2016 at 5:47 PM, Gregory Ewing wrote: > Ethan Furman wrote: >> >> I will readily admit to not having a maths degree, and so of course to me >> saying the integer 123 has a precision of 5, 10, or 99 digits seems like >> hogwash to me. > > > Seems to me insisting that the number afte

Re: What is precision of a number representation?

2016-07-11 Thread Chris Angelico
On Tue, Jul 12, 2016 at 8:17 AM, Ethan Furman wrote: >> This is why it's important to be able to record precisions of >> arbitrary numbers. If I then measure the width of this corridor with a >> laser, I could get an extremely precise answer - say, 2,147 >> millimeters, with a precision of four si

Re: Compression of random binary data

2016-07-11 Thread Lawrence D’Oliveiro
On Tuesday, July 12, 2016 at 5:52:27 AM UTC+12, jonas.t...@gmail.com wrote: > What kind of statistic law or mathematical conjecture or is it even a > physical law is violated by compression of random binary data? Try compressing already-compressed data. Does that answer your question? -- http

subprocess: xterm -c cat, need to send data to cat and have it displayed in the xterm window

2016-07-11 Thread Veek. M
Script grabs some image data and runs imagemagick on it to extract some chinese. Then tesseract OCR to get the actual unicode. I then need to get it translated which also works and then display in XTerm using cat. I could cat << named_pipe but I was wondering if this was the only way? Could I j

Re: Curious Omission In New-Style Formats

2016-07-11 Thread Steven D'Aprano
On Tue, 12 Jul 2016 04:38 am, Ian Kelly wrote: > In what way do the leading zeroes in "00123" add to the precision of > the number? 00123 is the same quantity as 123 and represents no more > precise a measurement. You guys... next you're going to tell me that 1.23 and 1.2300 are the same quantit

Re: What is precision of a number representation?

2016-07-11 Thread Ben Finney
Ethan Furman writes: > On 07/11/2016 01:56 PM, Ben Finney wrote: > > > Precision is not a property of the number. It is a property of the > > *representation* of that number. > > > > The representation “1×10²” has a precision of one digit. > > The representation “100” has a precision of three dig

Re: What is precision of a number representation?

2016-07-11 Thread Terry Reedy
On 7/11/2016 5:51 PM, Chris Angelico wrote: This is why it's important to be able to record precisions of arbitrary numbers. If I then measure the width of this corridor with a laser, I could get an extremely precise answer - say, 2,147 millimeters, with a precision of four significant digits, a

Re: What is precision of a number representation?

2016-07-11 Thread Terry Reedy
On 7/11/2016 6:17 PM, Ethan Furman wrote: On 07/11/2016 02:51 PM, Chris Angelico wrote: This is why it's important to be able to record precisions of arbitrary numbers. If I then measure the width of this corridor with a laser, I could get an extremely precise answer - say, 2,147 millimeters,

Re: What is precision of a number representation? (was: Curious Omission In New-Style Formats)

2016-07-11 Thread Steven D'Aprano
On Tue, 12 Jul 2016 07:51 am, Chris Angelico wrote: > say, 2,147 > millimeters, with a precision of four significant digits How do you represent 1 mm to a precision of four significant digits, in such a way that it is distinguished from 1 mm to one significant digit, and 1 mm to a precision of f

Re: Touch screen development in Python

2016-07-11 Thread Paul Rubin
"Jahn" writes: > Does anyone use Python for developping applications that work with a > touch screen? I've done it on a system where the touch screen events were treated the same way as mouse events. Coding works out about the same way. -- https://mail.python.org/mailman/listinfo/python-list

Re: What is precision of a number representation? (was: Curious Omission In New-Style Formats)

2016-07-11 Thread Chris Angelico
On Tue, Jul 12, 2016 at 2:19 PM, Steven D'Aprano wrote: > On Tue, 12 Jul 2016 07:51 am, Chris Angelico wrote: > >> say, 2,147 >> millimeters, with a precision of four significant digits > > > How do you represent 1 mm to a precision of four significant digits, in such > a way that it is distinguis

[RELEASE] Python 3.6.0a3 is now available

2016-07-11 Thread Ned Deily
On behalf of the Python development community and the Python 3.6 release team, I'm happy to announce the availability of Python 3.6.0a3. 3.6.0a3 is the third of four planned alpha releases of Python 3.6, the next major release of Python. During the alpha phase, Python 3.6 remains under heavy devel

Re: What is precision of a number representation?

2016-07-11 Thread Steven D'Aprano
On Tuesday 12 July 2016 08:17, Ethan Furman wrote: > So, so far there is no explanation of why leading zeroes make a number > more precise. Obviously it doesn't, just as trailing zeroes doesn't make a number more precise. Precision in the sense used by scientists is a property of how the measu

Re: subprocess: xterm -c cat, need to send data to cat and have it displayed in the xterm window

2016-07-11 Thread Steven D'Aprano
On Tuesday 12 July 2016 16:27, Steven D'Aprano wrote: > On Tuesday 12 July 2016 13:20, Veek. M wrote: > >> Script grabs some image data and runs imagemagick on it to extract some >> chinese. Then tesseract OCR to get the actual unicode. >> >> I then need to get it translated which also works and

Re: subprocess: xterm -c cat, need to send data to cat and have it displayed in the xterm window

2016-07-11 Thread Steven D'Aprano
On Tuesday 12 July 2016 13:20, Veek. M wrote: > Script grabs some image data and runs imagemagick on it to extract some > chinese. Then tesseract OCR to get the actual unicode. > > I then need to get it translated which also works and then display in > XTerm using cat. Why not just print it? Why