Many runner fans were ecstatic to hear about these particular Air max's making a return.
Many runner fans were ecstatic to hear about these particular Air max's making a return. The Nike Air Max 90 is a prized colorway of a classic sneaker, so it only makes sense that its return would create serious buzz. Nike’s "Blue Slate" Air Max 95 has made a triumphant return to retail shelves this season from Nike Sportswear. The nickname “Slate” comes from entirely the colorway, which is White/New Green-Blue Slate-Black. The retro running shoe features white uppers and a black outsole. Blue accents are seen on areas such as the lace holders and mid-panel. While these retro running shoes were originally released back in 2005 the Air Max 95 “Slates” the new released version is different than the last time we saw these, as black has replaced navy on the top layer, and the lower two rows are the same shade of blue, instead of being slightly different. The Air Flight Family is pleased to welcome a new member to the family, the Air Max 95 basketball shoe. The Falcon appears as a younger generation of the Nike Air Flight 89. The layout of the paneling throughout the upper screams out Air Flight 89, and if you give it a good look you’ll also notice some elements taken from the Air Flight Lite. If you can’t see the Air Flight Lite in the upper you always have the “Flight F” logo on the tongue which is the same as that used on the Flight Lite. To start things off the Air Flight Falcon basketball shoe features a white/metallic silver base constructed from smooth leather and tumbled leather. From there a few hits of black and red were added in, most notably on the glossy Swoosh, Flight tongue tag, and on the Air Jordan IV sole unit, with black corduroy used on the inner lining. Breathing life into the sneakers and giving some accent coloring is red trim throughout the entire upper. Buy Nike Air Max LTD Shoes With Top Quality On airmaxmarket.com Online ,Discount On Sale Nike Air Max 90 Sneakers Fast Shipping. -- http://mail.python.org/mailman/listinfo/python-list
Re: May I discuss here issues on Machine Learning?
On Mar 22, 2011, at 7:18 PM, joy99 wrote: > My apology to pose this non python question in this forum. I am trying > to develop one Naive Bayes Classifier and one HMM with Python. But my > question is not related to Python, rather to these two models, whether > I am choosing right parameters, etc for these models. > > Python is a chosen language for machine learning and as I come here > pretty often I found this room is filled with very nice people. I > thought if some one would be interested to discuss the issues. > > If any one wants to discuss personally if he/she can post his/her > name, I would discuss with him/her. > > Sincerely sorry if I have broken norms of the room. I'd say this is not the proper forum, but a closer one would be the scipy and numpy groups. You may even be using scipy and numpy to do this, and they may be able to suggest more efficient libraries to call for doing these sorts of models. bb -- Brian Blais [email protected] http://web.bryant.edu/~bblais http://bblais.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: May I discuss here issues on Machine Learning?
On Mar 23, 2:57 pm, Brian Blais wrote: > On Mar 22, 2011, at 7:18 PM, joy99 wrote: > > > My apology to pose this non python question in this forum. I am trying > > to develop one Naive Bayes Classifier and one HMM with Python. But my > > question is not related to Python, rather to these two models, whether > > I am choosing right parameters, etc for these models. > > > Python is a chosen language for machine learning and as I come here > > pretty often I found this room is filled with very nice people. I > > thought if some one would be interested to discuss the issues. > > > If any one wants to discuss personally if he/she can post his/her > > name, I would discuss with him/her. > > > Sincerely sorry if I have broken norms of the room. > > I'd say this is not the proper forum, but a closer one would be the scipy and > numpy groups. You may even be using scipy and numpy to do this, and they may > be able to suggest more efficient libraries to call for doing these sorts of > models. > > bb > > -- > Brian Blais > [email protected]://web.bryant.edu/~bblaishttp://bblais.blogspot.com/ Thanks Brian. I'll check. I am not using Scipy/Numpy till, I thought using Decimal module, but float is giving me fine results. Any issue if I send the two or three questions? You seem to be a Professor specialized in this area. Best Regards, Subhabrata. -- http://mail.python.org/mailman/listinfo/python-list
urllib2 - not returning page expected after post
I'm trying to automate reverse-ip lookups on domaintools.com.
Everything is fine, except that I don't exactly get the data I want
after I submit a post to the site. I know the post is correct, the
return data just doesn't appear on the post. Not sure what to do at
this point. Here is the code:
#!/usr/bin/env python
import urllib2, urllib, httplib, cookielib
h=urllib2.HTTPHandler(debuglevel=1)
cj = cookielib.MozillaCookieJar()
##Add some data to the url
data = urllib.urlencode({'hostname': 'google.com'})
##Add a cookie handler
cookieHandler = urllib2.HTTPCookieProcessor(cj)
redirectionHandler = urllib2.HTTPRedirectHandler()
##Creating a request object - takes url of resource I want to retrieve
request = urllib2.Request('http://www.domaintools.com/research/reverse-
ip/', data)
##adding useragent to request object
request.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT
6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15')
##Creating a url opener; can take an number of handlers, which control
how responses are handled
opener = urllib2.build_opener(h, cookieHandler, redirectionHandler)
##tell the opener to open the url
response = opener.open(request)
text = response.read()
print text
--
http://mail.python.org/mailman/listinfo/python-list
Re: side by side python
On Mar 21, 6:31 am, Robert wrote: > Can I install Python 2.7 and 3.2 (from python.org) side by side on OSX > without them stepping all over each other? Also look at PEP 394. It makes some suggestions about installing symbolic links to each of the versions. If you do it that way, you can use Python2 for scripts that require 2.7, and Python3 for scripts that require 3.2, and they'll eventually be portable to other systems. John Roth -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Sun, Mar 13, 2011 at 12:59:55PM +, Steven D'Aprano wrote: > The removal of cmp from the sort method of lists is probably the most > disliked change in Python 3. On the python-dev mailing list at the > moment, Guido is considering whether or not it was a mistake. > > If anyone has any use-cases for sorting with a comparison function that > either can't be written using a key function, or that perform really > badly when done so, this would be a good time to speak up. How about a list of tuples where you want them sorted first item in ascending order en second item in descending order. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
Antoon Pardon, 23.03.2011 14:53: On Sun, Mar 13, 2011 at 12:59:55PM +, Steven D'Aprano wrote: The removal of cmp from the sort method of lists is probably the most disliked change in Python 3. On the python-dev mailing list at the moment, Guido is considering whether or not it was a mistake. If anyone has any use-cases for sorting with a comparison function that either can't be written using a key function, or that perform really badly when done so, this would be a good time to speak up. How about a list of tuples where you want them sorted first item in ascending order en second item in descending order. You can use a stable sort in two steps for that. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Threading with Socket Server
Hello all, I am writing a Windows service that needs to 1) Act as a server (TCP), and write to a shelve file, and 2) Read that same shelve file every x number of seconds. My thought is to create 2 separate classes (1 for the socket server and writing to the shelve file, and another to read the file and perform other requested actions) - however, I need to make sure they are both running concurrently. I'm sure threading is involved, but my experience with it has been minimal, so any help to steer me in the right direction is greatly appreciated. -- http://mail.python.org/mailman/listinfo/python-list
pth files and virtualenv
I am not understanding why paths I'm adding to a virtualenv via add2virtualenv are not working. I use this in plenty of other situations, but in this one project (which is on 3.2) I am getting strange behavior. ~/projects/fooproject/# add2virtualenv src/ ~/projects/fooproject/# python3 -c "import sys;print(sys.path)" ['', '~/projects/fooproject/' ...] See? src/ is missing from the path that gets seen by Python. Did something change in 3 that I am not realizing, which would cause this? The virtualenv_path_extensions.pth file contains the correct path to src/, which is the parent directory of the package I'm actually trying to import. -- Read my blog! I depend on your acceptance of my opinion! I am interesting! http://techblog.ironfroggy.com/ Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy -- http://mail.python.org/mailman/listinfo/python-list
Validating Command Line Options
For a Python script with multiple command line options, what is the best way to go about validating that only certain options are used together? For example, say -s, -t, and -v are all valid options, but should never be used together (i.e. -s -t would be invalid). Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Validating Command Line Options
optparse?
http://docs.python.org/library/optparse.html
if options.a and options.b:
parser.error("options -a and -b are mutually exclusive")
On Wed, Mar 23, 2011 at 2:10 PM, T wrote:
> For a Python script with multiple command line options, what is the
> best way to go about validating that only certain options are used
> together? For example, say -s, -t, and -v are all valid options, but
> should never be used together (i.e. -s -t would be invalid). Thanks
> in advance.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list
Special logging module needed
Hi All, We have a special problem that needs to be addressed. We need to have a database of log messages. These messages are not simple strings - they are data structures. The log messages are assigned to various objects. Objects can be identified with simple object identifiers (strings). We have about 10 million objects. Most of them only have one or two log messages assigned. Some of them (about 1M objects) will have 10 log messages appended each day. Fewer objects (100K) will have log messages appended even more frequently. Requirements: * The database is mostly write-only. In most of the time, we will be adding messages continuously, and we won't read them back. * Appending new messages should be fast. At least 100 messages / second. * High availability - clients must be able to add new log messages and read back old messages anytime. The service must not stop. * Database is huge. We want to preserve data for one or two years and possibly it will grow to 1TB or something. * We should be able to drop older data (e.g. log messages appended more than 2 years ago) without trouble. * We need to implement incremental backups. For example, we could have a separate database file for every day in the current month, then database files for previous months etc. The main point is that we should be able to make backup copies incrementally, and the logging service should be available at the same time. (It is not curical to have an up-to-date backup from the current day, but we want to backup everything that happened more than a day ago). * Reading back log messages will happen rarely. Average would be 5 times in every minute, and usually only for a given date range. (for example, all messages from 2010 May) But then it should be relatively fast. Even with a 1TB database, we should be able to fulfill such a request within one second. What we where doing until now, is that we have used a directory structure. Every object had a separate CSV file assigned, and new messages where appended into those CSV files. We thought that appending new messages will be fast (fopen + fwrite should be fast) and reading them back sould also be fast. But now we are suffering from these problems: * We have millions of files on disk. Very hard to synchronize them, make incremental backup copies. It is just too slow. * Sometimes the OS cannot handle requests fast enough. There are too many (at least 5million) files on the file system and they are very fragmented. In some cases it takes 10 seconds or more to open a log file for appending. CPU goes up to 100% apparently when the OS tries to open the log file. (dirhash mem already increased to 1GB but it's still not good enough.) I was thinking about using a regular SQL database, but it has problems: * Not easy to do incremental backups * Not that easy to remove old data (e.g. cannot delete 100GB data with SQL without big slowdon) * With a btree index and some 100 million rows already in a table, appending messages may not be fast enough (because of heavy reindexing). I may be wrong about this. I was also thinking about storing data in a gdbm database. One file for each month storing at most 100 log messages for every key value. Then one file for each day in the current month, storing one message for each key value. Incremental backup would be easy, and reading back old messages would be fast enough (just need to do a few hash lookups). However, implementing a high availability service around this is not that easy. I'm just wondering if there is an open source solution for my problem that I don't know of. Thanks, Laszlo -- http://mail.python.org/mailman/listinfo/python-list
Re: Validating Command Line Options
On Wed, Mar 23, 2011 at 10:10 AM, T wrote: > For a Python script with multiple command line options, what is the > best way to go about validating that only certain options are used > together? For example, say -s, -t, and -v are all valid options, but > should never be used together (i.e. -s -t would be invalid). Thanks > in advance. It looks like argparse supports mutually exclusive option groups. http://argparse.googlecode.com/svn/trunk/doc/other-methods.html#add_mutually_exclusive_group -- http://mail.python.org/mailman/listinfo/python-list
readline module (python: symbol 'tgetnum': can't resolve symbol)
Hi
I'm hoping the list could give me some insight into how python behaves when
it has been compiled with "readline".
I sent the following email to the uClibc list which describes my problem,
any tips or pointers would be much appreciated!
Thanks
Bruce
Using buildroot, I am able to compile "ncurses" without any problems. I'm
also able to compile "readline" (which detects ncurses) and finally I'm able
to compile python-2.7.1 which detects "readline".
I boot the embedded OS and I can see all the relevant files:
[root@vx-200 ~]#
[root@vx-200 ~]# uname -a
Linux vx-200 2.6.38-rc5 #1 Wed Mar 23 12:10:46 GMT 2011 armv5tejl GNU/Linux
[root@vx-200 ~]#
[root@vx-200 ~]# find / -name "*readline*" | grep ython
/usr/lib/python2.7/lib-dynload/readline.so
[root@vx-200 ~]#
[root@vx-200 ~]# find / -name "*libreadline*"
/usr/lib/libreadline.so.6.1
/usr/lib/libreadline.so
/usr/lib/libreadline.a
/usr/lib/libreadline.so.6
[root@vx-200 ~]#
[root@vx-200 ~]# find / -name "*ncurses*"
/usr/lib/libncurses.so.5
/usr/lib/libncurses.so
/usr/lib/libncurses.a
/usr/lib/libncurses.so.5.7
/usr/bin/ncurses5-config
/usr/include/ncurses.h
/usr/include/ncurses_dll.h
[root@vx-200 ~]#
[
[root@vx-200 ~]# ldd /usr/lib/python2.7/lib-dynload/readline.so
checking sub-depends for '/usr/lib/libreadline.so.6'
checking sub-depends for '/usr/lib/libncurses.so.5'
checking sub-depends for '/lib/libc.so.0'
ld-uClibc.so.0 => /lib//ld-uClibc.so.0 (0x40201000)
libreadline.so.6 => /usr/lib/libreadline.so.6 (0x)
libncurses.so.5 => /usr/lib/libncurses.so.5 (0x)
libc.so.0 => /lib/libc.so.0 (0x)
/lib//ld-uClibc.so.0 => /lib//ld-uClibc.so.0 (0x)
[root@vx-200 ~]#
[root@vx-200 ~]# strings /usr/lib/libreadline.so.6 | grep tgetent
tgetent
[root@vx-200 ~]# strings /usr/lib/libreadline.so.6 | grep tgetnum
tgetnum
[root@vx-200 ~]#
So far everything looks perfect, Python's "lib-dynload/readline.so" is
linked against "libreadline"and "libreadline" has the curses terminfo
symbols (tgetent, tgetflag, tgetnum, tgetstr, tgoto, tputs)
Next I try and run python, hoping for an interactive shell, the following
"strace -e trace=open python" command shows the relevant bits and the
resulting error:
[root@vx-200 ~]# strace -e trace=open python
open("/usr/lib/python2.7/lib-dynload/readline.so", O_RDONLY|O_LARGEFILE) = 3
open("/usr/lib/python2.7/lib-dynload/readline.so", O_RDONLY) = 4
open("/usr/lib/libreadline.so.6", O_RDONLY) = 4
open("/usr/lib/libncurses.so.5", O_RDONLY) = 4
open("/lib/libc.so.0", O_RDONLY)= 4
open("/lib/libc.so.0", O_RDONLY)= 4
open("/lib/libc.so.0", O_RDONLY)= 4
open("/lib/ld-uClibc.so.0", O_RDONLY) = 4
python: symbol 'BC': can't resolve symbol
python: symbol 'PC': can't resolve symbol
python: symbol 'UP': can't resolve symbol
python: symbol 'tgetnum': can't resolve symbol
python: symbol 'tgoto': can't resolve symbol
python: symbol 'tgetflag': can't resolve symbol
python: symbol 'tputs': can't resolve symbol
python: symbol 'tgetent': can't resolve symbol
python: symbol 'tgetstr': can't resolve symbol
>>>
So the Python binary opens "lib-dynload/readline.so" ...and the necessary
libreadline and libncurses . and lastly it opens "ld-uClibc" which, from
my limited understanding would link the addresses
of "readline" and "libncurses" (which I know contain the symbols) .but
apparently they can't be resolved.
Could this be a dynamic linking problem?
Any help would be much appreciated!!
Thanks
Bruce
--
http://mail.python.org/mailman/listinfo/python-list
Re: Threading with Socket Server
I'm not sure to understand what you want. Is it your server process that will read the shelve file ? You may give more informations about your problem, but i can give you some hints. In order to create a TCP server, you can use SocketServer which is in the builtin library (http://docs.python.org/library/socketserver.html). I'm not sure about how shelve manage concurrency, but in my opinion, you'll need to create a single process or thread which manage read and write operation in order to avoiding race conditions. Cheers, Feld Boris 2011/3/23 T : > Hello all, I am writing a Windows service that needs to 1) Act as a > server (TCP), and write to a shelve file, and 2) Read that same shelve > file every x number of seconds. My thought is to create 2 separate > classes (1 for the socket server and writing to the shelve file, and > another to read the file and perform other requested actions) - > however, I need to make sure they are both running concurrently. I'm > sure threading is involved, but my experience with it has been > minimal, so any help to steer me in the right direction is greatly > appreciated. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Validating Command Line Options
If you're using argparse, you have a method for that named "add_mutually_exclusive_group". Tutorial : http://www.doughellmann.com/PyMOTW/argparse/#mutually-exclusive-options Cheers, Feld Boris 2011/3/23 T : > For a Python script with multiple command line options, what is the > best way to go about validating that only certain options are used > together? For example, say -s, -t, and -v are all valid options, but > should never be used together (i.e. -s -t would be invalid). Thanks > in advance. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Free Software University - Python Certificate
On Mar 22, 4:38 pm, Noah Hall wrote: > On Tue, Mar 22, 2011 at 11:30 AM, Giovani wrote: > >> I don't know whether this site is useful or not. > > >> Assuming this site is serious: > >> If you are already subscribed you might be able to give some feedback. > > >> One can't even see the list of courses without regsitering. > >> This is very unprofessional and might indicate, that they just want to > >> reap contact information. > > > I'm not the admin of the site, when the course finish will be aviable > > throgh the main website (I think). > > >> One can't even see a date or a time line without registering. So one > >> doesn't even know whether the whole project is already dead for several > >> years or really active. > > > I really active, there more than 100 users registered and lots of them > > are working to make several course certificates (PHP, Python, Java, > > JavaScript, FreeNAS, etc..). > > >> To me all this does not look professional for somebody who want to > >> attract students / instructors > > > The finally is make professional contents, but this project is already > > in a early stage. > > I've been following this project for a while, since it was annouced on > the Ubuntu forums. I can't say that I've been at all impressed by > anything they have to offer. Although not entirely free and not currently hosting any Python courses you may find this site worth a look over. http://www.codeschool.com/ -- http://mail.python.org/mailman/listinfo/python-list
Discount Wholesale ED Hardy beach shorts man
Discount Wholesale EVISU short jeans man http://www.idesignerworld01.com/ Discount Wholesale G-star long jeans man Discount Wholesale Gucci long jeans man http://www.idesignerworld01.com/ Discount Wholesale Jeep long jeans man http://www.idesignerworld01.com/ Discount Wholesale LB long jeans man Discount Wholesale Lee long jeans man http://www.idesignerworld01.com/ Discount Wholesale Levis long jeans man Discount Wholesale Lv long jeans man Discount Wholesale RMC long jeans man http://www.idesignerworld01.com/ Discount Wholesale RMC short jeans man Discount Wholesale TR long jeans man http://www.idesignerworld01.com/ Discount Wholesale Versace long jeans man Discount Wholesale Affliction beach shorts man http://www.idesignerworld01.com/ Discount Wholesale Armani long jeans man http://www.idesignerworld01.com/ Discount Wholesale BAPE long jeans man Discount Wholesale BAPE short jeans man Discount Wholesale BBC long jeans man http://www.idesignerworld01.com/ Discount Wholesale BBC short jeans man Discount Wholesale CH long jeans man Discount Wholesale CH short jeans man http://www.idesignerworld01.com/ Discount Wholesale Christian Audigier beach shorts man Discount Wholesale Christian Audigier long jeans man Discount Wholesale Christian Audigier short jeans man Discount Wholesale Coogi long jeans man Discount Wholesale Coogi short jeans man http://www.idesignerworld01.com/ Discount Wholesale CROWN HOLDER long jeans man Discount Wholesale CROWN HOLDER short jeans man Discount Wholesale DG long jeans man Discount Wholesale DIESEL long jeans man Discount Wholesale ED Hardy beach shorts man http://www.idesignerworld01.com/ Discount Wholesale ED Hardy long jeans man Discount Wholesale ED Hardy short jeans man Discount Wholesale EVISU long jeans man http://www.idesignerworld01.com/ Discount Wholesale EVISU short jeans man -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Wed, Mar 23, 2011 at 02:59:09PM +0100, Stefan Behnel wrote: > Antoon Pardon, 23.03.2011 14:53: > >On Sun, Mar 13, 2011 at 12:59:55PM +, Steven D'Aprano wrote: > >>The removal of cmp from the sort method of lists is probably the most > >>disliked change in Python 3. On the python-dev mailing list at the > >>moment, Guido is considering whether or not it was a mistake. > >> > >>If anyone has any use-cases for sorting with a comparison function that > >>either can't be written using a key function, or that perform really > >>badly when done so, this would be a good time to speak up. > > > >How about a list of tuples where you want them sorted first item in ascending > >order en second item in descending order. > > You can use a stable sort in two steps for that. Which isn't helpfull if where you decide how they have to be sorted is not the place where they are actually sorted. I have a class that is a priority queue. Elements are added at random but are removed highest priority first. The priority queue can have a key or a cmp function for deciding which item is the highest priority. It can also take a list as an initializor, which will then be sorted. So this list is sorted within the class but how it is sorted is decided outside the class. So I can't do the sort in multiple steps. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Validating Command Line Options
Thanks! argparse is definitely what I need..unfortunately I'm running 2.6 now, so I'll need to upgrade to 2.7 and hope that none of my other scripts break. -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading with Socket Server
The server portion of the program will typically be writing to the shelve file (there may be a few cases in which I will need it to read), and the other part of the program will read it. Basically, I want the following to be able to both go on at the same time: 1) Server portion waits for connections, and upon connection writes data received to shelve file and 2) Continuously polls shelve file every x seconds and checks for new entries. I had given thought to the potential of a race condition as you mentioned, but am not sure of how to "safely" allow each portion of the program to read/write. -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Wed, Mar 23, 2011 at 9:14 AM, Antoon Pardon wrote: > Which isn't helpfull if where you decide how they have to be sorted is > not the place where they are actually sorted. > > I have a class that is a priority queue. Elements are added at random but > are removed highest priority first. The priority queue can have a key or > a cmp function for deciding which item is the highest priority. It > can also take a list as an initializor, which will then be sorted. > > So this list is sorted within the class but how it is sorted is decided > outside the class. So I can't do the sort in multiple steps. You can't do this? for (key, reversed) in self.get_multiple_sort_keys(): self.pq.sort(key=key, reversed=reversed) -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
Antoon Pardon, 23.03.2011 16:14: On Wed, Mar 23, 2011 at 02:59:09PM +0100, Stefan Behnel wrote: Antoon Pardon, 23.03.2011 14:53: On Sun, Mar 13, 2011 at 12:59:55PM +, Steven D'Aprano wrote: The removal of cmp from the sort method of lists is probably the most disliked change in Python 3. On the python-dev mailing list at the moment, Guido is considering whether or not it was a mistake. If anyone has any use-cases for sorting with a comparison function that either can't be written using a key function, or that perform really badly when done so, this would be a good time to speak up. How about a list of tuples where you want them sorted first item in ascending order en second item in descending order. You can use a stable sort in two steps for that. Which isn't helpfull if where you decide how they have to be sorted is not the place where they are actually sorted. I have a class that is a priority queue. Elements are added at random but are removed highest priority first. The priority queue can have a key or a cmp function for deciding which item is the highest priority. It can also take a list as an initializor, which will then be sorted. So this list is sorted within the class but how it is sorted is decided outside the class. So I can't do the sort in multiple steps. That sounds more like a use case for heap sort than for Python's builtin list sort. See the heapq module. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Mar 23, 6:59 am, Stefan Behnel wrote: > Antoon Pardon, 23.03.2011 14:53: > > > On Sun, Mar 13, 2011 at 12:59:55PM +, Steven D'Aprano wrote: > >> The removal of cmp from the sort method of lists is probably the most > >> disliked change in Python 3. On the python-dev mailing list at the > >> moment, Guido is considering whether or not it was a mistake. > > >> If anyone has any use-cases for sorting with a comparison function that > >> either can't be written using a key function, or that perform really > >> badly when done so, this would be a good time to speak up. > > > How about a list of tuples where you want them sorted first item in > > ascending > > order en second item in descending order. > > You can use a stable sort in two steps for that. How about this one: you have are given an obscure string collating function implented in a C library you don't have the source to. Or how about this: I'm sitting at an interactive session and I have a convenient cmp function but no convenient key, and I care more about the four minutes it'd take to whip up a clever key function or an adapter class than the 0.2 seconds I'd save to on sorting time. Removing cmp from sort was a mistake; it's the most straightforward and natural way to sort in many cases. Reason enough for me to keep it. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
Carl Banks, 23.03.2011 18:23: On Mar 23, 6:59 am, Stefan Behnel wrote: Antoon Pardon, 23.03.2011 14:53: On Sun, Mar 13, 2011 at 12:59:55PM +, Steven D'Aprano wrote: The removal of cmp from the sort method of lists is probably the most disliked change in Python 3. On the python-dev mailing list at the moment, Guido is considering whether or not it was a mistake. If anyone has any use-cases for sorting with a comparison function that either can't be written using a key function, or that perform really badly when done so, this would be a good time to speak up. How about a list of tuples where you want them sorted first item in ascending order en second item in descending order. You can use a stable sort in two steps for that. How about this one: you have are given an obscure string collating function implented in a C library you don't have the source to. Or how about this: I'm sitting at an interactive session and I have a convenient cmp function but no convenient key, and I care more about the four minutes it'd take to whip up a clever key function or an adapter class than the 0.2 seconds I'd save to on sorting time. As usual with Python, it's just an import away: http://docs.python.org/library/functools.html#functools.cmp_to_key I think this is a rare enough use case to merit an import rather than being a language feature. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: urllib2 - not returning page expected after post
On 3/23/2011 5:14 AM, David Feyo wrote: I'm trying to automate reverse-ip lookups on domaintools.com. Sign up for their API. They charge the same as for web lookups. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Python-URL! - weekly Python news and links (Mar 23)
QOTW: "So far as I know, that actually just means that the test suite is insufficient." - Peter Seebach, when an application passes all its tests http://groups.google.com/group/comp.lang.lisp/msg/29aff9595bb0eac0 Administrative note: it's been a while--since the end of October 2010, in fact; "Python-URL!" has been dormant all that time. It looks as though we're re-activating now, though, and the next month should make apparent whether we've returned to our roughly-weekly schedule. A few minor structural changes are afoot; likely to be of broadest interest is that "twits" can now follow "Python-URL!" on http://twitter.com/Phaseit >. PyCon2011 had IDE news that made the trade press: http://www.eweek.com/c/a/Application-Development/Microsoft-Launches-Python-Tools-for-Visual-Studio-Beta-638994/?kc=EWKNLITA03152011STR3 Kirby Urner reflects on the virtues of our built-in battery tester: http://mail.python.org/pipermail/edu-sig/2011-February/010179.html regex is important. It's also widely mis-understood, and often results in little more than frustration. This conversation about regex's special characters ends happily: http://groups.google.com/group/comp.lang.python/browse_thread/thread/e8ea8cc833aebac2 While file extensions are among the many topics Python has handled deftly for over two decades now, the best handling continues to update occasionally: http://groups.google.com/group/comp.lang.python/browse_thread/thread/6b166a07312c2c12 Everything Python-related you want is probably one or two clicks away in these pages: Python.org's Python Language Website is the traditional center of Pythonia http://www.python.org Notice especially the master FAQ http://www.python.org/doc/FAQ.html PythonWare complements the digest you're reading with the marvelous daily python url http://www.pythonware.com/daily Just beginning with Python? This page is a great place to start: http://wiki.python.org/moin/BeginnersGuide/Programmers The Python Papers aims to publish "the efforts of Python enthusiasts": http://pythonpapers.org/ The Python Magazine is a technical monthly devoted to Python: http://pythonmagazine.com Readers have recommended the "Planet" site: http://planet.python.org comp.lang.python.announce announces new Python software. Be sure to scan this newsgroup weekly. http://groups.google.com/group/comp.lang.python.announce/topics Python411 indexes "podcasts ... to help people learn Python ..." Updates appear more-than-weekly: http://www.awaretek.com/python/index.html The Python Package Index catalogues packages. http://www.python.org/pypi/ Much of Python's real work takes place on Special-Interest Group mailing lists http://www.python.org/sigs/ Python Success Stories--from air-traffic control to on-line match-making--can inspire you or decision-makers to whom you're subject with a vision of what the language makes practical. http://www.pythonology.com/success The Python Software Foundation (PSF) has replaced the Python Consortium as an independent nexus of activity. It has official responsibility for Python's development and maintenance. http://www.python.org/psf/ Among the ways you can support PSF is with a donation. http://www.python.org/psf/donations/ The Summary of Python Tracker Issues is an automatically generated report summarizing new bugs, closed ones, and patch submissions. http://search.gmane.org/?author=status%40bugs.python.org&group=gmane.comp.python.devel&sort=date nullege is an interesting search Web application, with the intelligence to distinguish between Python code and comments. It provides what appear to be relevant results, and demands neither Java nor CSS be enabled: http://www.nullege.com Although unmaintained since 2002, the Cetus collection of Python hyperlinks retains a few gems. http://www.cetus-links.org/oo_python.html Python FAQTS http://python.faqts.com/ The Cookbook is a collaborative effort to capture useful and interesting recipes: http://code.activestate.com/recipes/langs/python/ Many Python conferences around the world are in preparation. Watch this space for links to them. SciPyTip is a high-quality daily (!) tip for the numerically- inclined: http://twitter.com/SciPyTip Among several Python-oriented RSS/RDF feeds available, see: http://www.python.org/channews.rdf For more, see: http://www.syndic8.com/feedlist.php?ShowMatch=python&ShowStatus=all The old Python "To-Do List" now lives principally in a SourceForge reincarnation. http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse http://www.python.org/dev/peps/pep-0042/
Re: Validating Command Line Options
On Mar 23, 3:20 pm, T wrote: > Thanks! argparse is definitely what I need..unfortunately I'm running > 2.6 now, so I'll need to upgrade to 2.7 and hope that none of my other > scripts break. Argparse was a third-party module before it became part of the std- lib. You may find it easier to use this version: http://pypi.python.org/pypi/argparse/ -- http://mail.python.org/mailman/listinfo/python-list
autoscale y to current xrange in view - matplotlib
Hi I am very new to python and matplotlib, so please forgive me if this is a
naive question
I have a question regarding the y autoscale. I would like it to scale to only
the current data in view, not all the data. At the moment the y axes are
scaled to some data not currently shown and so very distorted. Is there a way
to do this?
Thanks for any help
So far my script looks like this.
import pylab
import matplotlib.pyplot as plt
import numpy
pylab.cla()
f=numpy.loadtxt("pattern_5K.ascii")
x = f[:,0]
data = f[:,1]
model = f[:,2]
diff = f[:,3]
plt.close('all')
f, (ax1, ax2) = plt.subplots(2, sharex=True, sharey=False)
ax1.set_xlim((21,22))
ax1.plot(x, data, '.', color = 'red', markersize=1),
ax1.plot(x, model, '-', color = 'blue', linewidth = 0.5)
ax1.set_title('Pattern')
ax2.plot(x, diff,'-',color='magenta',linewidth = 0.5)
f.subplots_adjust(hspace=0)
plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)
plt.show()
--
http://mail.python.org/mailman/listinfo/python-list
Re: Special logging module needed
On Wed, Mar 23, 2011 at 7:37 AM, Laszlo Nagy wrote: > I was also thinking about storing data in a gdbm database. One file for > each month storing at most 100 log messages for every key value. Then one > file for each day in the current month, storing one message for each key > value. Incremental backup would be easy, and reading back old messages would > be fast enough (just need to do a few hash lookups). However, implementing a > high availability service around this is not that easy. > I think a slight variation of this sounds like a good bet for you. But when you "open" a database, create a temporary copy, and when you close the database, rename it back to its original name. Then your backups should be able to easily get a self-consistent (if not up to the millisecond) snapshot. Or did you have some other problem in mind for the gdbm version? BTW, avoid huge directories of course, especially if you don't have hashed or btree directories. One way is to come up with a longish hash key (sha?), and use a trie-like structure in the filesystem on fibonnaci-length chunks of the hash keys becoming directories and subdirectories. -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Mar 23, 10:51 am, Stefan Behnel wrote: > Carl Banks, 23.03.2011 18:23: > > > > > > > On Mar 23, 6:59 am, Stefan Behnel wrote: > >> Antoon Pardon, 23.03.2011 14:53: > > >>> On Sun, Mar 13, 2011 at 12:59:55PM +, Steven D'Aprano wrote: > The removal of cmp from the sort method of lists is probably the most > disliked change in Python 3. On the python-dev mailing list at the > moment, Guido is considering whether or not it was a mistake. > > If anyone has any use-cases for sorting with a comparison function that > either can't be written using a key function, or that perform really > badly when done so, this would be a good time to speak up. > > >>> How about a list of tuples where you want them sorted first item in > >>> ascending > >>> order en second item in descending order. > > >> You can use a stable sort in two steps for that. > > > How about this one: you have are given an obscure string collating > > function implented in a C library you don't have the source to. > > > Or how about this: I'm sitting at an interactive session and I have a > > convenient cmp function but no convenient key, and I care more about > > the four minutes it'd take to whip up a clever key function or an > > adapter class than the 0.2 seconds I'd save to on sorting time. > > As usual with Python, it's just an import away: > > http://docs.python.org/library/functools.html#functools.cmp_to_key > > I think this is a rare enough use case to merit an import rather than being > a language feature. The original question posted here was, "Is there a use case for cmp?" There is, and your excuse-making doesn't change the fact. It's the most natural way to sort sometimes; that's a use case. We already knew it could be worked around. It's kind of ridiculous to claim that cmp adds much complexity (it's maybe ten lines of extra C code), so the only reason not to include it is that it's much slower than using key. Not including it for that reason would be akin to the special-casing of sum to prevent strings from being concatenated, although omitting cmp would not be as drastic since it's not a special case. Do we omit something that's useful but potentially slow? I say no. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: May I discuss here issues on Machine Learning?
On 3/22/11 6:18 PM, joy99 wrote: Dear Group, My apology to pose this non python question in this forum. I am trying to develop one Naive Bayes Classifier and one HMM with Python. But my question is not related to Python, rather to these two models, whether I am choosing right parameters, etc for these models. MetaOptimize is a much better forum for these questions: http://metaoptimize.com/qa/ -- 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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
Carl Banks writes: > It's kind of ridiculous to claim that cmp adds much complexity (it's > maybe ten lines of extra C code), so the only reason not to include it > is that it's much slower than using key. Well, I thought it was also to get rid of 3-way cmp in general, in favor of rich comparison. -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido rethinking removal of cmp from sort method
On Mar 23, 1:38 pm, Paul Rubin wrote: > Carl Banks writes: > > It's kind of ridiculous to claim that cmp adds much complexity (it's > > maybe ten lines of extra C code), so the only reason not to include it > > is that it's much slower than using key. > > Well, I thought it was also to get rid of 3-way cmp in general, in favor > of rich comparison. Supporting both __cmp__ and rich comparison methods of a class does add a lot of complexity. The cmp argument of sort doesn't. The cmp argument doesn't depend in any way on an object's __cmp__ method, so getting rid of __cmp__ wasn't any good readon to also get rid of the cmp argument; their only relationship is that they're spelled the same. Nor is there any reason why cmp being a useful argument of sort should indicate that __cmp__ should be retained in classes. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: Validating Command Line Options
See inline comments On Wed, Mar 23, 2011 at 2:13 PM, Alex Willmer wrote: > On Mar 23, 3:20 pm, T wrote: > > Thanks! argparse is definitely what I need..unfortunately I'm running > > 2.6 now, so I'll need to upgrade to 2.7 and hope that none of my other > > scripts break. > > Argparse was a third-party module before it became part of the std- > lib. You may find it easier to use this version: > > http://pypi.python.org/pypi/argparse/ I have used this version successfully on 2.6 including using mutually exclusive groups. > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Free Software University - Python Certificate
> To me all this does not look professional for somebody who want to > attract students / instructors I'm a big fan of the Menu containing a (useless) link to First Menu Item -- http://mail.python.org/mailman/listinfo/python-list
"in house" pypi?
Greetings, My company want to distribute Python packages internally. We would like something like an internal PyPi where people can upload and easy_install from packages. Is there such a ready made solution? I'd like something as simple as possible, without my install headache. Thanks, -- Miki -- http://mail.python.org/mailman/listinfo/python-list
Instant File I/O
I'm trying to build a feature on to a text-based game that I've been working on that would allow users to view their stats. Information is stored in a flat text database file that is given the same name that they sign into the program with; however, this information doesn't appear in the file until after the program has closed. This poses a problem for retrieving the up-to-date statistics data during the same session. Is there anyway I can fix this? I'm using .write() to write text to the file and the linecache module to retrieve it. Running linecache.clearcache() at the beginning of the stat function doesn't seem to do the trick. Any help would be greatly appreciated! -- http://mail.python.org/mailman/listinfo/python-list
Re: Instant File I/O
I'm not familiar with linecache.clearcache(), but did you flush the data to the filesystem with file_.flush() ? On Wed, Mar 23, 2011 at 9:53 PM, jam1991 wrote: > I'm trying to build a feature on to a text-based game that I've been > working on that would allow users to view their stats. Information is > stored in a flat text database file that is given the same name that > they sign into the program with; however, this information doesn't > appear in the file until after the program has closed. This poses a > problem for retrieving the up-to-date statistics data during the same > session. Is there anyway I can fix this? I'm using .write() to write > text to the file and the linecache module to retrieve it. Running > linecache.clearcache() at the beginning of the stat function doesn't > seem to do the trick. Any help would be greatly appreciated! > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: "in house" pypi?
Am 24.03.2011 04:19, schrieb Miki Tebeka: > Greetings, > > My company want to distribute Python packages internally. We would like > something like an internal PyPi where people can upload and easy_install from > packages. > > Is there such a ready made solution? > I'd like something as simple as possible, without my install headache. The easiest solution is to use a plain file system. Make a directory per project, and put all distributions of the project into the directory. Then have Apache serve the parent directory, with DirectoryIndex turned on. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
