Re: CGI and external JavaScript nightmare

2007-10-11 Thread Istvan Albert
On Oct 11, 2:23 am, IamIan <[EMAIL PROTECTED]> wrote: > > is a very lengthy garbled js file > athttp://pagead2.googlesyndication.com/pagead/show_ads.js > > The first piece of JavaScript works fine and the ads display > correctly, however the second file throws an "unterminated string > literal" js

Re: CGI and external JavaScript nightmare

2007-10-22 Thread Istvan Albert
On Oct 18, 5:04 pm, IamIan <[EMAIL PROTECTED]> wrote: > > > The OP's problem is that he suffers from the delusion that people want > > > to steal the source code for hisCGIscript. > > Why is assuming someone may try to get my source CGI delusional? > > I'm on a shared server (Dreamhost). The CGI it

Re: NUCULAR fielded text searchable indexing

2007-10-27 Thread Istvan Albert
On Oct 17, 7:20 am, Steve Holden <[EMAIL PROTECTED]> wrote: > I still remember Gadfly fondly. What a great piece of software Gadfly is ... congrats on that Aaron. For me it was one of the first Python packages that truly stood out and made me want to learn Python. i. -- http://mail.python.org/

Re: Announcement -- ZestyParser

2007-01-10 Thread Istvan Albert
Terry Reedy wrote: > I would like to look at the examples online (along with the doc file) > before downloading this and setuptools and installing, so I can see what > it actually looks like in use. Yes, I second that. I poked around for a little while but could not find a single example. Then

Re: Read from database, write to another database, simultaneously

2007-01-11 Thread Istvan Albert
Sean Davis wrote: > at the same time that the data is coming in? So, I am actually looking > for a solution to this problem that doesn't require an intermediate > file and allows simultaneous reading and writing, with the caveat that > the data cannot all be read into memory simultaneously, so w

Re: Need startup suggestions for writing a MSA viewer GUI in python

2007-01-11 Thread Istvan Albert
Joel Hedlund wrote: > ideas from you people to get me going in the right direction. Despite my > GUI n00b-ness I need to get it good and usable with an intuitive look > and feel. UI design requires a different skillset than programming. It can be a very frustrating and thankless task as well. It

Re: Newbie - converting csv files to arrays in NumPy - Matlab vs. Numpy comparison

2007-01-11 Thread Istvan Albert
oyekomova wrote: > csvread in Matlab for a very large csv file. Matlab read the file in > 577 seconds. On the other hand, this code below kept running for over 2 > hours. Can this program be made more efficient? FYI There must be something wrong with your setup/program. I work with large csv fil

Re: Python web app. (advice sought)

2007-01-15 Thread Istvan Albert
Duncan Smith wrote: > I've had a look at Django, Turbogears and Plone, and at the moment I am > torn between Turbogears and Plone. I Plone is not suited for the type of application you are building (as others have pointed out in this thread). Take a second look at TurboGears (or CherryPy for t

Re: Writing "pythonish" code

2007-02-02 Thread Istvan Albert
On Feb 2, 6:20 am, Mizipzor <[EMAIL PROTECTED]> wrote: > Now, the thing that bothers me the most. When I write python modules I > write one class per file, and the file and the class has a common > name. Maybe this is due to c++ habits. Python modules typically contain multiple classes and modul

Re: Return images with matplotlib?

2007-02-04 Thread Istvan Albert
On Feb 4, 8:18 pm, Jan Danielsson <[EMAIL PROTECTED]> wrote: > def barchart(req, params): >some_format = matplotlib.generate_fancy_graph(params) >png_buf = make_png_buffer(some_format) >return png_buf > >Is this possible? If so -- how? savefig does that. You can save to a file nam

Re: python shelve on win vs unix

2007-02-09 Thread Istvan Albert
On Feb 9, 6:06 am, Tor Erik Soenvisen <[EMAIL PROTECTED]> wrote: > Any suggestions for a quick and dirty solution (such as alternatives to > shelve for persistent storage) to this problem would be appreciated. the easiest might be to just pickle your data into files. You could also use Durus htt

Re: threading and multicores, pros and cons

2007-02-14 Thread Istvan Albert
On Feb 14, 1:33 am, Maric Michaud <[EMAIL PROTECTED]> wrote: > At this time, it 's not easy to explain him that python > is notflawed compared to Java, and that he will not > regret his choice in the future. Database adaptors such as psycopg do release the GIL while connecting and exchanging data

Drawing charts in Qt

2007-11-06 Thread Michel Albert
I would like to display some charts in a Qt application. But all the docs I find online are rather dusty and talk about Qt3. My application uses Qt4 however. I ran into PyQwt and matplotlib. But the docs of matplotlib are horrid and the example in their wiki covers Qt3, and things look quite crypti

Re: Drawing charts in Qt

2007-11-07 Thread Michel Albert
On Nov 6, 5:08 pm, David Boddie <[EMAIL PROTECTED]> wrote: > On Tue Nov 6 15:46:07 CET 2007, Michel Albert wrote: > > [PyQwt and matplotlib] > > > PyQwt looks much more interesting, but I have trouble installing it. > > On my machine it complains that sipconfig &quo

Using python as primary language

2007-11-07 Thread Michel Albert
In our company we are looking for one language to be used as default language. So far Python looks like a good choice (slacking behind Java). A few requirements that the language should be able cope with are: * Database access to Sybase. This seems to be available for python, but the windows-bin

Re: Using python as primary language

2007-11-09 Thread Michel Albert
On Nov 8, 8:55 pm, [EMAIL PROTECTED] wrote: > On Nov 8, 1:52 am, Michel Albert <[EMAIL PROTECTED]> wrote: > > > > > In our company we are looking for one language to be used as default > > language. So far Python looks like a good choice (slacking behind > >

parallel csv-file processing

2007-11-09 Thread Michel Albert
Currently I am faced with a large computation tasks, which works on a huge CSV file. As a test I am working on a very small subset which already contains 2E6 records. The task itself allows the file to be split however as each computation only involves one line. The application performing the compu

Re: Populating a dictionary, fast

2007-11-11 Thread Istvan Albert
On Nov 10, 4:56 pm, Michael Bacarella <[EMAIL PROTECTED]> wrote: > This would seem to implicate the line id2name[id] = name as being > excruciatingly slow. As others have pointed out there is no way that this takes 45 minutes.Must be something with your system or setup. A functionally equivalen

Re: Populating a dictionary, fast

2007-11-11 Thread Istvan Albert
On Nov 11, 11:25 am, Michael Bacarella <[EMAIL PROTECTED]> wrote: > I tried your code (with one change, time on feedback lines) and got the > same terrible > performance against my data set. > To prove that my machine is sane, I ran the same against your generated > sample file and got _excellen

Re: Populating a dictionary, fast

2007-11-11 Thread Istvan Albert
On Nov 11, 11:51 am, Michael Bacarella <[EMAIL PROTECTED]> wrote: > and see it take about 45 minutes with this: > > $ cat cache-keys.py > #!/usr/bin/python > v = {} > for line in open('keys.txt'): > v[long(line.strip())] = True On my system (windows vista) your code (using your data) runs

Re: Binary search tree

2007-11-12 Thread Michel Albert
On Nov 9, 11:45 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > > Hi, > > > I have to get list of URLs one by one and to find the URLs that I have > > more than one time(can't be more than twice). > > > I thought to put them into binary search tree, this way the

Re: Populating a dictionary, fast

2007-11-12 Thread Istvan Albert
On Nov 12, 12:39 pm, "Michael Bacarella" <[EMAIL PROTECTED]> wrote: > The win32 Python or the cygwin Python? > > What CPU architecture? it is the win32 version, a dual core laptop with T5220 Core 2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Populating a dictionary, fast [SOLVED]

2007-11-13 Thread Istvan Albert
On Nov 13, 11:27 am, Francesc Altet <[EMAIL PROTECTED]> wrote: > Another possibility is using an indexed column in a table in a DB. > Lookups there should be much faster than using a dictionary as well. I would agree with others who state that for a simple key based lookup nothing beats a diction

Re: Populating a dictionary, fast [SOLVED SOLVED]

2007-11-15 Thread Istvan Albert
On Nov 14, 6:26 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On systems with multiple CPUs or 64-bit systems, or both, creating and/or > deleting a multi-megabyte dictionary in recent versions of Python (2.3, > 2.4, 2.5 at least) takes a LONG time, of the order of 30+ minute

Re: Populating a dictionary, fast [SOLVED SOLVED]

2007-11-15 Thread Istvan Albert
On Nov 15, 4:11 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > Unless you're accusing both myself and the original poster of outright > lying, of faking our results, what's your explanation? I don't attribute it to malice, I think you're simply measuring something else. You b

Re: Populating a dictionary, fast [SOLVED SOLVED]

2007-11-16 Thread Istvan Albert
On Nov 16, 1:18 pm, "Michael Bacarella" <[EMAIL PROTECTED]> wrote: > You're right, it is completely inappropriate for us to be showing our > dirty laundry to the public. you are misinterpreting my words on many levels, (and I of course could have refrained from the "chair-monitor" jab as well)

Re: gc penalty of 30-40% when manipulating large data structures?

2007-11-16 Thread Istvan Albert
On Nov 16, 10:59 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > The GC has a heuristic where it kicks in when (allocations - > deallocations) exceeds a certain threshold, As the available ram increases this threshold can be more easily reached. Ever since I moved to 2Gb ram I stumbled upon issue

Re: Populating a dictionary, fast [SOLVED]

2007-11-20 Thread Istvan Albert
On Nov 19, 2:33 pm, Francesc Altet <[EMAIL PROTECTED]> wrote: > Just for the record. I was unable to stop thinking about this, and > after some investigation, I guess that my rememberings were gathered > from some benchmarks with code in Pyrex (i.e. pretty near to C speed). Pretty interesting an

Re: Python web frameworks

2007-11-20 Thread Istvan Albert
On Nov 20, 9:42 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > 12/7. Django comes with its own little server so that you don't have > > to set up Apache on your desktop to play with it. > > I was rather shocked to learn that django only has this tiny server and does > not come with a stand-a

Re: Python web frameworks

2007-11-22 Thread Istvan Albert
On Nov 21, 12:15 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > I would say that that is now debatable. Overall mod_wsgi is probably a > better package in terms of what it has to offer. Only thing against > mod_wsgi at this point is peoples willingness to accept something that > is new in conju

Re: Running unmodified CGI scripts persistently under mod_wsgi.

2007-11-27 Thread Istvan Albert
On Nov 25, 1:55 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > The other question is whether there is even a demand for this. Do > people want to be able to take unmodified Python CGI scripts and try > to run them persistently in this way, or would they be better off > converting them to proper

Re: Limit Guessing Algorithm

2007-12-03 Thread Albert Retey
s an unsolvable problem. But if you know for some reason that your series/functions are "well behaved" in some sense it still might be possible to do something reasonable and there has some work been done on these things. You might e.g. google for Wynns epsilon method which gives

Re: Running unmodified CGI scripts persistently under mod_wsgi.

2007-12-08 Thread Istvan Albert
On Dec 8, 8:26 am, Michael Ströder <[EMAIL PROTECTED]> wrote: > But conventional CGI scripts are implemented with the assumption of being > stateless. while it might be that some CGI scripts must be executed in a new python process on each request, common sense and good programming practices wou

Re: Is anyone happy with csv module?

2007-12-11 Thread Istvan Albert
On Dec 11, 2:14 pm, "massimo s." <[EMAIL PROTECTED]> wrote: > dislike more is that it seems working by *rows* instead than by > *columns*. you can easily transpose the data to get your columns, for a data file that looks like this: data.txt A,B,C 1,2,3 10,20,30 100,200,300 do the foll

Re: pypi and easy_install

2007-12-19 Thread Istvan Albert
On Dec 19, 8:07 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Could someone point me in the right direction? > download_url = 'http://code.google.com/p/pyftpdlib/downloads/list', you'll need to specify the full path to the actual archive, a link that one could use to download the archive,

Re: pypi and easy_install

2007-12-19 Thread Istvan Albert
On Dec 19, 9:44 pm, Istvan Albert <[EMAIL PROTECTED]> wrote: > On Dec 19, 8:07 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > download_url = 'http://code.google.com/p/pyftpdlib/downloads/list', this is from looking at your setup.py he

Re: 2D Game Development in Python

2007-12-21 Thread Istvan Albert
On Dec 20, 8:16 pm, PatrickMinnesota <[EMAIL PROTECTED]> wrote: > seen all the lists. I've done my reading. What I don't have is > actual testimonials by people who have used a chunk of code to program > an animated 2D game and had a great experience. You could use Panda3D to create the game, w

Re: Understanding memory leak reports

2007-12-21 Thread Istvan Albert
On Dec 21, 1:44 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Since the main module is very big (more than 2800 lines of code) maybe that is the actual problem to begin with, you should refactor it so it it more modular and trackable, otherwise this is just one of the many issues that wil

Re: Converting old "shelve" databases to gdbm

2007-12-24 Thread Istvan Albert
On Dec 24, 7:38 pm, [EMAIL PROTECTED] wrote: > Any tips welcome. pickling has a text protocol that should be compatible across python versions. Pickle each of your database entries to a different file, then read them in the newer version of the script. i. -- http://mail.python.org/mailman/list

Re: sqlobject issue/question...

2007-12-29 Thread Istvan Albert
On Dec 28, 11:27 pm, "bruce" <[EMAIL PROTECTED]> wrote: > i'm playing around, researching sqlobject, and i notice that it appears to > require the use of "id" in each tbl it handles in the database. > is there a way to overide this function/behavior... there better be such way. An ORM that does

Re: joining rows

2007-12-29 Thread Istvan Albert
On Dec 29, 10:22 am, Tim Chase <[EMAIL PROTECTED]> wrote: > If, however, order matters, you have to do it in a slightly > buffered manner. > Can be reduced to a sed one-liner I think the original version works just as well for both cases. Your sed version however does need the order you mention.

Re: joining rows

2007-12-29 Thread Istvan Albert
on a second read ... I see that you mean the case that should only join consecutive lines with the same key -- http://mail.python.org/mailman/listinfo/python-list

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread Istvan Albert
On Dec 29, 12:50 pm, bukzor <[EMAIL PROTECTED]> wrote: > Is this functionality intended? It seems very unintuitive. This has > caused a bug in my programs twice so far, and both times I was > completely mystified until I!realized that the default value was > changing. it is only unintuitive when

Re: Bizarre behavior with mutable default arguments

2007-12-29 Thread Istvan Albert
On Dec 29, 1:11 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Google for "Python mutable default arguments" and a mere 30 minutes later this thread is already one of the results that come up -- http://mail.python.org/mailman/listinfo/python-list

Re: Fate of itertools.dropwhile() and itertools.takewhile()

2007-12-29 Thread Istvan Albert
On Dec 29, 6:10 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > These thoughts reflect my own experience with the itertools module. > It may be that your experience with them has been different. Please > let me know what you think. first off, the itertools module is amazing, thanks for creati

Re: Bizarre behavior with mutable default arguments

2007-12-30 Thread Istvan Albert
On Dec 30, 5:23 am, thebjorn <[EMAIL PROTECTED]> wrote: >def age(dob, today=datetime.date.today()): >... > > None of my unit tests caught that one :-) interesting example I can see how it caused some trouble. A quick fix would be to write it: def age(dob, today=datetime.date.today ):

Re: Bizarre behavior with mutable default arguments

2007-12-30 Thread Istvan Albert
On Dec 29, 11:21 pm, bukzor <[EMAIL PROTECTED]> wrote: > The standard library is not affected because the people who wrote code into it know how python works. Programming abounds with cases that some people think should work differently: a = b = [] a.append(1) is b empty or not at this point?

Re: Fate of itertools.dropwhile() and itertools.takewhile()

2007-12-30 Thread Istvan Albert
On Dec 30, 3:29 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > One "recipe" is extracting blocks from text files that are delimited by a > special start and end line. Neat solution! I actually need such functionality every once in a while. Takewhile + dropwhile to the rescue! i. --

Re: Bizarre behavior with mutable default arguments

2007-12-30 Thread Istvan Albert
On Dec 30, 11:26 am, George Sakkis <[EMAIL PROTECTED]> wrote: > I'm with you on this one; IMHO it's one of the relatively few language > design missteps of Python, favoring the rare case as the default > instead of the common one. George, you pointed this out this link in a different thread http

Re: Bizarre behavior with mutable default arguments

2007-12-30 Thread Istvan Albert
On Dec 30, 3:41 pm, bukzor <[EMAIL PROTECTED]> wrote: > No globals, as you specified. BTW, it's silly not to 'allow' globals > when they're called for, otherwise we wouldn't need the 'global' > keyword. okay, now note that you do not actually use the ingroup list for anything else but getting and

When is min(a, b) != min(b, a)?

2008-01-20 Thread Albert Hopkins
This issue may have been referred to in news:<[EMAIL PROTECTED]> but I didn't entirely understand the explanation. Basically I have this: >>> a = float(6) >>> b = float('nan') >>> min(a, b) 6.0 >>> min(b, a) nan >>> max(a, b) 6.0 >>> max(b, a) nan Before

Re: When is min(a, b) != min(b, a)?

2008-01-20 Thread Albert Hopkins
On Sun, 20 Jan 2008 20:16:18 -0800, Paddy wrote: > I am definitely NOT a floating point expert, but I did find this: > http://en.wikipedia.org/wiki/IEEE_754r#min_and_max > > P.S. What platform /Compiler are you using for Python? Linux with GCC 4 -a -- http://mail.python.org/mailman/listinfo/p

Re: IronPython vs CPython: faster in 1.6 times?

2008-02-05 Thread Istvan Albert
On Feb 5, 12:31 pm, dmitrey <[EMAIL PROTECTED]> wrote: > Hi all, > the urlhttp://torquedev.blogspot.com/2008/02/changes-in-air.html > (blog of a game developers) > says IronPython is faster than CPython in 1.6 times. > Is it really true? This is a second time around that IronPython piqued my inter

Re: IronPython vs CPython: faster in 1.6 times?

2008-02-05 Thread Istvan Albert
On Feb 5, 4:56 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Could it be because .NET doesn't have arbitrary length integer types > and your little benchmark will create lots of integers > 2**32 ? > What is the result if you replace foo(a) with > def foo(a): return sqrt(a) Good observation,

Re: ANN: Phatch = PHoto bATCH processor and renamer based on PIL

2008-02-21 Thread Istvan Albert
On Feb 18, 9:58 am, "SPE - Stani's Python Editor" <[EMAIL PROTECTED]> wrote: > I'm pleased to announce the release of Phatch which is a > powerful batch processor and renamer. Phatch exposes a big part of This program is fantastic! Very accesible user interface and produces ggreat images. Thanks!

Re: sympy: what's wrong with this picture?

2008-03-04 Thread Istvan Albert
On Mar 4, 3:13 pm, Mensanator <[EMAIL PROTECTED]> wrote: > But what if _I_ wanted to make a repeatable sequence for test > purposes? Wouldn't factorint() destroy my attempt by reseeding > on every call? Would it? It may just be that you are now itching to see a problem even where there isn't one

Re: Line segments, overlap, and bits

2008-03-27 Thread Istvan Albert
On Mar 26, 5:28 pm, Sean Davis <[EMAIL PROTECTED]> wrote: > I am working with genomic data. Basically, it consists of many tuples > of (start,end) on a line. I would like to convert these tuples of > (start,end) to a string of bits where a bit is 1 if it is covered by > any of the regions describ

Re: Is subprocess.Popen completely broken?

2008-03-27 Thread Istvan Albert
On Mar 27, 10:53 am, Skip Montanaro <[EMAIL PROTECTED]> wrote: > Is subprocess.Popen completely broken? Your lack of faith in Python is somewhat disturbing ... -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for an efficient Python script to download and save a .zip file programmatically

2009-01-10 Thread Albert Hopkins
On Sat, 2009-01-10 at 17:12 +, David Shi wrote: > I am looking for an efficient Python script to download and save > a .zip file programmatically (from http or https call). > > Regards. > > David urllib? -a -- http://mail.python.org/mailman/listinfo/python-list

Re: trying to modify locals() dictionary

2009-01-12 Thread Albert Hopkins
On Mon, 2009-01-12 at 19:51 +0100, TP wrote: > Hi everybody, > > I try to modify locals() as an exercise. > According to the context (function or __main__), it works differently (see > below). Why? Thanks > > Julien Per the locals() documentation @ http://docs.python.org/library/functions.html

Re: exec in a nested function yields an error

2009-01-13 Thread Albert Hopkins
On Tue, 2009-01-13 at 16:13 +0100, TP wrote: > Hi everybody, > > Try the following program: > > > def f(): > def f_nested(): > exec "a=2" > print a > f() > > > It yields an error. > $ python nested_exec.py > File "nested_exec.py", l

Re: basic python list/dict/key question/issues..

2009-01-13 Thread Albert Hopkins
On Tue, 2009-01-13 at 08:59 -0800, bruce wrote: > Hi.. > > quite new to python, and have a couple of basic question: > > i have > ("term":["1","2","3"]) > > as i understand it, this is a list, yes/no? > No, that's invalid syntax: >>> ("term":["1","2","3"]) File "", line 1

Re: Read binary file and dump data in

2009-01-13 Thread Albert Hopkins
On Tue, 2009-01-13 at 12:02 -0800, Santiago Romero wrote: > Hi. > > Until now, all my python programs worked with text files. But now I'm > porting an small old C program I wrote lot of years ago to python and > I'm having problems with datatypes (I think). > > some C code: > > fp = fopen( fi

Re: pep 8 constants

2009-01-14 Thread Albert Hopkins
On Wed, 2009-01-14 at 16:58 +1000, James Mills wrote: [...] > Still I would avoid using this idiom altogether > and jsut stick with default values. For Example: > > FOO = 1 > > def f(x=FOO): >... > > > Use this instead: > > def f(x=1): >... That only works well when "1" is only used o

Re: what IDE is the best to write python?

2009-02-03 Thread Istvan Albert
On Feb 2, 12:06 pm, Thorsten Kampe wrote: > > It makes my eyes bleed > > Ever tried sunglasses? Sunglasses for bleeding eyes? For pete's sake try bandages. -- http://mail.python.org/mailman/listinfo/python-list

Re: Kill a function while it's being executed

2009-02-04 Thread Albert Hopkins
On Wed, 2009-02-04 at 13:40 +0200, Noam Aigerman wrote: > Hi All, > I have a script in which I receive a list of functions. I iterate over > the list and run each function. This functions are created by some other > user who is using the lib I wrote. Now, there are some cases in which > the functio

Re: where clause

2009-02-05 Thread Albert Hopkins
On Thu, 2009-02-05 at 10:04 -0800, bearophileh...@lycos.com wrote: > This comes after a small discussion in another Python newsgroup. > Haskell supports a where clause, that's syntactic sugar that allows > you to define things like this: > > p = a / b > where > a = 20 / len(c) > b = foo(

Re: Is c.l.py becoming less friendly?

2009-02-06 Thread Albert Hopkins
Probably that [c.l.]python is becoming more popular and, like most things as they become popular, it loses its "purity"... much like the Internet in the early 1990s. -- http://mail.python.org/mailman/listinfo/python-list

Re: isfifo?

2009-02-07 Thread Albert Hopkins
On Sat, 2009-02-07 at 17:12 +, rdmur...@bitdance.com wrote: > I've googled and looked through os.path, but I don't see a method for > determining if a path points to a FIFO. Anyone know of a simple way to > do so? import os import stat st_mode = os.stat(path)[0] isfifo = stat.S_ISFIFO(st_mod

Re: bool evaluations of generators vs lists

2009-02-10 Thread Albert Hopkins
On Tue, 2009-02-10 at 11:15 -0800, Josh Dukes wrote: > quite simply...what??? > > In [108]: bool([ x for x in range(10) if False ]) > Out[108]: False > > In [109]: bool( x for x in range(10) if False ) > Out[109]: True > > Why do these two evaluate differently? I was expecting that they would >

Re: bool evaluations of generators vs lists

2009-02-10 Thread Albert Hopkins
On Tue, 2009-02-10 at 12:50 -0800, Josh Dukes wrote: > The thing I don't understand is why a generator that has no iterable > values is different from an empty list. Why shouldn't bool == > has_value?? Technically a list, a tuple, and a string are also objects > but if they lack values they're eva

Re: Unicode issue on Windows cmd line

2009-02-11 Thread Albert Hopkins
On Wed, 2009-02-11 at 10:35 -0800, jeffg wrote: > Having issue on Windows cmd. > > Python.exe > >>>a = u'\xf0' > >>>print a > > This gives a unicode error. > > Works fine in IDLE, PythonWin, and my Macbook but I need to run this > from a windows batch. > > Character should look like this "ð". >

Re: Function name limit in Python ?

2009-02-14 Thread Albert Hopkins
On Sat, 2009-02-14 at 07:45 -0700, Linuxguy123 wrote: > Excuse my ignorance, but is there a limit to the size of function names > in Python ? > > I named a function getSynclientVersion() and I got an error when I > called it. You forgot to paste the error. -- http://mail.python.org/mailman/lis

Re: listing files by modification time

2009-02-17 Thread Albert Hopkins
On Tue, 2009-02-17 at 19:46 +0530, Deepak Rokade wrote: > > Yes I can do that but for that I will have to go through entire list > of files and also I will have to first get the whole list of files > present in directory. > > In case of my application this list can be huge and so want to list > t

Re: Regular expression bug?

2009-02-19 Thread Albert Hopkins
On Thu, 2009-02-19 at 10:55 -0800, Ron Garret wrote: > I'm trying to split a CamelCase string into its constituent components. > This kind of works: > > >>> re.split('[a-z][A-Z]', 'fooBarBaz') > ['fo', 'a', 'az'] > > but it consumes the boundary characters. To fix this I tried using > lookahe

Re: Forwarding keyword arguments from one function to another

2009-02-22 Thread Albert Hopkins
On Sun, 2009-02-22 at 11:44 -0800, Ravi wrote: > The following code didn't work: > > class X(object): > def f(self, **kwds): > print kwds > try: > print kwds['i'] * 2 > except KeyError: > print

Re: Forwarding keyword arguments from one function to another

2009-02-22 Thread Albert Hopkins
On Sun, 2009-02-22 at 12:09 -0800, Ravi wrote: > I am sorry about the typo mistake, well the code snippets are as: > > # Non Working: > > class X(object): > def f(self, **kwds): > print kwds > try: > print kwds['i'] * 2 > except KeyError: > print "unknown keyword argument" > s

Re: pickle.load() on an dictionary of dictionaries doesn't load full data structure on first call

2009-02-22 Thread Albert Hopkins
On Sun, 2009-02-22 at 16:15 -0800, James Pearson wrote: > I've been using irclib to write a simple irc bot, and I was running > into some difficulties with pickle. Upon some experimentation with > pdb, I found that pickle.load() doesn't load *all* of the data the > _first_ time it's called. > > F

Re: Python Script to search by Date

2008-11-25 Thread Albert Hopkins
On Tue, 2008-11-25 at 16:10 -0800, [EMAIL PROTECTED] wrote: > What I'm trying to do is decompress a bunch of files depending on the > date/time specified. > > So, we have full backups created every Sunday and transaction backups > every hour afterwards. > > I have everything compressed at an hour

Re: newbie question

2008-11-26 Thread Albert Hopkins
On Wed, 2008-11-26 at 11:11 -0800, Nan wrote: > Hello, >I just started to use Python. I wrote the following code and > expected 'main' would be called. > > def main(): > print "hello" > > main > > But I was wrong. I have to use 'main()' to invoke main. The python > interpreter does not giv

Re: Version upgrade blocked mentally

2008-11-29 Thread Albert Hopkins
On Sat, 2008-11-29 at 12:32 -0800, Adam E wrote: > I have read in my copy of Programming Python that all strings will be > Unicode and there will be a byte type. > > This is mentally keeping me from upgrading to 2.6 . Care to explain? Actually what you describe is a change change takes place in

Re: Convert hexadecimal characters to ascii

2008-11-29 Thread Albert Hopkins
On Sat, 2008-11-29 at 20:39 +, Durand wrote: > Hi, > > I've got this weird problem where in some strings, parts of the string > are in hexadecimal, or thats what I think they are. I'm not exactly > sure...I get something like this: 's\x08 \x08Test!' from parsing a log > file. From what I fo

Re: Emacs vs. Eclipse vs. Vim

2008-11-29 Thread Albert Hopkins
On Sun, 2008-11-30 at 02:18 +0100, Stef Mientki wrote: > > First, you must understand that this is an extremelly dangerous > > question to ask on a public newsgroup (expecially regarding the first > > and the third in the series). Wars have began over this. Many people > > were harmed in those war

Re: Obama's Birth Certificate - Demand that US presidential electors investigate Obama's eligibility

2008-12-03 Thread Albert Hopkins
This has nothing to do with Python. Please take this thread to cares.who.someone. -- http://mail.python.org/mailman/listinfo/python-list

Re: "as" keyword woes

2008-12-03 Thread Albert Hopkins
On Wed, 2008-12-03 at 13:38 -0800, Warren DeLano wrote: > A bottom line / pragmatic question... hopefully not a FAQ. > > Why was it necessary to make "as" a reserved keyword? > > And more to the point, why was it necessary to prevent developers from > being able to refer to attributes named "as

Re: RELEASED Python 3.0 final

2008-12-04 Thread Istvan Albert
Congratulations on a fantastic work! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 read() function

2008-12-04 Thread Istvan Albert
I can confirm this, I am getting very slow read performance when reading a smaller 20 MB file. - Python 2.5 takes 0.4 seconds - Python 3.0 takes 62 seconds fname = "dmel-2R-chromosome-r5.1.fasta" data = open(fname, 'rt').read() print ( len(data) ) -- http://mail.python.org/mailman/listinfo/py

Re: Python 3 read() function

2008-12-04 Thread Istvan Albert
On Dec 4, 1:31 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Jerry Hill wrote: > > That's 3 orders of magnitude slower on python3.0! > > Timing of os interaction may depend on os.  I verified above on WinXp > with 4 meg Pythonxy.chm file.  Eye blink versus 3 secs, duplicated.  I > think something

Re: Python 3 read() function

2008-12-04 Thread Albert Hopkins
On Thu, 2008-12-04 at 20:01 +0100, Дамјан Георгиевски wrote: > > I don't think it matters. Here's a quick comparison between 2.5 and > > 3.0 on a relatively small 17 meg file: > > > > C:\>c:\Python30\python -m timeit -n 1 > > "open('C:\\work\\temp\\bppd_vsub.csv', 'rb').read()" > > 1 loops, best

Re: "as" keyword woes

2008-12-04 Thread Albert Hopkins
It's been a while so I can't remember, but it seems like "yield" was dropped in to python relatively quickly in 2.2. Was there a similar outrage when "yield" became a keyword? -a -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 read() function

2008-12-04 Thread Istvan Albert
Turns out write performance is also slow! The program below takes 3 seconds on python 2.5 17 seconds on python 3.0 yes, 17 seconds! tested many times in various order. I believe the slowdowns are not constant (3x) but some sort of nonlinear function (quadratic?) play with the N to see it.

slow Python 3.0 write performance?

2008-12-05 Thread Istvan Albert
Could someone run the code below on both Python 2.5 and 3.0 For me (on Windows) it runs over 7 times slower with Python 3.0 import time lo, hi, step = 10**5, 10**6, 10**5 # writes increasingly more lines to a file for N in range(lo, hi, step): fp = open('foodata.txt', 'wt') start = time

Re: slow Python 3.0 write performance?

2008-12-05 Thread Istvan Albert
On Dec 5, 3:06 pm, [EMAIL PROTECTED] wrote: > It should get faster over time.  It will get faster over a shorter period of > time if people contribute patches. I see, thanks for the clarification. I will make the point though that this makes python 3.0 unsuited for anyone who has to process data

Re: slow Python 3.0 write performance?

2008-12-05 Thread Istvan Albert
On Dec 5, 3:41 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > I've fixed the read() slowness yesterday. You'll get the fix in the next > release of Python 3.0 in a couple of weeks. Does this fix speed up the write() function as well? A previous poster suggested that in this case the slowdown

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Istvan Albert
On Dec 3, 8:07 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: Originally, like many others here I said YIKES! but on a second read, it is not that bad. It actually grows on you. After looking at it one more time I found it neat, very concise without being unreadable.

Re: Insert Multiple Records Using One Insert Statemen with MySQLdb module

2008-12-06 Thread Albert Hopkins
On Sat, 2008-12-06 at 04:03 -0800, [EMAIL PROTECTED] wrote: > Hi, > > I'd like to insert Multiple Records Using One Insert Statement > > inserting one record using one insert statement works > this is the example: > > import MySQLdb > conn = MySQLdb.connect(host="localhost",.) > cursore = co

When (and why) to use del?

2008-12-09 Thread Albert Hopkins
I'm looking at a person's code and I see a lot of stuff like this: def myfunction(): # do some stuff stuff my_string = function_that_returns_string() # do some stuff with my_string del my_string # do some other stuff r

Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python >=2.6

2008-12-09 Thread Albert Hopkins
Say I have module foo.py: def a(x): def b(): x del x If I run foo.py under Python 2.4.4 I get: File "foo.py", line 4 del x SyntaxError: can not delete variable 'x' referenced in nested scope Under Python

Re: Is 3.0 worth breaking backward compatibility?

2008-12-09 Thread Albert Hopkins
On Tue, 2008-12-09 at 20:56 +, Lie Ryan wrote: > Actually I noticed a tendency from open-source projects to have slow > increment of version number, while proprietary projects usually have > big > version numbers. > > Linux 2.x: 1991 Python 3.x.x: 1991. Apache 2.0: 1995. OpenOffice.org > 3.0

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python >=2.6

2008-12-09 Thread Albert Hopkins
On Tue, 2008-12-09 at 22:57 +, Steven D'Aprano wrote: [...] > > So is there a way to find the offending code w/o having to go > through > > every line of code in 'foo' by hand? > > Just search for "del x" in your code. Your editor does have a search > function, surely? > > Well, you'd th

<    1   2   3   4   5   6   7   8   9   10   >