Re: Unicode 7

2014-04-30 Thread wxjmfauth
@ Time Chase

I'm perfectly aware about what I'm doing.


@ MRAB

"...Although the third example is the fastest, it's also the wrong
way to handle Unicode: ..."

Maybe that's exactly the opposite. It illustrates very well,
the quality of coding schemes endorsed by Unicode.org.
I deliberately choose utf-8.


>>> sys.getsizeof('\u0fce')
40
>>> sys.getsizeof('\u0fce'.encode('utf-8'))
20
>>> sys.getsizeof('\u0fce'.encode('utf-16-be'))
19
>>> sys.getsizeof('\u0fce'.encode('utf-32-be'))
21
>>> 

Q. How to save memory without wasting time in encoding?
By using products using natively the unicode coding schemes?

Are you understanding unicode? Or are you understanding
unicode via Python?

---

A Tibetan monk [*] using Py32:

>>> timeit.repeat("(x*1000 + y)[:-1]", setup="x = 'abc'; y = 'z'")
[2.3394840182882186, 2.3145832750782653, 2.3207231951529685]
>>> timeit.repeat("(x*1000 + y)[:-1]", setup="x = 'abc'; y = '\u0fce'")
[2.328517624800078, 2.3169403900011076, 2.317586282812048]
>>>

[*] Your curiosity has certainly shown, what this code point means.
For the others:
U+0FCE TIBETAN SIGN RDEL NAG RDEL DKAR
signifies good luck earlier, bad luck later


(My comment: Good luck with Python or bad luck with Python)

jmf
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in Decimal??

2014-04-30 Thread Gregory Ewing

pleasedonts...@isp.com wrote:

I compared the results with wolfram Alpha, and
also with an open source arbitrary precision calculator, which matches Alpha
results.


Decimal is *not* an arbitrary precision data type, so you
can't expect exact results from it. You can set the precision
to be very large, but it's still essentially a floating point
type, and as such you can expect the last few digits to
depend heavily on the details of the algorithm used.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread Gregory Ewing

Chris Angelico wrote:


Any point where the mile east takes you an exact number of times
around the globe. So, anywhere exactly one mile north of that, which
is a number of circles not far from the south pole.


True, but there are no bears in Antarctica, so that
rules out all the south-pole solutions.

I think there are still multiple solutions, though.
The bear may have been spray-painted by activists
trying to protect it from polar trophy hunters.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread Chris Angelico
On Wed, Apr 30, 2014 at 6:14 PM, Gregory Ewing
 wrote:
> Chris Angelico wrote:
>
>> Any point where the mile east takes you an exact number of times
>> around the globe. So, anywhere exactly one mile north of that, which
>> is a number of circles not far from the south pole.
>
>
> True, but there are no bears in Antarctica, so that
> rules out all the south-pole solutions.
>
> I think there are still multiple solutions, though.
> The bear may have been spray-painted by activists
> trying to protect it from polar trophy hunters.

Well, I did suggest it might have been a black bear:

http://img2.wikia.nocookie.net/__cb20130411125035/disney/images/8/88/Brave-brave-31312503-800-486.png

But spray paint would work too...

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread alister
On Tue, 29 Apr 2014 15:42:25 -0700, emile wrote:

> On 04/29/2014 01:16 PM, Adam Funk wrote:
> 
>> "A man pitches his tent, walks 1 km south, walks 1 km east, kills a
>> bear, & walks 1 km north, where he's back at his tent.  What color is
>> the bear?"  ;-)
> 
>  From how many locations on Earth can someone walk one mile south, one
> mile east, and one mile north and end up at their starting point?
> 
> Emile

there are an infinite number of locations where this can happen (although 
only one where you will find a bear.)



-- 
Gomme's Laws:
(1) A backscratcher will always find new itches.
(2) Time accelerates.
(3) The weather at home improves as soon as you go away.
-- 
https://mail.python.org/mailman/listinfo/python-list


Designing a network in Python

2014-04-30 Thread varun7rs
Hello Friends

I would like to design a network given the topology and the source I use is 
http://sndlib.zib.de/home.action

I have managed to read most of the important data in the xml onto lists. Now, I 
have two lists, Source and Destination and I'd like to create bi-directional 
links between them. My code is as below. And moreover, I'd like to assign some 
kind of a bandwidth capacity to the links and similarly, storage and processing 
capacity to the nodes. So, I generated some random integers for them. I don't 
know how to proceed further to design the topology. I'd prefer to do the 
topology design in another .py file probably. I'd be glad if you guys could 
lend me a helping hand.

import sys
import xml.dom.minidom as dom 
import string
#from xml.dom.minidom import getDOMimplementation
from xml.dom import minidom
from xml.dom.minidom import parse
import os
import random



class PHY_NODES:
def __init__(self, nodeID, x, y, capacity_proc, capacity_stor, 
capacity_switch):
self.nodeID = nodeID
self.x = x
self.y = y
self.linklist = []
self.capacity_proc = capacity_proc
self.capacity_stor = capacity_stor
self.capacity_switch = capacity_switch

class PHY_LINKS:
def __init__(self, linkID, source, destination, capacity_bdw):
self.linkID = linkID
self.source = source
self.destination = destination
self.capacity_bdw = capacity_bdw

# Reading Nodes

Read_Data = minidom.parse("germany50.xml")
nodelist = Read_Data.getElementsByTagName("node")
corenodes = []
for node in nodelist :
corenodes.append(node.getAttribute("id"))
nodeid = node.getAttribute("id")
xCoordinates = node.getElementsByTagName("x") [0]
yCoordinates = node.getElementsByTagName("y") [0]
proc = random.randint(20, 40)
stor = random.randint(40, 80)
switch = random.randint(60, 90)
nodeobj = PHY_NODES(nodeid, xCoordinates, yCoordinates, proc, stor, 
switch)



# Reading Links 

linklist = Read_Data.getElementsByTagName("link")

links = []
sources = []
destinations = []
capacity_link = []
for link in linklist :
linkid = link.getAttribute("id")
Source = link.getElementsByTagName("source") [0]
Destination = link.getElementsByTagName("target") [0]
Capacity = link.getElementsByTagName("capacity") [0]
linkobj = PHY_LINKS(linkid, Source, Destination, Capacity)
sources.append(Source.firstChild.data)
destinations.append(Destination.firstChild.data)
capacity_link.append(Capacity.firstChild.data)
-- 
https://mail.python.org/mailman/listinfo/python-list


Slightly OT - using PyUIC from Eclipse

2014-04-30 Thread Steve Simmons
I'm trying to set up a new dev environment using Windows 7; Eclipse 
(Kepler); Python 3.3; PyDev and PyQt 5 and I've hit an issue getting 
PyUIC to generate a python Qt class from within Eclipse.


I'm using the following setup process (from Google Groups)  modified to 
match my PyQt5 configuration:


1. Click Run -> External Tools -> External Tools Configurations ...
2. In the resulting dialog, click 'New' icon in the top left
3. Under 'Name' put 'PyUIC'
4. Under 'Location' enter 'C:\Program Files\Python\2.5\Python.exe' or
the path to your Python executable (probably C:\Python25\Python.exe)
5. Under 'Arguments' enter '"C:\Program Files\Python\2.5\Lib\site-
packages\PyQt4\uic\pyuic.py"  "${resource_loc}"' substituting the path
to your PyQt4 installation - be sure also to include the double quotes
6. Change to the 'Common' tab and check 'File' under 'Standard Input/
Output' and enter '${resource_loc}.py'
7. Change to the 'Build' tab and uncheck 'Build before launch'
8. Change to the 'Refresh' tab and check 'Refresh resources upon
completion'
9. Click 'Apply' then 'Run'

and I'm getting the following traceback:

Traceback (most recent call last):
  File "D:\Development\Python33\Lib\site-packages\PyQt5\uic\pyuic.py",
line 28, in 
from .driver import Driver
SystemError: Parent module '' not loaded, cannot perform relative import

I tried this on Qt4 a week or so ago and it worked OK but Qt5 is giving 
me an error message, so I guess I've either mis-transcribed or there's a 
difference in the directory structure betwee PyQt4 & PyQt5.


I'm more interested to learn how to read the traceback (insightfully) 
and track it to the source of the problem, although it would be good to 
have it working too!!


Steve Simmons

PS Also posted to PyQT list.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread Roy Smith
In article ,
 Chris Angelico  wrote:

> But I think a better answer is New York City. You start out lost, you
> go a mile south, a mile east, a mile north, and you are again lost.

Only in Queens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bug in Decimal??

2014-04-30 Thread pleasedontspam
On Tuesday, April 29, 2014 11:39:12 PM UTC-4, Steven D'Aprano wrote:
> On Tue, 29 Apr 2014 19:37:17 -0700, pleasedontspam wrote:
> 
> 
> 
> > from decimal import *
> 
> > getcontext().prec=2016
> 
> > one=Decimal(1)
> 
> > number=Decimal('1e-1007')
> 
> > partial=(one+number)/(one-number)
> 
> > final.ln()
> 
> 
> 
> What's final? Did you mean partial?

Final is my final result: ln((1+x)/(1-x))
I called the quotient partial because I wanted to investigate if perhaps the 
result of the division (that's my partial result) had a rounding error, which 
would throw off the ln().



> 
> 
> 
> When I try it in Python 3.3, I get:
> 
> 
> 
> py> from decimal import *
> 
> py> getcontext().prec=2016
> 
> py> one = Decimal(1)
> 
> py> number = Decimal('1e-1007')
> 
> py> partial = (one+number)/(one-number)
> 
> py> partial.ln()
> 
> Decimal('1.[...]987E-1007')
> 
> 
> 
> with a lot of 9s deleted for brevity.

> 
> 
> 
> > The result should be 2.0... with all zeroes and 7 at the end.
> 
> 
> 
> Can you demonstrate exactly how you tested it on Wolfram-Alpha, because I 
> 
> cannot reproduce that. When I try it with ln((1+1e-1007)/(1-1e-1007)), 

That's exactly how you test it.
The result should be 2.... 7 (at 2016 digits precision, at higher 
precisions it will continue adding another 2014 sixes until the digits become 
something else.

This is from the definition of the yperbolic arc tangent:

atanh(x) = 1/2 * ln ( (1+x)/(1-x) )

As it turns out to be the ln() part of 1e-N is the integer 2, followed by 2N 
zeroes, then followed by 2N-1 sixes, then a 0, a seven, then another group of 
around 2N sixes (I didn't actually count them), then other interesting digit 
patterns.
Try with 1e-1007 using 4000 digits or more and you'll see python giving a 
better result... but there's a 4 in the middle of the sixes! That 4 shouldn't 
be there.
getcontext().prec=4000, then do the rest the same (you need to recalculate the 
partial result at the higher precision too).

> 
> the decimal expansion shown starts off as:
> 
> 
> 
> 2.0... × 10^-1007
> 
> 
> 
> By repeatedly clicking "More digits", I get:
> 
> 
> 
> 2.000...
>  
> 
> × 10^-1007
> 
> 
> 
> For brevity, I will truncate some repeated digits from this point on.
> 
> 
> 
> 
> 
> 1.9[...]9... 
> 
> × 10^-1007
> 
> 
> 
> as above, except with even more nines (477 of them if I have calculated 
> 
> correctly)
> 

You're correct! It seems Alpha has its own problems too. Depending on the 
precision, it's giving the correct or incorrect result, changing as you hit 
'more digits'.
I can imagine this could happen because the (1+x)/(1-x) ratio becomes 1. 
followed by 2N zeroes, then a 2, then 2N zeroes, then another 2, etc.
If the precision is such that your last digit just includes the next 2 or not, 
it can throw the result off a little bit. But this should self-correct as the 
precision goes higher, as it does in Wolfram Alpha.
But python is giving bad data even with very high precision, as I mentioned 
above with 4000 digits, there's a bad digit in the middle of the sixes, at much 
less precision than the required by the system (hundreds of digits less).


> 
> 
> 2.0[...]00... 
> 
> × 10^-1007
> 
> 
> 
> as above, with even more zeroes
> 
> 
> 
> and finally the last available approximation is 
> 
> 
> 
> 2.00[...]0066[...]66... × 10^-1007
> 
> 
> 
> with a lot of zeroes and sixes not shown. But not ending in 7.

Ending in 7 is because I had exactly 2016 digits precision, and 2016 is 
2*1007+1, so exactly the last digit was the first 6 of the 666... which 
becomes 7 because it was correctly rounded.


> 
> 
> 
> 
> 
> > Instead, I'm getting 1.99.. with 2 digits different at the end.
> 
> 
> 
> Well, it's hard to say exactly what's going on, since Wolfram Alpha 
> 
> doesn't show the context, but it looks like Python's version may agree 
> 
> with two out of the seven decimal approximations Alpha makes available. 
> 
> This suggests to me that it's a representation issue.
> 

Definitely not a representation issue. I'm working on a high precision 
calculator, and was using mpdecimal to generate tables for the CORDIC method, 
(the tables have atanh(1e-N) for N=1..Precision) and that's how I stumbled upon 
this issue, the last 2/3 of my tables were consistently showing the wrong 
results. And I'm not printing the numbers, I'm accessing the digits directly 
from the data structures, so what you see is exactly what gets calculated, this 
is not a problem with printing.
It might be a printing issue in Alpha, since they probably use binary numbers 
(GMP and the like), as opposed to decimal like python.

> 
> 
> 
> 
> [...]
> 
> > Can other people confirm this or is it just 

Re: Bug in Decimal??

2014-04-30 Thread pleasedontspam
On Tuesday, April 29, 2014 11:39:12 PM UTC-4, Steven D'Aprano wrote:
> On Tue, 29 Apr 2014 19:37:17 -0700, pleasedontspam wrote:
> 
> 
> 
> > from decimal import *
> 
> > getcontext().prec=2016
> 
> > one=Decimal(1)
> 
> > number=Decimal('1e-1007')
> 
> > partial=(one+number)/(one-number)
> 
> > final.ln()
> 
> 
> 
> What's final? Did you mean partial?

I see what you mean now. Sorry, I meant

final=partial.ln()

-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Designing a network in Python

2014-04-30 Thread Joseph L. Casale
> I have managed to read most of the important data in the xml onto lists.
> Now, I have two lists, Source and Destination and I'd like to create 
> bi-directional
> links between them.

> And moreover, I'd like to assign some kind of a bandwidth capacity to the 
> links and
> similarly, storage and processing capacity to the nodes.

I don't know anything about your use case or data really, but from the above I
already know I would shove this all into a database, adding tables with 
relations
and mining data based on relations becomes trivial. More importantly, it also 
then
becomes easily extensible without refactoring as your requirements change.

Just my opinion,
jlc
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread Mark Lawrence

On 30/04/2014 09:14, Gregory Ewing wrote:

Chris Angelico wrote:


Any point where the mile east takes you an exact number of times
around the globe. So, anywhere exactly one mile north of that, which
is a number of circles not far from the south pole.


True, but there are no bears in Antarctica, so that
rules out all the south-pole solutions.

I think there are still multiple solutions, though.
The bear may have been spray-painted by activists
trying to protect it from polar trophy hunters.



Couldn't this kill the bear?  My source is the book and film Goldfinger.

--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


--
https://mail.python.org/mailman/listinfo/python-list


Re: First attempt at a Python prog (Chess)

2014-04-30 Thread Chris Hinsley

On 2013-02-15 05:05:27 +, Rick Johnson said:


On Thursday, February 14, 2013 11:48:10 AM UTC-6, Chris Hinsley wrote:


Is a Python list as fast as a bytearray?


Why would you care about that now? Are you running this code on the 
Xerox Alto? Excuse me for the sarcasm but your post title has perplexed 
me:


 "First attempt at a Python prog (Chess)"Okay, but how does that translate to:
"The fastest, most efficient, most brain fricked python code ever 
released in the form of a game, that just happens to look an awful lot 
like C source"?

http://en.wikipedia.org/wiki/Optimization_%28computer_science%29#When_to_optimize 



Why bother to use Python if what you really want to write is C code? If 
you want to write good code (not just python), you need to write code 
that is maintainable. Yes i KNOW, this is just some stupid chess game, 
but i can assure you that this style of code is only going to harm your 
evolution. This code is obfuscated at best and BF'ed at worst. And 
forget about the algorithms for now, the first problems to address are 
superficial.


First of all your naming conventions suck. You've used the "interface" 
style for every function in this game so i can't /easily/ eyeball parse 
the /real/ interface functions from the helper functions -- and i'm not 
going to even try, because i don't read ugly code! Try to learn the 
Python style guide as soon as you can (In particular pay attention to 
naming conventions):


 http://www.python.org/dev/peps/pep-0008/

Secondly this game could benefit from some OOP paradigm (not sure if 
are familiar with OOP or not???). But don't go bat-crazy with OOP! You 
don't need an object to represent /every/ single piece on the board 
(That would be nuts!). You need just enough OOP to encapsulate the data 
and create a proper interface.

A good litmus test is based on the "three little bears":

 "Papa bears bed is too hard"

A hard utilization of paradigms wields too little OOP and therefore 
ends up being too difficult (aka: "hard") to maintain because there is 
no logical interface; just a massive collection of functions stuffed 
into global space until BF reaches critical mass and you're forced to 
do a complete re-write! (Of course sometimes you don't need OOP at all, 
just interface)

 "Mama bears bed is too soft"

A soft utilization of paradigms wields too much OOP whereby you are 
surrounded by big FAT objects which are smothering you to death, and 
they smell because they cannot properly wash themselves between the 
rolls of fat.


 "but baby bears is just right"
Ahhh, the blissful comfort of a paradigm utilization that is "just 
right". This is where your code should be, you want a level of OOP 
usage that is "just right" for the occasion; not any more, not any less.

## START EXAMPLE CODE ##
class GameBoard(???):
def __init__(self):
self.board = self._createBoard()
   def __str__(self):
"""Override:"""
# return a string represention of the board
# suitable for writing to stdout
   def _createBoard(self):
"""Internal:"""
self.board = [blah]
  def make_move(self, piece, vector):
"""Interface: move a game piece based on vector"""
# Find and move the piece. Whether the pieces
# are objects or not doesn't matter.
   class GamePiece(object):
def __init__(self, typename, color):
self.typeName = typeName
self.color = color
self.captureFlag = self._computeFlag()


def main():
board = Board()
playing = True
while playing is not False
i = input('PieceName - MoveVec:')
n, v = parse(i)
result = board.make_move(n, v)
if result == 'GameOver':
playing = False
else:
# clear the stdout
str(board)

if __name__ == '__main__:
main()
## END EXAMPLE CODE ##

And now you have the added benefit of exporting the objects for use elsewhere.


Wow, such vitriol for such a simple bear to cope with !

Maybe Papa bear would like to try some humility !

This was my very first Python prog, and my first chess prog and my 
attempt to learn somthing about Generators ! Do youtself a favour and 
leave the Python comunity for the good of the language !


Chris

--
https://mail.python.org/mailman/listinfo/python-list


Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]

2014-04-30 Thread Ethan Furman

On 04/29/2014 03:51 PM, Chris Angelico wrote:

On Wed, Apr 30, 2014 at 8:42 AM, emile  wrote:

On 04/29/2014 01:16 PM, Adam Funk wrote:


"A man pitches his tent, walks 1 km south, walks 1 km east, kills a
bear, & walks 1 km north, where he's back at his tent.  What color is
the bear?"  ;-)



 From how many locations on Earth can someone walk one mile south, one mile
east, and one mile north and end up at their starting point?


Any point where the mile east takes you an exact number of times
around the globe. So, anywhere exactly one mile north of that, which
is a number of circles not far from the south pole.


It is my contention, completely unbacked by actual research, that if you find such a spot (heading a mile east takes you 
an integral number of times around the pole), that there is not enough Earth left to walk a mile north so that you could 
then turn-around a walk a mile south to get back to such a location.


--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]

2014-04-30 Thread Ethan Furman

On 04/30/2014 06:14 AM, Ethan Furman wrote:

On 04/29/2014 03:51 PM, Chris Angelico wrote:

On Wed, Apr 30, 2014 at 8:42 AM, emile  wrote:

On 04/29/2014 01:16 PM, Adam Funk wrote:


"A man pitches his tent, walks 1 km south, walks 1 km east, kills a
bear, & walks 1 km north, where he's back at his tent.  What color is
the bear?"  ;-)



 From how many locations on Earth can someone walk one mile south, one mile
east, and one mile north and end up at their starting point?


Any point where the mile east takes you an exact number of times
around the globe. So, anywhere exactly one mile north of that, which
is a number of circles not far from the south pole.


It is my contention, completely unbacked by actual research, that if you find 
such a spot (heading a mile east takes you
an integral number of times around the pole), that there is not enough Earth 
left to walk a mile north so that you could
then turn-around a walk a mile south to get back to such a location.


Wow.  It's amazing how writing something down, wrongly (I originally had north and south reversed), correcting it, 
letting some time pass (enough to post the message so one can be properly embarrassed ;), and then rereading it later 
can make something so much clearer!


Or maybe it was the morning caffeine.  Hmmm.

At any rate, I withdraw my contention, it is clear to me now (at least until 
the caffeine wears off).

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Designing a network in Python

2014-04-30 Thread varun7rs
I don't know how to do that stuff in python. Basically, I'm trying to pull 
certain data from the xml file like the node-name, source, destination and the 
capacity. Since, I am done with that part, I now want to have a link between 
source and destination and assign capacity to it.

eg., [a,b,c,d,e] [l,m,n,o,p] [5,2,3,4,5]

I need something like a - l: 5, b - m: 2,I don't know how to describe this 
exactly but I hope this would give you a rough idea. After this, I put the 
stuff back into an xml but this time only there are more parameters and looks 
more detailed

Like nodeID = Aachen...stor_capacity = 100, proc_capacity = 200, 
switch_capacity = 190...etc 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Designing a network in Python

2014-04-30 Thread Mark H Harris

On 4/30/14 9:57 AM, varun...@gmail.com wrote:

I don't know how to do that stuff in python.


   Always a good time to learn.


Let the database do the work for you;  try not to re-invent the 
relational database wheel.  Access the database via python-sql:


https://pypi.python.org/pypi/python-sql/


marcus


--
https://mail.python.org/mailman/listinfo/python-list


Re: First attempt at a Python prog (Chess)

2014-04-30 Thread Mark H Harris

On 4/30/14 8:28 AM, Chris Hinsley wrote:

On 2013-02-15 05:05:27 +, Rick Johnson said:


First of all your naming conventions suck. You've used the "interface"
style for every function in this game so i can't /easily/ eyeball
parse the /real/ interface functions from the helper functions -- and
i'm not going to even try, because i don't read ugly code! Try to
learn the Python style guide as soon as you can (In particular pay
attention to naming conventions):



Wow, such vitriol for such a simple bear to cope with !

Maybe Papa bear would like to try some humility !

This was my very first Python prog, and my first chess prog and my
attempt to learn somthing about Generators ! Do youtself a favour and
leave the Python comunity for the good of the language !

Chris



Chris, you might want to try another list:

https://mail.python.org/mailman/listinfo/tutor


The folks on this list are friendly, but tough. They are not generally 
arrogant, but many of them are experts (or core python developers) and 
most of them are worth listening to. The list mentioned above is for 
folks who are learning python and who have basic questions or want basic 
clarifications.   (they are gentler too):)



marcus
--
https://mail.python.org/mailman/listinfo/python-list


Re: First attempt at a Python prog (Chess)

2014-04-30 Thread Robert Kern

On 2014-04-30 16:15, Mark H Harris wrote:

On 4/30/14 8:28 AM, Chris Hinsley wrote:

On 2013-02-15 05:05:27 +, Rick Johnson said:


First of all your naming conventions suck. You've used the "interface"
style for every function in this game so i can't /easily/ eyeball
parse the /real/ interface functions from the helper functions -- and
i'm not going to even try, because i don't read ugly code! Try to
learn the Python style guide as soon as you can (In particular pay
attention to naming conventions):



Wow, such vitriol for such a simple bear to cope with !

Maybe Papa bear would like to try some humility !

This was my very first Python prog, and my first chess prog and my
attempt to learn somthing about Generators ! Do youtself a favour and
leave the Python comunity for the good of the language !

Chris



Chris, you might want to try another list:

https://mail.python.org/mailman/listinfo/tutor


The folks on this list are friendly, but tough. They are not generally arrogant,
but many of them are experts (or core python developers) and most of them are
worth listening to. The list mentioned above is for folks who are learning
python and who have basic questions or want basic clarifications.   (they are
gentler too):)


It's also worth noting that Rick Johnson is a well-known troll here and *not* 
representative of this group. He was deliberately insulting Chris, not being 
"tough" but helpful. He is not worth listening to. He is to be killfiled and 
ignored. Chris, I'm sorry you ran into him on your first introduction to this 
community.


--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
https://mail.python.org/mailman/listinfo/python-list


Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]

2014-04-30 Thread Chris Angelico
On Wed, Apr 30, 2014 at 11:14 PM, Ethan Furman  wrote:
>> Any point where the mile east takes you an exact number of times
>> around the globe. So, anywhere exactly one mile north of that, which
>> is a number of circles not far from the south pole.
>
>
> It is my contention, completely unbacked by actual research, that if you
> find such a spot (heading a mile east takes you an integral number of times
> around the pole), that there is not enough Earth left to walk a mile north
> so that you could then turn-around a walk a mile south to get back to such a
> location.

The circle where the distance is exactly one mile will be fairly near
the south pole. There should be plenty of planet a mile to the north
of that.

If the earth were a perfect sphere, the place we're looking for is the
place where cutting across the sphere is 1/π miles. The radius of the
earth is approximately 4000 miles (give or take). So we're looking for
the place where the chord across a radius 4000 circle is 1/π; that
means the triangle formed by a radius of the earth and half of 1/π and
an unknown side (the distance from the centre of the earth to the
point where the chord meets it - a smidge less than 4000, but the
exact distance is immaterial) is a right triangle. Trig functions to
the rescue! We want latitude 90°-(asin 1/8000π). It's practically at
the south pole: 89.9977° south (89°59'52").

Are my calculations correct?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread Grant Edwards
On 2014-04-29, Roy Smith  wrote:

>> What reason do you have to think that something recorded to 14 
>> decimal places was only intended to have been recorded to 4?
>
> Because I understand the physical measurement these numbers represent.  
> Sometimes, Steve, you have to assume that when somebody asks a question, 
> they actually have asked the question then intended to ask.

Sometimes.  But the smart money bets against it -- especially when
people are asking about floating point. :)

It doesn't sound to me like you have enough information to reliably do
what you want to do, but parsing the string representation is probably
the best way to go.

-- 
Grant Edwards   grant.b.edwardsYow! HELLO KITTY gang
  at   terrorizes town, family
  gmail.comSTICKERED to death!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread Grant Edwards
On 2014-04-29, Roy Smith  wrote:
> In article ,
>  Chris Angelico  wrote:
>
>> On Tue, Apr 29, 2014 at 11:38 PM, Roy Smith  wrote:
>> > I'm trying to intuit, from the values I've been given, which coordinates
>> > are likely to be accurate to within a few miles.  I'm willing to accept
>> > a few false negatives.  If the number is float("38"), I'm willing to
>> > accept that it might actually be float("38."), and I might be
>> > throwing out a good data point that I don't need to.
>> 
>> You have one chance in ten, repeatably, of losing a digit. That is,
>> roughly 10% of your four-decimal figures will appear to be
>> three-decimal, and 1% of them will appear to be two-decimal, and so
>> on. Is that "a few" false negatives?
>
> You're looking at it the wrong way.  It's not that the glass is 10% 
> empty, it's that it's 90% full, and 90% is a lot of good data :-)

If you know _which_ is the good data and which is the bad...

-- 
Grant Edwards   grant.b.edwardsYow! I'm sitting on my
  at   SPEED QUEEN ... To me,
  gmail.comit's ENJOYABLE ... I'm WARM
   ... I'm VIBRATORY ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread Grant Edwards
On 2014-04-29, emile  wrote:
> On 04/29/2014 01:16 PM, Adam Funk wrote:
>
>> "A man pitches his tent, walks 1 km south, walks 1 km east, kills a
>> bear, & walks 1 km north, where he's back at his tent.  What color is
>> the bear?"  ;-)
>
>  From how many locations on Earth can someone walk one mile south, one 
> mile east, and one mile north and end up at their starting point?

I'm pretty sure there are places in London like that.  At least that's
what it seemed like to somebody from the midwestern US where the
streets are layed out on a grid.

-- 
Grant Edwards   grant.b.edwardsYow! It's a hole all the
  at   way to downtown Burbank!
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Designing a network in Python

2014-04-30 Thread Joseph L. Casale
> I don't know how to do that stuff in python. Basically, I'm trying to pull 
> certain data from the
> xml file like the node-name, source, destination and the capacity. Since, I 
> am done with that
> part, I now want to have a link between source and destination and assign 
> capacity to it.

I dont mind writing you an SQLite schema and accessor class, can you define 
your data in a tabular
format and mail it to me offline, we add relationships etc as we go.

Hopefully it inspires you to adopt this approach in the future as it often 
proves powerful.

jlc
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unicode 7

2014-04-30 Thread Tim Chase
On 2014-04-30 00:06, wxjmfa...@gmail.com wrote:
> @ Time Chase
> 
> I'm perfectly aware about what I'm doing.

Apparently, you're quite adept at appending superfluous characters to
sensible strings...did you benchmark your email composition, too? ;-)

-tkc (aka "Tim", not "Time")




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]

2014-04-30 Thread Chris Angelico
On Thu, May 1, 2014 at 12:02 AM, Ethan Furman  wrote:
> Wow.  It's amazing how writing something down, wrongly (I originally had
> north and south reversed), correcting it, letting some time pass (enough to
> post the message so one can be properly embarrassed ;), and then rereading
> it later can make something so much clearer!
>
> Or maybe it was the morning caffeine.  Hmmm.
>
> At any rate, I withdraw my contention, it is clear to me now (at least until
> the caffeine wears off).

It's also amazing how much fun it can be to dig into the actual
mathematics, as a means of dispelling a perceived error :)

So, thank you for posting that, because it forced me to actually map
things out (in my head - didn't feel like using pen-and-paper
geometry, even though this is the most literal form of geo-metry
possible) and figure out exactly how many degrees of latitude it
takes. Good fun!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Slightly OT - using PyUIC from Eclipse

2014-04-30 Thread Fabio Zadrozny
On Wed, Apr 30, 2014 at 8:39 AM, Steve Simmons wrote:

> I'm trying to set up a new dev environment using Windows 7; Eclipse
> (Kepler); Python 3.3; PyDev and PyQt 5 and I've hit an issue getting PyUIC
> to generate a python Qt class from within Eclipse.
>
> I'm using the following setup process (from Google Groups)  modified to
> match my PyQt5 configuration:
>
> 1. Click Run -> External Tools -> External Tools Configurations ...
> 2. In the resulting dialog, click 'New' icon in the top left
> 3. Under 'Name' put 'PyUIC'
> 4. Under 'Location' enter 'C:\Program Files\Python\2.5\Python.exe' or
> the path to your Python executable (probably C:\Python25\Python.exe)
> 5. Under 'Arguments' enter '"C:\Program Files\Python\2.5\Lib\site-
> packages\PyQt4\uic\pyuic.py"  "${resource_loc}"' substituting the path
> to your PyQt4 installation - be sure also to include the double quotes
> 6. Change to the 'Common' tab and check 'File' under 'Standard Input/
> Output' and enter '${resource_loc}.py'
> 7. Change to the 'Build' tab and uncheck 'Build before launch'
> 8. Change to the 'Refresh' tab and check 'Refresh resources upon
> completion'
> 9. Click 'Apply' then 'Run'
>
> and I'm getting the following traceback:
>
> Traceback (most recent call last):
>   File "D:\Development\Python33\Lib\site-packages\PyQt5\uic\pyuic.py",
> line 28, in 
> from .driver import Driver
> SystemError: Parent module '' not loaded, cannot perform relative import
>
> I tried this on Qt4 a week or so ago and it worked OK but Qt5 is giving me
> an error message, so I guess I've either mis-transcribed or there's a
> difference in the directory structure betwee PyQt4 & PyQt5.
>
> I'm more interested to learn how to read the traceback (insightfully) and
> track it to the source of the problem, although it would be good to have it
> working too!!
>
> Steve Simmons
>
> PS Also posted to PyQT list.
> --
> https://mail.python.org/mailman/listinfo/python-list
>


The problem is that a main module cannot perform relative imports on
Python. To overcome that limitation, Python created a workaround to execute
a module with:

python -m 'module.name'

So, If you execute Python as:

python -m PyQt5.uic.pyuic

(instead of "python C:\Program
Files\Python\2.5\Lib\site-packages\PyQt5\uic\pyuic.py")

it should work.

If you want, you can read an answer on
http://stackoverflow.com/questions/14132789/python-relative-imports-for-the-billionth-timefor
more details on why it doesn't work and the other way does...

Cheers,

Fabio
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unittest weirdness

2014-04-30 Thread Ethan Furman

On 03/11/2014 01:58 PM, Ethan Furman wrote:


So I finally got enough data and enough of an understanding to write some unit 
tests for my code.



The weird behavior I'm getting:

   - when a test fails, I get the E or F, but no summary at the end
 (if the failure occurs in setUpClass before my tested routines
 are actually called, I get the summary; if I run a test method
 individually I get the summary)

   - I have two classes, but only one is being exercised

   - occasionally, one of my gvim windows is unceremoniously killed
(survived only by its swap file)

I'm running the tests under sudo as the routines expect to be run that way.

Anybody have any ideas?


For posterity's sake:

I added a .close() method to the class being tested which destroys its big data structures; then I added a tearDownClass 
method to the unittest.  That seems to have done the trick with getting the tests to /all/ run, and by apps don't 
suddenly disappear.  :)


--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Slightly OT - using PyUIC from Eclipse

2014-04-30 Thread Steve Simmons

  
  

On 30/04/2014 23:49, Fabio Zadrozny
  wrote:


  

  On Wed, Apr 30, 2014 at 8:39 AM,
Steve Simmons 
wrote:
I'm trying to set up a
  new dev environment using Windows 7; Eclipse (Kepler);
  Python 3.3; PyDev and PyQt 5 and I've hit an issue getting
  PyUIC to generate a python Qt class from within Eclipse.
  
  I'm using the following setup process (from Google Groups)
   modified to match my PyQt5 configuration:
  
  1. Click Run -> External Tools -> External Tools
  Configurations ...
  2. In the resulting dialog, click 'New' icon in the top
  left
  3. Under 'Name' put 'PyUIC'
  4. Under 'Location' enter 'C:\Program
  Files\Python\2.5\Python.exe' or
  the path to your Python executable (probably
  C:\Python25\Python.exe)
  5. Under 'Arguments' enter '"C:\Program
  Files\Python\2.5\Lib\site-
  packages\PyQt4\uic\pyuic.py"  "${resource_loc}"'
  substituting the path
  to your PyQt4 installation - be sure also to include the
  double quotes
  6. Change to the 'Common' tab and check 'File' under
  'Standard Input/
  Output' and enter '${resource_loc}.py'
  7. Change to the 'Build' tab and uncheck 'Build before
  launch'
  8. Change to the 'Refresh' tab and check 'Refresh
  resources upon
  completion'
  9. Click 'Apply' then 'Run'
  
  and I'm getting the following traceback:
  
  Traceback (most recent call last):
    File "D:\Development\Python33\Lib\site-packages\PyQt5\uic\pyuic.py",
  line 28, in 
      from .driver import Driver
  SystemError: Parent module '' not loaded, cannot perform
  relative import
  
  I tried this on Qt4 a week or so ago and it worked OK but
  Qt5 is giving me an error message, so I guess I've either
  mis-transcribed or there's a difference in the directory
  structure betwee PyQt4 & PyQt5.
  
  I'm more interested to learn how to read the traceback
  (insightfully) and track it to the source of the problem,
  although it would be good to have it working too!!
  
  Steve Simmons

  PS Also posted to PyQT list.
  -- 
  https://mail.python.org/mailman/listinfo/python-list

  
  


  The problem is that a main module cannot perform relative
  imports on Python. To overcome that limitation, Python created
  a workaround to execute a module with:
  
  python -m 'module.name'
  

So, If you execute Python as:
  

python -m PyQt5.uic.pyuic
  


  (instead of "python C:\Program
  Files\Python\2.5\Lib\site-packages\PyQt5\uic\pyuic.py")
  

it should work.
  

If you want, you can read an answer on
  http://stackoverflow.com/questions/14132789/python-relative-imports-for-the-billionth-time
  for more details on why it doesn't work and the other way
  does...



Cheers,
  
  Fabio



  

Thanks Fabio, just what I needed. I've started to read the SO posts
and relevant PEP but my brain is fried (it is 01:45 here) so I'll
have a better read in the morning and 'play' with some modules so
that I properly understand what's going on.

Regards

Steve 
  

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]

2014-04-30 Thread Ryan Hiebert
On Wed, Apr 30, 2014 at 9:02 AM, Ethan Furman  wrote:

> On 04/30/2014 06:14 AM, Ethan Furman wrote:
>
>> On 04/29/2014 03:51 PM, Chris Angelico wrote:
>>
>>> On Wed, Apr 30, 2014 at 8:42 AM, emile  wrote:
>>>
 On 04/29/2014 01:16 PM, Adam Funk wrote:

  "A man pitches his tent, walks 1 km south, walks 1 km east, kills a
> bear, & walks 1 km north, where he's back at his tent.  What color is
> the bear?"  ;-)
>


  From how many locations on Earth can someone walk one mile south, one
 mile
 east, and one mile north and end up at their starting point?

>>>
>>> Any point where the mile east takes you an exact number of times
>>> around the globe. So, anywhere exactly one mile north of that, which
>>> is a number of circles not far from the south pole.
>>>
>>
>> It is my contention, completely unbacked by actual research, that if you
>> find such a spot (heading a mile east takes you
>> an integral number of times around the pole), that there is not enough
>> Earth left to walk a mile north so that you could
>> then turn-around a walk a mile south to get back to such a location.
>>
>
> Wow.  It's amazing how writing something down, wrongly (I originally had
> north and south reversed), correcting it, letting some time pass (enough to
> post the message so one can be properly embarrassed ;), and then rereading
> it later can make something so much clearer!
>
> Or maybe it was the morning caffeine.  Hmmm.
>
> At any rate, I withdraw my contention, it is clear to me now (at least
> until the caffeine wears off).
>
> Sure, but that still leaves the nagging problem that there aren't any
Polar Bears in Antarctica (as someone else pointed out). This man must have
brought a bear with him.


Perhaps the story is something like this:

A man near the south pole takes his dear friend and pet bear for a walk.
He'd gone to great lengths to bring his pet bear with him to his Antarctic
expedition, and his bear is his best friend, and sole companion, save for
the constant, biting cold. They walk toward the pole, then begin their
excursion eastward, encircling the pole.

As the man grows weary, and decides to head back, a legion of penguins
collaborate with a host of Weddell seals to be rid of their uninvited
guests. It isn't clear what the man did to cause those seals to rise
against him, but it must have been some dire feat, for Weddell seals are
not easily frightened.

After a fierce battle, the man and his bear (well, mostly the bear) manage
to defend themselves against the attacking throng. However, the new peace
realizes a terrible fate: his bear is mortally wounded, and is suffering
immensely. The man, loving his friend dearly, shoots his solitary
compatriot, and weeps as he watches the blood turn his dear bear's fur an
ominous red.

Overcome with grief, he heads back north to his tent to mourn his loss, and
to arrange his trip north to the populated tropics, where he hopes to
forget his troubles, and the place where he lost his closet pal, a bear.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]

2014-04-30 Thread Ian Kelly
On Wed, Apr 30, 2014 at 7:14 AM, Ethan Furman  wrote:
> On 04/29/2014 03:51 PM, Chris Angelico wrote:
>>
>> On Wed, Apr 30, 2014 at 8:42 AM, emile  wrote:
>>>
>>> On 04/29/2014 01:16 PM, Adam Funk wrote:
>>>
 "A man pitches his tent, walks 1 km south, walks 1 km east, kills a
 bear, & walks 1 km north, where he's back at his tent.  What color is
 the bear?"  ;-)
>>>
>>>
>>>
>>>  From how many locations on Earth can someone walk one mile south, one
>>> mile
>>> east, and one mile north and end up at their starting point?
>>
>>
>> Any point where the mile east takes you an exact number of times
>> around the globe. So, anywhere exactly one mile north of that, which
>> is a number of circles not far from the south pole.

It also works if your starting point is (precisely) the north pole.  I
believe that's the canonical answer to the riddle, since there are no
bears in Antarctica.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Slightly OT - using PyUIC from Eclipse

2014-04-30 Thread Steven D'Aprano
On Thu, 01 May 2014 01:49:25 +0100, Steve Simmons wrote:

> 
>   
> 
>   
>   
> 
> On 30/04/2014 23:49, Fabio Zadrozny
>   wrote:
> 
>  cite="mid:CANXBEFrqndqCeT-9Hgqz7jRCZcmp8nz4VE+ebf-BKsYr54qQqQ
> @mail.gmail.com"
>   type="cite">

And that's about where I stopped reading.

I'm sorry Steve, but you're writing to a programmer's forum here, and you 
should be sending in plain text, not so-called "rich text" (actually HTML 
code, as you can see). At the very least, if you absolutely must send 
HTML code, you should instruct your mail program to also send plain text.

People are reading this via Usenet and email and possibly using other 
ways as well. Depending on how they are receiving your post, sending HTML 
may be considered rude and a breach of etiquette (e.g. text-based news 
groups typically ban binary attachments, including HTML), or their client 
may not support HTML, or they may simply choose not to receive or read 
such posts. (Pure HTML is one of the most reliable signs of spam email.)

So I'm afraid that I have no idea what you were trying to say in your 
post. Manually deciphering the message from the markup was too painful. 
I'm not likely to be the only one. If you would care to try again using 
plain text, you may get a better response rate.



-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


freeze.py

2014-04-30 Thread Ethan Furman

I'm running ubuntu 13.04, I have installed python2.7-dev and python2.7-example, 
but when I try to run freeze.py I get:

  Error: needed directory /usr/lib/python2.7/config not found

I have the source for Python2.7 which I configured and built, but a search in 
that tree for a config file was fruitless.

Any help greatly appreciated.

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]

2014-04-30 Thread Terry Reedy

On 4/30/2014 7:46 PM, Ian Kelly wrote:


It also works if your starting point is (precisely) the north pole.  I
believe that's the canonical answer to the riddle, since there are no
bears in Antarctica.


For the most part, there are no bears within a mile of the North Pole 
either. "they are rare north of 88°" (ie, 140 miles from pole).

https://en.wikipedia.org/wiki/Polar_bears
They mostly hunt in or near open water, near the coastlines.

I find it amusing that someone noticed and posted an alternate, 
non-canonical  solution. How might a bear be near the south pole? As 
long as we are being creative, suppose some jokester mounts a near 
life-size stuffed black bear, made of cold-tolerant artificial 
materials, near but not at the South Pole. The intent is to give fright 
to naive newcomers. Someone walking in a radius 1/2pi circle about the 
pole might easily see it.


--
Terry Jan Reedy



--
https://mail.python.org/mailman/listinfo/python-list


Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]

2014-04-30 Thread Chris Angelico
On Thu, May 1, 2014 at 9:46 AM, Ian Kelly  wrote:
> It also works if your starting point is (precisely) the north pole.  I
> believe that's the canonical answer to the riddle, since there are no
> bears in Antarctica.

Yeah but that's way too obvious! Anyway, it's rather hard to navigate
due south from the north pole. Which way do you go? How do you know
you're still going due south? Will the rocket even light in that
climate?

Important questions must be answered!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: freeze.py

2014-04-30 Thread Ben Finney
Ethan Furman  writes:

> I'm running ubuntu 13.04, I have installed python2.7-dev and
> python2.7-example, but when I try to run freeze.py I get:
>
>   Error: needed directory /usr/lib/python2.7/config not found

Where is ‘freeze.py’? Is there documentation provided for the
installation of that tool?

What exact command do you issue in order to run it?

-- 
 \“I fly Air Bizarre. You buy a combination one-way round-trip |
  `\ticket. Leave any Monday, and they bring you back the previous |
_o__) Friday. That way you still have the weekend.” —Steven Wright |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Slightly OT - using PyUIC from Eclipse

2014-04-30 Thread Mark H Harris

On 4/30/14 8:50 PM, Steven D'Aprano wrote:

On Thu, 01 May 2014 01:49:25 +0100, Steve Simmons wrote:



   
 
   
   
 
 On 30/04/2014 23:49, Fabio Zadrozny
   wrote:
 
 


And that's about where I stopped reading.


Post as quote:


I'm trying to set up a new dev environment using Windows 7;
Eclipse (Kepler); Python 3.3; PyDev and PyQt 5 and I've hit an
issue getting PyUIC to generate a python Qt class from within Eclipse.

I'm using the following setup process (from Google Groups)  modified
to match my PyQt5 configuration:

1. Click Run -> External Tools -> External Tools Configurations ...
2. In the resulting dialog, click 'New' icon in the top left
3. Under 'Name' put 'PyUIC'
4. Under 'Location' enter 'C:\Program Files\Python\2.5\Python.exe' or
the path to your Python executable (probably C:\Python25\Python.exe)
5. Under 'Arguments' enter '"C:\Program Files\Python\2.5\Lib\site-
packages\PyQt4\uic\pyuic.py"  "${resource_loc}"' substituting the path
to your PyQt4 installation - be sure also to include the double quotes
6. Change to the 'Common' tab and check 'File' under 'Standard Input/
Output' and enter '${resource_loc}.py'
7. Change to the 'Build' tab and uncheck 'Build before launch'
8. Change to the 'Refresh' tab and check 'Refresh resources upon
completion'
9. Click 'Apply' then 'Run'



and I'm getting the following traceback:



Traceback (most recent call last):
  File "D:\Development\Python33\Lib\site-packages\PyQt5\uic\pyuic.py",
line 28, in 
from .driver import Driver
SystemError: Parent module '' not loaded, cannot perform relative import
I tried this on Qt4 a week or so ago and it worked OK but Qt5 is giving me
an error message, so I guess I've either mis-transcribed or there's a difference
in the directory structure betwee PyQt4 & PyQt5.

I'm more interested to learn how to read the traceback (insightfully) and
track it to the source of the problem, although it would be good to have it 
working too!!

Steve Simmons

PS Also posted to PyQT list.


Cheers



--
https://mail.python.org/mailman/listinfo/python-list


Re: freeze.py

2014-04-30 Thread Ethan Furman

On 04/30/2014 07:42 PM, Ben Finney wrote:

Ethan Furman  writes:


I'm running ubuntu 13.04, I have installed python2.7-dev and
python2.7-example, but when I try to run freeze.py I get:

   Error: needed directory /usr/lib/python2.7/config not found


Where is ‘freeze.py’? Is there documentation provided for the
installation of that tool?

What exact command do you issue in order to run it?


I think I have that part of it solved:

  make libainstall  # not sure this was necessary, but it (re)copies
# the wanted files into /usr/local/ib/python2.7/config

  .../python2.7/Tools/freeze/freeze.py -P /usr/local/  # so freeze looks in the 
right place

Now I just have to figure out how to get _ctypes included...

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread Mark H Harris

On 4/30/14 7:02 PM, Dennis Lee Bieber wrote:

Sterling?  Snort.  K&E was the way to go.


   Absolutely, snort.  I still have my K&E (Keuffel & Esser Co. N.Y.); 
made of wood... (when ships were wood, and men were steel, and sheep ran 
scared) ... to get to the S L T scales I have to pull the slide out 
(turn it over) and reinsert it. You're right, the CF and DF scales are 
missing, but the A B scales have the π symbol where it should be (more 
or less).  Mine is the 4058 C model, and you're right... has maths 
equivalents and conversions printed on the back...



I've misplaced the Sterling, but I'm fairly sure it was a deci-trig
log-log model.


   My high school '74 was the last class to learn the slide-rule using 
the Sterling (we paid a deposit to use the school's). I returned my 
Sterling to the teacher at year-end and got my deposit back. They are 
all probably in an old card-board box in the basement. I should ask.




In the last 15-20 years I've added NIB versions of Faber-Castell 1/54
Darmstadt, Pickett N-803-ES Dual-Base Log-Log, Pickett Cleveland Institute
of Electronics N-515-T, and a pair of Sama&Etani/Concise circular pocket
rules (models 200 and 600).


   I received my Pickett Model N4-T Vector-Type Log Log Dual-Base Speed 
Rule as a graduation | birthday gift... off to college with a leather 
cased slip stick hanging from my belt (I was invincable).  Mine had the 
CF/m DF/m scales also -- folded at 2.3, the loge of 10 with π where it 
should be (more or less).  Copyright 1959... that baby was the king of 
slide rules...  I pull it out from time to time, just for warm feelings.




Heh... I wonder if the VEs would have noticed the CIE rule had lots of
electronics formulas on the back, if I'd taken it to the exam session where
I passed both General and Amateur Extra tests. I couldn't take a calculator
-- all of mine were programmable. But the slide-rule I took was just about
as perplexing to the VEs.



   I carried my slide rule to my general class exam as well. The VE 
inspected it to be sure that certain stuff was not written in pencil 
between the scales! True story. Its not required today, of course, but I 
can still send/receive at 20 wpm. 


marcus   W0MHH
'73




--
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread Paul Rubin
Mark H Harris  writes:
>I received my Pickett Model N4-T Vector-Type Log Log Dual-Base
> Speed Rule as a graduation | birthday gift...

There is a nice Javascript simulation of the N4-ES here:

http://www.antiquark.com/sliderule/sim/n4es/virtual-n4es.html

Some other models are also on that site.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Significant digits in a float?

2014-04-30 Thread Mark H Harris

On 4/30/14 10:56 PM, Paul Rubin wrote:


There is a nice Javascript simulation of the N4-ES here:

http://www.antiquark.com/sliderule/sim/n4es/virtual-n4es.html



Thank you!

The N4-ES and the N4-T (mine) are essentially the same rule. The N4-ES 
on the site is yellow (mine is white) and the site rule indicates Picket 
& Eckel Inc. (that's where the E comes from)  Also the the ES states 
Chicage Ill USA where the T states Made in USA.


The only technical difference is the T scale (which is folded-expanded 
on both). On the ES the T scale is listed only once in the margin.  On 
the N4-T the T scale is listed 'twice'!--  once for each part of the 
fold.  Well, that gives (2) scales instead of one --for T...  increasing 
the number of scales on the rule from 34 to 35... if I'm counting right. 
 Which makes the N4-T more valuable... supposedly.  I don't plan are 
parting with it... till I croak, then my son (who is studying 
engineering this fall) will inherit it...  heh   he won't have a clue 
what to do with it !


The simulated rule on the site above is fabulous... especially if viewed 
from a large wide LED.  ... simply fabulouso/:)




marcus
--
https://mail.python.org/mailman/listinfo/python-list


Re: Unicode 7

2014-04-30 Thread Steven D'Aprano
On Tue, 29 Apr 2014 21:53:22 -0700, Rustom Mody wrote:

> On Tuesday, April 29, 2014 11:29:23 PM UTC+5:30, Tim Chase wrote:
>> While I dislike feeding the troll, what I see here is:
> 
> 
> 
> Since its Unicode-troll time, here's my contribution
> http://blog.languager.org/2014/04/unicode-and-unix-assumption.html


I disagree with much of your characterisation of the Unix assumption, and 
I point out that out of the two most widespread flavours of OS today, 
Linux/Unix and Windows, it is *Windows* and not Unix which still 
regularly uses legacy encodings.

Also your link to Joel On Software mistakenly links to me instead of Joel.

There's a missing apostrophe in "Ive" [sic] in Acknowledgment #2.

I didn't notice any other typos.


-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unicode 7

2014-04-30 Thread wxjmfauth
Le mercredi 30 avril 2014 20:48:48 UTC+2, Tim Chase a écrit :
> On 2014-04-30 00:06, wxjmfa...@gmail.com wrote:
> 
> > @ Time Chase
> 
> > 
> 
> > I'm perfectly aware about what I'm doing.
> 
> 
> 
> Apparently, you're quite adept at appending superfluous characters to
> 
> sensible strings...did you benchmark your email composition, too? ;-)
> 
> 
> 
> -tkc (aka "Tim", not "Time")

Mea culpa, ...

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Off-topic circumnavigating the earth in a mile or less [was Re: Significant digits in a float?]

2014-04-30 Thread Gregory Ewing

Terry Reedy wrote:
For the most part, there are no bears within a mile of the North Pole 
either. "they are rare north of 88°" (ie, 140 miles from pole).

https://en.wikipedia.org/wiki/Polar_bears
They mostly hunt in or near open water, near the coastlines.


The way things are going, the coastline might be
within a mile of the north pole quite soon.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list