Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Chris Angelico
On Sun, Jul 14, 2013 at 3:18 PM, Νικόλας wrote: > Can we get the location serived from lat/long coordinates? Yes, assuming you get accurate latitude and longitude, so you're back to square 1. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Νικόλας
Can we get the location serived from lat/long coordinates? Using a mapping service you can create a query that asks "what is the smallest region that contains points [(x1, y1), (x2, y2),...]" and use that as our geolocate answer? That should work, can you show me how such thing can be done pl

Beazley 4E P.E.R, Page29: Unicode

2013-07-13 Thread vek . m1234
http://stackoverflow.com/questions/17632246/beazley-4e-p-e-r-page29-unicode "directly writing a raw UTF-8 encoded string such as 'Jalape\xc3\xb1o' simply produces a nine-character string U+004A, U+0061, U+006C, U+0061, U+0070, U+0065, U+00C3, U+00B1, U+006F, which is probably not what you intend

Re: [Python-ideas] float('∞')=float('inf')

2013-07-13 Thread Chris Angelico
On Sun, Jul 14, 2013 at 1:04 PM, Steven D'Aprano wrote: > On Sun, 14 Jul 2013 11:53:55 +1000, Chris Angelico wrote: > >> Doh, I forgot which channel this was on again :( It feels like a >> python-list thread. > > > Can't you just hit Reply-List or even Reply-All? I don't like Reply-All as it's to

Re: [Python-ideas] float('∞')=float('inf')

2013-07-13 Thread Steven D'Aprano
On Sun, 14 Jul 2013 11:53:55 +1000, Chris Angelico wrote: > Doh, I forgot which channel this was on again :( It feels like a > python-list thread. Can't you just hit Reply-List or even Reply-All? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: UTF-EBCDIC encoding?

2013-07-13 Thread Jorge Mazzonelli
Hi, Regarding your second part of your mail, I have used in the past this page[1] as a base for code to process a mainframe PS file with packed decimals. May be it can help you a bit... Best regards, Jorge [1]: http://www.linuxtopia.org/online_books/programming_books/python_programming/python_ch

Re: [Python-ideas] float('∞')=float('inf')

2013-07-13 Thread Chris Angelico
On Sun, Jul 14, 2013 at 11:53 AM, Chris Angelico wrote: > On Sun, Jul 14, 2013 at 11:39 AM, Joshua Landau wrote: >> On 14 July 2013 02:24, Steven D'Aprano wrote: >>> and on-going costs: >>> >>> - that's one more thing for every user to learn; >> >> Doesn't apply here. > > Yes, it does; what happ

Re: [Python-ideas] float('∞')=float('inf')

2013-07-13 Thread Chris Angelico
On Sun, Jul 14, 2013 at 11:39 AM, Joshua Landau wrote: > On 14 July 2013 02:24, Steven D'Aprano wrote: >> and on-going costs: >> >> - that's one more thing for every user to learn; > > Doesn't apply here. Yes, it does; what happens to someone who reads someone else's Python code? To write code,

Re: How to read Mozrepl Javascript result into a Python Variable?

2013-07-13 Thread Chris Angelico
On Sun, Jul 14, 2013 at 6:49 AM, goldtech wrote: > Hi, > > With Mozrepl addon in Firefox and Python I do: > import telnetlib tn = telnetlib.Telnet(r'127.0.0.1', 4242, 5) tn.read_eager() > '\nWelcome to MozRepl.\n\n - If you get stuck at the "' tn.read_until("repl> ") > ...snip.

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread Neil Hodgson
wxjmfa...@gmail.com: The FSR is naive and badly working. I can not force people to understand the coding of the characters [*]. You could at least *try*. If there really was a problem with the FSR and you truly understood this problem then surely you would be able to communicate the pr

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Chris Angelico
On Sun, Jul 14, 2013 at 4:28 AM, Νικόλας wrote: > So it seems that all boil down to the way the ISP configure its blocks of ip > addresses per city. > > All should do the same and then it would be an easy task to accurately > identify a visitor by its ip address. So every ISP in the world needs t

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Michael Torrie
On 07/13/2013 12:23 PM, Νικόλας wrote: > Do you know a way of implementing anyone of these methods to a script? Yes. Modern browsers all support a location API in the browser for javascript. See this: http://diveintohtml5.info/geolocation.html -- http://mail.python.org/mailman/listinfo/python

How to read Mozrepl Javascript result into a Python Variable?

2013-07-13 Thread goldtech
Hi, With Mozrepl addon in Firefox and Python I do: >>> import telnetlib >>> tn = telnetlib.Telnet(r'127.0.0.1', 4242, 5) >>> tn.read_eager() '\nWelcome to MozRepl.\n\n - If you get stuck at the "' >>> tn.read_until("repl> ") ...snip... >>> tn.write(r'alert(window.content.location.href)'+"\n") an

Re: RE Module Performance

2013-07-13 Thread Tim Delaney
On 13 July 2013 09:16, MRAB wrote: > On 12/07/2013 23:16, Tim Delaney wrote: > >> On 13 July 2013 03:58, Devyn Collier Johnson > > wrote: >> >> >> Thanks for the thorough response. I learned a lot. You should write >> articles on Python. >> I plan to

Re: Ideal way to separate GUI and logic?

2013-07-13 Thread Wayne Werner
On Sat, 13 Jul 2013, fronag...@gmail.com wrote: Well, I'm a newcome to Python, but I'm developing a program with a GUI in tkinter, and I'm wondering what is the best, 'most pythonic' way of doing this? I could, obviously, write a monolithic block of code. True, you could, but don't do that.

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread Dave Angel
On 07/13/2013 10:37 AM, wxjmfa...@gmail.com wrote: The FSR is naive and badly working. I can not force people to understand the coding of the characters [*]. That would be very hard, since you certainly do not. I'm the first to recognize that Python and/or Pike are free to do what they wis

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Wayne Werner
On Sat, 13 Jul 2013, Νικόλας wrote: But it works for me, How can it be impossible and worked for me at the same time? 2 + 2 = 4 2 + 6 = 8??? Why can't I make 2 and 6 equal 4? It worked for 2, so I know it's not impossible! I don't care what everyone says, I was able to make one case work so ob

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Roy Smith
In article , ÉΪɫɻόλας wrote: > > There are lots of interesting (and superior) ways to do geolocation > > other than looking up IP addresses. Here's a few: > . [...] > > In general, mobile operating systems control direct access to all of > > these signals and only allow applications

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Νικόλας
Στις 13/7/2013 9:21 μμ, ο/η Dennis Lee Bieber έγραψε: On Sat, 13 Jul 2013 20:43:14 +0300, ??? declaimed the following: But then how do you explain the fact that http://www.maxmind.com/en/geoip_demo pinpointed Thessalon�ki and not Athens and for 2 friends of mine that use the same ISP as me

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Νικόλας
Στις 13/7/2013 9:19 μμ, ο/η Roy Smith έγραψε: In article , ÉΪɫɻόλας wrote: But then how do you explain the fact that http://www.maxmind.com/en/geoip_demo pinpointed Thessalon£ki and not Athens and for 2 friends of mine that use the same ISP as me but live in different cities also accuratel

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Roy Smith
In article , ÉΪɫɻόλας wrote: > But then how do you explain the fact that > http://www.maxmind.com/en/geoip_demo pinpointed Thessalon£ki and not > Athens and for 2 friends of mine that use the same ISP as me but live > in different cities also accurately identified their locations

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Νικόλας
Στις 13/7/2013 7:54 μμ, ο/η Dennis Lee Bieber έγραψε: Are you paying for a fixed IP number? I suspect you are if you were running a world-accessible server. Obviously a fixed IP will be tied to a fixed connection and thereby to a fixed location which can be provided to a location

Re: Ideal way to separate GUI and logic?

2013-07-13 Thread Dave Cook
On 2013-07-13, fronag...@gmail.com wrote: > I'm wondering what is the best, 'most pythonic' way I recommend PyPubsub: http://pubsub.sourceforge.net/ Dave Cook -- http://mail.python.org/mailman/listinfo/python-list

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > Obviously a fixed IP will be tied to a fixed connection and thereby to > a fixed location which can be provided to a location database. And even then, it can be wrong. When I worked for EMC, they (apparently, from what I could see) back-hauled internet

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Chris Angelico
On Sun, Jul 14, 2013 at 2:54 AM, Dennis Lee Bieber wrote: > Are you paying for a fixed IP number? I suspect you are if you were > running a world-accessible server. > > Obviously a fixed IP will be tied to a fixed connection and thereby to > a fixed location which can be provided t

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Roy Smith
In article , ÉΪɫɻόλας wrote: > But it works for me, How can it be impossible and worked for me at the > same time? > > Also i tried some other website that asked me to allow it to run a > javascript on my browser and it pinpointed even my street! > > If it wasnt possbile then Max

Re: help with explaining how to split a list of tuples into parts

2013-07-13 Thread Roy Smith
In article <892e3baa-b214-4c57-a828-a51db0ff7...@googlegroups.com>, pe...@ifoley.id.au wrote: > In my defence I was trying to give some context for my problem domain. I think posting a link to the github page was perfectly fine. It wasn't a huge amount of code to look at, and the way github pr

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread wxjmfauth
Le samedi 13 juillet 2013 11:49:10 UTC+2, Steven D'Aprano a écrit : > On Sat, 13 Jul 2013 00:56:52 -0700, wxjmfauth wrote: > > > > > You are confusing the knowledge of a coding scheme and the intrisinc > > > information a "coding scheme" *may* have, in a mandatory way, to work > > > properly.

Re: help with explaining how to split a list of tuples into parts

2013-07-13 Thread Roy Smith
In article , pe...@ifoley.id.au wrote: > Hi List, > > I am new to Python and wondering if there is a better python way to do > something. As a learning exercise I decided to create a python bash script > to wrap around the Python Crypt library (Version 2.7). > > My attempt is located here -

Re: Ideal way to separate GUI and logic?

2013-07-13 Thread Roland Koebler
Hi, > But how then do I separate out the logic and the GUI? I usually write a library (C library, Python module, ...) which contains the logic. Then, I write a GUI (in a separate file), which imports and uses the library. If I need another UI (e.g. GUI with an other toolkit, or a text-based or HT

Re: help with explaining how to split a list of tuples into parts

2013-07-13 Thread peter
On Saturday, 13 July 2013 18:11:18 UTC+10, Steven D'Aprano wrote: > On Fri, 12 Jul 2013 23:43:55 -0700, peter wrote: > > > > I am new to Python and wondering if there is a better python way to do > > A Python bash script? What does that mean? Python and bash are two > different languages. Sorr

Re: help with explaining how to split a list of tuples into parts

2013-07-13 Thread peter
On Saturday, 13 July 2013 17:28:50 UTC+10, Peter Otten wrote: > > Every time when you have to look up something you should think 'dict', and I > > expect that pretty that will happen automatically. > > Also, to split a tuple into its items you can "unpack" it: > > > > triple = (1, 2, 3) > >

Re: Ideal way to separate GUI and logic?

2013-07-13 Thread Steven D'Aprano
On Sat, 13 Jul 2013 04:07:21 -0700, fronagzen wrote: > Well, I'm a newcome to Python, but I'm developing a program with a GUI > in tkinter, and I'm wondering what is the best, 'most pythonic' way of > doing this? > > I could, obviously, write a monolithic block of code. > > I can define the logi

Ideal way to separate GUI and logic?

2013-07-13 Thread fronagzen
Well, I'm a newcome to Python, but I'm developing a program with a GUI in tkinter, and I'm wondering what is the best, 'most pythonic' way of doing this? I could, obviously, write a monolithic block of code. I can define the logic and the GUI as two separate classes and then call from those cla

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread Chris Angelico
On Sat, Jul 13, 2013 at 7:49 PM, Steven D'Aprano wrote: > Ironically, Python has done the same thing for integers for many versions > too. They just didn't call it "Flexible Integer Representation", but > that's what it is. For integers smaller than 2**31, they are stored as C > longs (plus object

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread Steven D'Aprano
On Sat, 13 Jul 2013 00:56:52 -0700, wxjmfauth wrote: > You are confusing the knowledge of a coding scheme and the intrisinc > information a "coding scheme" *may* have, in a mandatory way, to work > properly. These are conceptualy two different things. *May* have, in a *mandatory* way? JMF, I kno

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread Chris Angelico
On Sat, Jul 13, 2013 at 5:56 PM, wrote: > Try to write an editor, a text widget, with with a coding > scheme like the Flexible String Represenation. You will > quickly notice, it is impossible (understand correctly). > (You do not need a computer, just a sheet of paper and a pencil) > Hint: what

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread Steven D'Aprano
On Sat, 13 Jul 2013 00:56:52 -0700, wxjmfauth wrote: > I am convinced you are not conceptually understanding utf-8 very well. I > wrote many times, "utf-8 does not produce bytes, but Unicode Encoding > Units". Just because you write it many times, doesn't make it correct. You are simply wrong. U

Bluetooth Sockets

2013-07-13 Thread Simfake Fake
Hi. I'm trying to connect to a bluetooth serial adaptor using python 3.x. However, in python 3.3.2 win x32, I get "AttributeError: module has no attribute AF_..." when trying to use socket.AF_BLUETOOTH, despite the docs http://docs.python.org/3.3/library/socket.html . The code I have is very simila

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread Lele Gaifax
wxjmfa...@gmail.com writes: > Try to write an editor, a text widget, with with a coding > scheme like the Flexible String Represenation. You will > quickly notice, it is impossible (understand correctly). > (You do not need a computer, just a sheet of paper and a pencil) > Hint: what is the charac

Re: help with explaining how to split a list of tuples into parts

2013-07-13 Thread Steven D'Aprano
On Fri, 12 Jul 2013 23:43:55 -0700, peter wrote: > Hi List, > > I am new to Python and wondering if there is a better python way to do > something. As a learning exercise I decided to create a python bash > script to wrap around the Python Crypt library (Version 2.7). A Python bash script? What

Re: GeoIP2 for retrieving city and region ?

2013-07-13 Thread Lele Gaifax
Νικόλας writes: > But it works for me, How can it be impossible and worked for me at the > same time? Read the answers you got. What is *impossible* is *exactly and precisely* find the geographical location of your machine, just using an IP database like what you are doing, i.e. without your loc

Re: hex dump w/ or w/out utf-8 chars

2013-07-13 Thread wxjmfauth
Le vendredi 12 juillet 2013 04:16:21 UTC+2, Chris Angelico a écrit : > On Fri, Jul 12, 2013 at 4:42 AM, wrote: > > > BTW, since > > > when a serious coding scheme need an extermal marker? > > > > > > > All of them. > > > > Content-type: text/plain; charset=UTF-8 > > > > ChrisA --

Re: help with explaining how to split a list of tuples into parts

2013-07-13 Thread Peter Otten
pe...@ifoley.id.au wrote: > Hi List, > > I am new to Python and wondering if there is a better python way to do > something. As a learning exercise I decided to create a python bash > script to wrap around the Python Crypt library (Version 2.7). > > My attempt is located here - https://gist.git

Re: How do I get the OS System Font Directory(Cross-Platform) in python?

2013-07-13 Thread Steven D'Aprano
On Fri, 12 Jul 2013 23:38:18 -0700, Metallicow wrote: > On Saturday, July 13, 2013 12:36:45 AM UTC-5, Tim Roberts wrote: >> Really? Because Windows is the ONLY one of the major operating systems >> >> that actually has a dedicated system fonts directory. Linux doesn't >> even >> >> have a dedi