Re: Comparing lists
On Mon, 16 Aug 2010 13:46:07 +0300, Francesco Bochicchio wrote: anybody can point me to a description of how the default comparison of list objects (or other iterables) works? Sequences of the same type are compared using lexicographical ordering: http://docs.python.org/tutorial/datastructures.html#comparing-sequences-and-other-types -- http://mail.python.org/mailman/listinfo/python-list
Re: Deditor -- pythonic text-editor
On Mon, 16 Aug 2010 14:26:09 +0300, Peter Otten <__pete...@web.de> wrote: Steven D'Aprano wrote: If nobody asks for any changes, then just keep doing what you're doing. Or you can introduce a bug; if your users don't start complaining you don't have any... Even that doesn't work. They may blog or tweet about it, complain on foreign forums, and set up petitions about it, but they will never, EVER send you an email. It's very disheartening. -- http://mail.python.org/mailman/listinfo/python-list
Re: Test for Pythonwin?
"steve" wrote: Is there a good way to check if a script is running inside Pythonwin? Perhaps a property or method that is exposed by that environment? I don't know how foolproof it is, but this works: 'pywin' in sys.modules -- http://mail.python.org/mailman/listinfo/python-list
Re: Get Cliet IP Address
"Fred Atkinson" wrote: What is the function to obtain the client browser's IP address? Do you mean the external public IP to the Internet? When I wanted to log the dynamic IP that my ADSL connection gets, I used whatismyip.com like this: import urllib2 QUERY_URL = 'http://www.whatismyip.com/automation/n09230945.asp' def query(): """Get IP as a string. As per the whatismyip.com automation rules, this function should not be called more ofter than every 5 minutes. """ return urllib2.urlopen(QUERY_URL).read() There's probably a better way, but I'm not very good with networking. :o) -- http://mail.python.org/mailman/listinfo/python-list
Re: unique-ifying a list
"kj" wrote: I suppose that I could write something like def uniquify(items): seen = set() ret = [] for i in items: if not i in seen: ret.append(i) seen.add(i) return ret But this seems to me like such a commonly needed operation that I find it hard to believe one would need to resort to such self-rolled solutions. Isn't there some more standard (and hopefully more efficient, as in "C-coded"/built-in) approach? The most "standard" way is a recipe from the itertools docs (I'd give a link, but python.org is down at the moment): def unique_everseen(iterable, key=None): "List unique elements, preserving order. Remember all elements ever seen." # unique_everseen('BBBCCDAABBB') --> A B C D # unique_everseen('ABBCcAD', str.lower) --> A B C D seen = set() seen_add = seen.add if key is None: for element in iterable: if element not in seen: seen_add(element) yield element else: for element in iterable: k = key(element) if k not in seen: seen_add(k) yield element All the recipes mentioned there are pretty handy, so I've made a module (iterutil.py) out of them. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pywin32 @ windows 7
"Dennis Lee Bieber" wrote: Ever consider that the name has WIN32 in, and not WIN64, for a reason? Win32 is a misnomer; it just means "non-Win16". The same API exists in Windows x64 (with pointers expanded to 64-bit, of course). -- http://mail.python.org/mailman/listinfo/python-list
Re: Pywin32 @ windows 7
"Algirdas Brazas" wrote: Did anyone manage to get windows extensions installet on windows 7 64 bit? As far as I try I get only "Setup program invalid or damaged". Try downloading the installer again. It should work then. I haven't tested it on Win7, but my Vista machine has Python and pywin32 x64. -- http://mail.python.org/mailman/listinfo/python-list
Re: www.python.org website is down?
"Caezar" wrote: I cannot connect to the official Python website. [snip] Are you experiencing the same problem? Yes, it's been down for a while. A useful site to check in such occasions is http://downforeveryoneorjustme.com/. -- http://mail.python.org/mailman/listinfo/python-list
Re: Bug or feature: double strings as one
"Carl Banks" wrote: http://www.geocities.com/connorbd/tarpit/magentaaarm.html (It's on Geocities, yikes, someone better archive that) http://web.archive.org/web/*/http://www.geocities.com/connorbd/tarpit/magentaaarm.html :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Pywin32 @ windows 7
"Dennis Lee Bieber" wrote: Has it been built under a 64-bit OS though? (I'll confess I've not looked -- I always install the ActiveState binary for my WinXP (32bit) system, and that library is part of the install) Yes, both Python x64 and pywin32 x64 are native 64-bit applications -- they can't even be installed on a 32-bit system. -- http://mail.python.org/mailman/listinfo/python-list
Re: Nice copy in interactive terminal
"casebash" wrote: I've been wondering for a while if there exists an interactive terminal which has nice copy feature (ie. I can copy code without getting the >>> in front of every line). It would help if we knew what platform you're interested in -- your User-Agent is G2/1.0, but I don't know what that is. :o) On Windows, PythonWin can copy from the interactive window without the prompts. -- http://mail.python.org/mailman/listinfo/python-list