Re: Anyone read "Python Interview Questions: Python Certification Review"?

2009-03-04 Thread Tim Chase
On a recent trawl of the internet for some Python books, I came across "Python Interview Questions: Python Certification Review" by ITCOOKBOOK.COM http://www.itcookbook.com/store/index.php?main_page=product_info&products_id=15 Has anyone used this, or even one of the related books? While I c

Re: Roulette wheel

2009-03-04 Thread Tim Wintle
On Wed, 2009-03-04 at 18:02 +, mattia wrote: > ri = randint(0, len(rw) - 1) > print("Random index:", rw[ri], ", value:", pop[rw[ri]]) you probably want random.choice(rw) -- http://mail.python.org/mailman/listinfo/python-list

Re: Can Python do shopping cart?

2009-03-06 Thread Tim Wintle
d a wrapper to files on disk - then it's just your OS's limits that hold it back - so python is turing/register complete. Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem in accessing long paths.

2009-03-06 Thread Tim Golden
[email protected] wrote: > Hello All, > I have a requirement where I've to access folders with > path lengths >255 ( Windows only supports 255). To do this I've > created junction points for the folders whose length is > 255. The problem is my python script is unable to recognize

Re: This should be a simple question...

2009-03-06 Thread Tim Chase
Maybe I'm missing something obvious here def A (...): #set a bunch of variables x = 1 b = 2 ... Do something with them def B (...): #set the same bunch of variables x = 1 b = 2 ... Do something with them I want to apply DRY, and extract out the common setting of these variable

Re: This should be a simple question...

2009-03-06 Thread Tim Chase
As Diez suggests, if you don't want to litter your global namespace, use a class: class Foo: x = 1 b = 2 @classmethod def A(cls, *args, **kwargs): do_stuff_with(Foo.x, Foo.b, args, kwargs) @classmethod def B(cls,*args, **kwargs): do_other_stuff_with(Foo.x, Fo

Re: ANN: Dao, the official 1.0 version is released

2009-03-06 Thread Tim Greer
t's not the way to get interest in your language. -- Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc. Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers and Custom Hosting. 24/7 support, 30 day guarantee, secure servers. Industry's most experienced staff! -- Web

Re: ANN: Dao, the official 1.0 version is released

2009-03-06 Thread Tim Greer
Limin Fu wrote: > To Tim Greer and others: > > Some people may think this kind of announcement are off topic in a > group for another language. This is not exactly true. This is still > about programming, there are so many programmers out there, who knows > if there would be s

Re: Indentations and future evolution of languages

2009-03-06 Thread Tim Rowe
not necessary (but still legal). That seems to me to work pretty cleanly. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: strings for beginers

2009-03-07 Thread Tim Wintle
On Sat, 2009-03-07 at 12:53 -0800, Sapote wrote: > I have an incrementing variable disc_num that I could insert in the > line below to create discspanisoX.iso where X is incrementing... > > burn_cmd = "mkisofs -udf -o /home/donkey/discspaniso.iso -graft- > points --path-list %s" %(temp_list)

Re: strings for beginers

2009-03-07 Thread Tim Wintle
On Sat, 2009-03-07 at 21:25 +, Tim Wintle wrote: > burn_cmd = "mkisofs -udf -o /home/donkey/discspaniso%d.iso > -graft-points --path-list %s" %(x,temp_list) obviously I meant to say burn_cmd = "mkisofs -udf -o /home/donkey/discspaniso% d.iso-graft-points --pat

Re: speeding up reading files (possibly with cython)

2009-03-07 Thread Tim Chase
i have a program that essentially loops through a textfile file thats about 800 MB in size containing tab separated data... my program parses this file and stores its fields in a dictionary of lists. for line in file: split_values = line.strip().split('\t') # do stuff with split_values curre

Re: Themed TK (tk Tile) at last?!

2009-03-07 Thread Tim Wintle
Gtk? > Good job python-dev team. And especially Guilherme Polo for doing all the tough work as far as I tell from the issue and the commit logs. Am I right this was a Google Summer of Code project? If so then thanks to Google as well for sponsoring it. Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: Indentations and future evolution of languages

2009-03-07 Thread Tim Roberts
Tim Rowe wrote: > >I don't think the article is right that "it's silly to have some >expression/statement groupings indentation based and some grouped by >enclosing tokens" -- provided it's done right. The OCAML-based >language F# accepts OCAML enclosing

Re: should i move on to python3

2009-03-07 Thread Tim Wintle
#x27;s JVM for 6 and 5, and IBM's JDK for Java 5 all running. Similarly, on various machines I use CPython 2.3, 2.4, 2.5, 2.6 and Jython 2.2 for various reasons - and I'm certainly planning on using PyPy a large amount once it's stable. I used the Beta of 3.0, but to be honest I ha

Re: Ban Xah Lee

2009-03-07 Thread Tim Greer
osting and arguing with people. That is why people probably kill filed you (there's no "ban" feature for usenet itself). I'm going to go out on a limb here and say that you're not as important as you like to think yourself. Into the killfile you go. -- Tim Greer, CEO/Foun

Re: Ban Xah Lee

2009-03-07 Thread Tim Roberts
r vitriol, and being pleasant to the unwashed ignorant masses, but that's what it takes. If you don't CARE whether anyone reads your words, then please feel free to continue with your current behaviors. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail

Re: Is there a better way of doing this?

2009-03-07 Thread Tim Wintle
(obviously doesn't change how "environmentally harmful" something is) Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: speeding up reading files (possibly with cython)

2009-03-08 Thread Tim Chase
Steven D'Aprano wrote: per wrote: currently, this is very slow in python, even if all i do is break up each line using split() ** and store its values in a dictionary, ** indexing by one of the tab separated values in the file. If that's the problem, the sol

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Gabriel Genellina wrote: En Fri, 06 Mar 2009 06:52:00 -0200, escribió: I have succeeded in building Python 2.6.1 from source under Windows XP by running Visual C++ 2008 Express on the PCbuild/pcbuild.sln file both from the Visual C++ application as well as from the commandline [...] I would li

Re: Set & Frozenset?

2009-03-08 Thread Tim Golden
Diez B. Roggisch wrote: Hans Larsen schrieb: Could you help me ? How could I "take" an elemment from a set or a frozenset .-) ? From a string (unicode? Python<3), or from a tuple,or from a list: Element by index or slice. From a dict: by k

Re: Set & Frozenset?

2009-03-08 Thread Tim Golden
Tim Golden wrote: Diez B. Roggisch wrote: Hans Larsen schrieb: Could you help me ? How could I "take" an elemment from a set or a frozenset .-) ? From a string (unicode? Python<3), or from a tuple,or from a list: Element by i

Re: Sharing objects between processes

2009-03-08 Thread Tim Golden
ET wrote: Using the 'with' keyword didn't work... Just an aside here for any multiprocessing maintainers watching ;) . I expect that the "didn't work" here refers to this bug: http://bugs.python.org/issue5261 Altho' if the OP cares to clarify, it might be something else. TJG -- http://mail.

Re: Chandler, Python, speed

2009-03-08 Thread Tim Wintle
've got is the long shutdown times, which is caused by backing up a copy of _Everything_ to disk, so that upgrades can happen cleanly - sure that's going to be fixed though. Startup time is a bit slow too, but it's designed to be left open all the time, and it's fairly zippy once it&#

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Martin v. Löwis wrote: In addition, the CVS version of pywin32 which I built in order to run the msi.py script has a small bug in genpy which prevents it from generating COM support in the way in which msi.py does it. I'm using Python 2.4 to run msi.py; that has always worked fine for me. Int

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Scott David Daniels wrote: Tim Golden wrote: ... Anyhow, at the end I have a working Python 2.7a0 running under Windows. Do you mean 3.1a0? As far as I know, 2.7a0 requires the use of the time machine, as it is expected to be 3 months out. No; 2.7a0 is the version number of the svn HEAD

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Martin v. Löwis wrote: What does the merge do? I can't find mention of it in the docs. It merges the msvcrt merge module into the installer (and then monkey patches it, to revert the msm decision of setting ALLUSERS). I tried to integrate it originally as a step after creating the msi. Unfortun

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Martin v. Löwis wrote: merge.py attempts to import config.py but I can't find it... Just create an empty one. Won't quite work: merge tries to find full_current_version which is determined (if None) in msi.py from the rather involved current version stuff. I'm going to give up on this for to

Re: How to extract some text?

2009-03-08 Thread Tim Pinkawa
ot;, pos)] 'http://youtube.example.com/login.aspx' Find the first single quote, then get the character range between that and the next single quote. Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: Ban Xah Lee

2009-03-08 Thread Tim Greer
o that thinks he's incredibly important and interesting, and just ignores people's requests for him to stop cross posting. In the end, I've seen worse posters than Xah Lee, but he's in my killfile. -- Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc. Shared Hosting, Reseller Ho

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Martin v. Löwis wrote: Just create an empty one. Won't quite work: merge tries to find full_current_version which is determined (if None) in msi.py from the rather involved current version stuff. Only if you don't pass an msi file on the command line. So I recommend that you do that. OK.

Re: Is python worth learning as a second language?

2009-03-09 Thread Tim Wintle
On Mon, 2009-03-09 at 11:19 +, Lie Ryan wrote: > Certainly. A programmer that only knows one language would be too > limited. Try as many programming language as you can, and especially > look for programming languages that have "obscenely different" paradigm > than the language you already

Re: Python3 on the Web

2009-03-09 Thread Tim Roberts
to handle 100 hits a second, then CGI is not appropriate, but let's be honest: the web sites that most of us produce have to struggle under a devastating load of about 100 hits a day. At that level of load, CGI is perfectly workable, and it's certainly the easiest of the choices for develop

Re: This should be a simple question...

2009-03-09 Thread Tim Chase
Steven D'Aprano wrote: Tim Chase wrote: If the constants don't actually share any conceptual commonality, then SteveH is right, that they really should just be globals. Surely that's backwards? If the constants don't share any conceptual commonality, they should be kep

Re: Is python worth learning as a second language?

2009-03-09 Thread Tim Rowe
low learning curve -- a reasonable programmer can become productive in Python very quickly. For one programmer's experience of learning Python have a look at http://www.python.org/about/success/esr/ (although I grant that Eric Raymond might count slightly higher than just a /reasona

create a list of undocumented functions

2009-03-09 Thread Tim Michelsen
Hello, is there a scipt or any other possibility to create a list of all undocumente functions (without docstrings) within a package or at least module? Thanks for your help in advance. Regards, Timmie -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.6.1 - simple division

2009-03-09 Thread Tim Rowe
t fractions that can be expressed exactly in decimal can end up as recurring decimals in binary. 0.8 looks nice and tidy, but in binary (if I get this right) it's 0.1100110011001100..., recurring ad infinitum. The computer has to truncate it somewhere. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: create a list of undocumented functions

2009-03-09 Thread Tim Michelsen
Thanks so much. I will try this. May you also have a look at: creating a list of all imported modules http://www.nabble.com/creating-a-list-of-all-imported-modules-to22418347.html Do you have an idea? Thanks & regards, Timmie -- http://mail.python.org/mailman/listinfo/python-list

Re: Ban Xah Lee

2009-03-09 Thread Tim Greer
personal blog medium, so all of his thoughts and feelings are continually posted in places they don't belong -- and he doesn't care). -- Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc. Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers and Custom Hosting. 24/7 support,

Re: Which Lisp to Learn?

2009-03-09 Thread Tim Greer
t seem to know much about Perl or Python and he posts a lisp post to these groups? Sounds like he indeed doesn't know what LISP is). -- Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc. Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers and Custom Hosting. 24/7 support,

Re: Read from .csv file

2009-03-09 Thread Tim Chase
I would be thankfukl if you answer to the following easy question: How can I read from a .csv file in Python and save the data in a array or dictionary. I suspect your teacher expects you to use the "csv" module[1] in the standard library. -tkc [1] http://docs.python.org/library/csv.html

Re: Windows install to custom location after building from source

2009-03-09 Thread Tim Golden
Tim Golden wrote: Martin v. Löwis wrote: Just create an empty one. Won't quite work: merge tries to find full_current_version which is determined (if None) in msi.py from the rather involved current version stuff. Only if you don't pass an msi file on the command line. So I reco

creating a list of all imported modules

2009-03-09 Thread Tim Michelsen
Hello, how do I create a list of all modules imported by my module/script and which are present in the namespace? I am looking for something like %who in Ipython. My aim is to create a file for the documentation that shows all dependencies of my script on external (3rd party) libraries. T

Re: Ban Xah Lee

2009-03-09 Thread Tim Greer
o groups that hold no relevance, as if they are your personal blog. Usenet is not a blog. > Also, thanks to many supporters over the past years. I'm sure. > Truly Your Superior, I'd think anyone superior to me would understand how to use usenet properly. I'm being

Re: Windows install to custom location after building from source

2009-03-09 Thread Tim Golden
Martin v. Löwis wrote: AFAICT, it only complained about errors in merging _Validation. I'm not sure whether I get the same errors (I would have to check); those errors can safely be ignored. Good. I also see that it fails to add custom actions into InstallExecuteSequence. I find that puzzling

Re: 2.6.1 - simple division

2009-03-10 Thread Tim Chase
[email protected] wrote: 4 / 5.0 0.84 0.8 * 5 4.0 Start here: http://docs.python.org/tutorial/floatingpoint.html Play with these: >>> 4/5.0 0.84 >>> print 4/5.0 0.8 >>> print repr(4/5.0) 0.84 >>> str(4/5.0) '0.8' >>> repr(4/5.0) '0.8000

Re: Windows install to custom location after building from source

2009-03-10 Thread Tim Golden
Martin v. Löwis wrote: BTW what are your feelings on a patch to msi.py to change the names of the directories it's looking for to pick up the Tk licenses? It's a bit of a grey area since the only "canonical" reference I can find is the externals checkout from within tools\buildbot: you might as w

Re: Ban Xah Lee

2009-03-10 Thread Tim Wintle
On Mon, 2009-03-09 at 21:28 -0700, Luis Gonzalez wrote: > C'mon guys, Xha Lee always wins, because fools like you get mad at him > instead of ignoring him. Here here! -- http://mail.python.org/mailman/listinfo/python-list

Re: Determining from which web page a cgi script is invoked?

2009-03-10 Thread Tim Chase
[email protected] wrote: Given a webpage test.html that has a form with a cgi script, how can you determine inside the cgi script the name of the webpage that invoked the script? I have many different html pages that use a common cgi script for form processing and want to determine the n

Re: Windows install to custom location after building from source

2009-03-10 Thread Tim Golden
Martin v. Löwis wrote: First, it relies on config.py whose existence msi.py optionally ignores. Feel free to create a patch for that. http://bugs.python.org/issue5467 TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows install to custom location after building from source

2009-03-10 Thread Tim Golden
Martin v. Löwis wrote: I also see that it fails to add custom actions into InstallExecuteSequence. I find that puzzling - apparently, it tries to merge the twice. Are you sure you didn't run it twice? It will certainly fail the second time. Just to confirm: I'm certainly only running this once

Re: Windows install to custom location after building from source

2009-03-10 Thread Tim Golden
Tim Golden wrote: However, the .msi installs (and Python runs) without issue on a virgin VirtualXP. And it passes the basic test suite ok. I lied. test_zipfile fails because the new(ish) zipdir.zip doesn't get carried across to the install. Patched in: http://bugs.python.org/issue547

Python 2.7 MSI / pywin32 snapshots [was: Windows install to custom location ...]

2009-03-10 Thread Tim Golden
Scott David Daniels wrote: Tim Golden wrote: ... Anyhow, at the end I have a working Python 2.7a0 running under Windows. Do you mean 3.1a0? As far as I know, 2.7a0 requires the use of the time machine, as it is expected to be 3 months out. If you do get an installer built, even having a

Re: Indentations and future evolution of languages

2009-03-10 Thread Tim Rowe
2009/3/8 Tim Roberts : > Tim Rowe wrote: >> >>I don't think the article is right that "it's silly to have some >>expression/statement groupings indentation based and some grouped by >>enclosing tokens" -- provided it's done right. The OCAML-bas

Re: Problem with os.chdir()

2009-03-10 Thread Tim Golden
[email protected] wrote: Hello all, I am writing a python script which has to access deep paths then supported normally by the Windows OS (>255). So I am appending "\ \?\" to do so. But when I use the path in the above fashion with os.chdir() it is unable to recognize my folder a

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
[email protected] wrote: On Mar 11, 11:08 am, Tim Golden wrote: [email protected] wrote: Hello all, I am writing a python script which has to access deep paths then supported normally by the Windows OS (>255). So I am appending "\ \?\" to do so. But when I

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
Here is my code snippet which you will be interested in: Indeed. file = ur'\\?\C:\\TestDataSet\DeepPaths \DeepPathLevel01\DeepPathLevel02\DeepPathLevel03\DeepPathLevel04\DeepPathLevel05\DeepPathLevel06\DeepPathLevel07\DeepPathLevel08\DeepPathLevel09\DeepPathLevel10\DeepPathLevel11\DeepPathLeve

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
[email protected] wrote: On Mar 11, 5:19 pm, Tim Golden wrote: Here is my code snippet which you will be interested in: Indeed. file = ur'\\?\C:\\TestDataSet\DeepPaths \DeepPathLevel01\DeepPathLevel02\DeepPathLevel03\DeepPathLevel04\DeepPathLe vel05\DeepPathLevel06\DeepPathLe

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
[email protected] wrote: On Mar 11, 6:41 pm, Tim Golden wrote: [email protected] wrote: On Mar 11, 5:19 pm, Tim Golden wrote: Here is my code snippet which you will be interested in: Indeed. file = ur'\\?\C:\\TestDataSet\DeepPaths \DeepPathLevel01\DeepPathLe

Re: Behaviour of os.rename()

2009-03-11 Thread Tim Golden
[email protected] wrote: Hello all, I got a suspicion on the behaviour of os.rename (src,dst).If the src is the path of a file and dst is a new filename this os.rename() function is infact creating a new file with the dst name in the current working directory and leaving the src

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
[email protected] wrote: On Mar 11, 7:17 pm, Tim Golden wrote: [email protected] wrote: On Mar 11, 6:41 pm, Tim Golden wrote: [email protected] wrote: On Mar 11, 5:19 pm, Tim Golden wrote: Here is my code snippet which you will be interested in: Indeed. file = ur

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
Hendrik van Rooyen wrote: "Tim Golden" wrote: Well, a little bit of experimentation shows that you can *create* paths this deep (say, with os.mkdir). But you can't actually set the current directory to it. So the Is this also true if you try to go there by a succession of

Re: ipython / vs \ in readline on MS Windows (and ipython help grepper)

2009-03-11 Thread Tim Roberts
27;ll have to change it to something like '/'.join. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Raw String Question

2009-03-12 Thread Tim Chase
>>> r"a\" SyntaxError: EOL while scanning string literal (, line 1) It seems the parser is interpreting the backslash as an escape character in a raw string if the backslash is the last character. Is this expected? Yep...as documented[1], "even a raw string cannot end in an odd number of b

Re: Python 2.7 MSI / pywin32 snapshots [was: Windows install to custom location ...]

2009-03-12 Thread Tim Golden
Scott David Daniels wrote: Tim Golden wrote: Scott David Daniels wrote: Tim Golden wrote: ... Anyhow, at the end I have a working Python 2.7a0 running under Windows. Do you mean 3.1a0? As far as I know, 2.7a0 requires the use of the time machine, as it is expected to be 3 months out. If

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Tim Rowe
nate) problems caused by dot and comma confusion.. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-13 Thread Tim Rowe
ness in presenting those numbers. If "Finance users and non-professional programmers find the locale approach to be frustrating, arcane and non-obvious" then by all means propose a way of making it simpler and clearer, but not a bodge that will increase the amount of bad software in the w

Re: Memory efficient tuple storage

2009-03-13 Thread Tim Wintle
in my_file: chromosome = reference_dict.setdefault(chromosome,chromosome) list_of_coordinates.append((chromosome,posn)) (or something like that) Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory efficient tuple storage

2009-03-13 Thread Tim Chase
While Kurt gave some excellent ideas for using numpy, there were some missing details in your original post that might help folks come up with a "work smarter, not harder" solution. Clearly, you're not loading it into memory just for giggles -- surely you're *doing* something with it once it's

Re: How to find "in" in the documentation

2009-03-13 Thread Tim Chase
I've had this trouble before, how do I find the details of how "in" works in the documentation. E.g. the details of:- if string in bigstring: It's tough to find those generic keywords. It happens to be documented a bit here: http://docs.python.org/library/operator.html#operator.contain

Re: How to find "in" in the documentation

2009-03-14 Thread Tim Golden
Colin J. Williams wrote: Piet van Oostrum wrote: [email protected] (t) wrote: t> I've had this trouble before, how do I find the details of how "in" t> works in the documentation. E.g. the details of:- t> if string in bigstring: t> It gets a mention in the "if" section but not a l

Re: How to find "in" in the documentation

2009-03-14 Thread Tim Golden
jkn wrote: On Mar 14, 7:00 am, Tim Golden wrote: Well, this may not solve the OP's problem, but the current (2.7a0) .chm file has a much better index for operators and keywords. And "in" is in there. If you're interested in comparing, there's a copy here: http

Re: How to find "in" in the documentation

2009-03-14 Thread Tim Golden
Colin J. Williams wrote: Tim Golden wrote: Colin J. Williams wrote: Piet van Oostrum wrote: [email protected] (t) wrote: t> I've had this trouble before, how do I find the details of how "in" t> works in the documentation. E.g. the details of:- t> if strin

Re: PyWin32 for Python 3.x

2009-03-14 Thread Tim Golden
John Nagle wrote: Any idea when PyWin32 will be available for Python 3.x? John Nagle Release 213 is out already: http://sourceforge.net/project/showfiles.php?group_id=78018&package_id=79063&release_id=661475 I think it's still considered a little bit beta. There have been

Re: String to sequence

2009-03-14 Thread Tim Chase
How can I convert the following string: 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' into this sequence: ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','SXF','BZR','BIQ','BLL','BHX','BLQ'] Though several other options have come through: >>> s = "'

Re: PyWin32 for Python 3.x

2009-03-15 Thread Tim Golden
John Nagle wrote: That "wizard" won't even install unless Python 3.0 is "in the registry", which apparently means "installed as the default Python". No, it just means "installed somewhere". I have 6 different versions of Python installed on this box. The choice of which is "the default" is m

Re: PyWin32 for Python 3.x

2009-03-15 Thread Tim Golden
John Nagle wrote: Well, of some other packages I use: MySQLdb: "Python versions 2.3-2.5 are supported." Ref: http://sourceforge.net/projects/mysql-python M2Crypto: Latest version is for Python 2.6. Ref: http://chandlerproject.org/bin/view/Projects/MeTooCrypto Somebody

Re: ipython / vs \ in readline on MS Windows (and ipython help grepper)

2009-03-15 Thread Tim Roberts
ike a Unix command line, resulting in ls c:windowsystem32qqq.dll -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Get pixel colors from images in Python 3

2009-03-15 Thread Tim Roberts
all of the strange variations on JPEG, PNG, and GIF. You REALLY do not want to try to reimplement all of that. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-15 Thread Tim Rowe
ou worry about > the format that you want to display it in. Nothing in the proposal being considered addresses any of that. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: Style question - defining immutable class data members

2009-03-15 Thread Tim Wintle
On Sun, 2009-03-15 at 10:39 -0700, John Posner wrote: > (My apologies if the thread has already covered this.) I believe I understand > the WHAT in this situation, but I don't understand the WHY ... > Is there a beneficial effect of silently creating the instance attribute, > which outweighs the

Re: Style question - defining immutable class data members

2009-03-15 Thread Tim Wintle
On Mon, 2009-03-16 at 04:02 +, Tim Wintle wrote: > On Sun, 2009-03-15 at 10:39 -0700, John Posner wrote: Doh, reply out of thread there - I meant to reply to Rhodi's comment further down. > Is there any actual advantage to self.attribute picking up > Class.attribute instea

Re: how to identify the file system type of a drive?

2009-03-16 Thread Tim Golden
[email protected] wrote: hi all, Is there any way to identify the File system type of a drive in python in Windows? Some thing like: C:\ -- NTFS D:\ -- FAT32.. import win32api import win32file def file_system (drive_letter): return win32api.GetVolumeInformation ( win32fil

Re: array next pointer

2009-03-17 Thread Tim Chase
not sure from what version, but certainly in 2.6 and on, you can improve the syntax slightly: b = iter(a) b.next() This syntax (also my preferred version) has been available since at least 2.3 -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem while copying a file from a remote filer

2009-03-17 Thread Tim Golden
Jorgen Grahn wrote: On Sun, 15 Mar 2009 22:47:54 -0700, Chris Rebert wrote: On Sun, Mar 15, 2009 at 10:24 PM, [email protected] wrote: Hi all, I have to write an application which does a move and copy of a file from a remote machine to the local machine. I tried something like: fi

Re: How to do this in Python?

2009-03-17 Thread Tim Chase
Am I missing something basic, or is this the canonical way: with open(filename,"rb") as f: buf = f.read(1) while len(buf) > 0 # do something buf = f.read(1) That will certainly do. Since read() should simply return a 0-length string

Re: How to do this in Python?

2009-03-18 Thread Tim Chase
def chunk_file(fp, chunksize=1): s = fp.read(chunksize) while s: yield s s = fp.read(chunksize) Ah. That's the Pythonesque way I was looking for. That's not pythonic unless you really do need to use chumk_file() in a lot of places (IMO, more than 3 or 4). If it only

Re: Creating 50K text files in python

2009-03-18 Thread Tim Chase
I've an application where I need to create 50K files spread uniformly across 50 folders in python. The content can be the name of file itself repeated 10 times.I wrote a code using normal for loops but it is taking hours together for that. Can some one please share the code for it using

Re: Run on Startup

2009-03-18 Thread Tim Wintle
On Wed, 2009-03-18 at 11:13 -0700, Mike Driscoll wrote: > On Mar 18, 1:09 am, "Gabriel Genellina" > > Any decent installer is able to register a program so it runs on startup > > (InnoSetup, by example). Anyway, if you want to it it yourself, > > see:http://msdn.microsoft.com/en-us/library/bb77

Re: split problem if the delimiter is inside the text limiter

2009-03-18 Thread Tim Chase
sql = ''' INSERT INTO table (column1,column2, ...) VALUES ( %s, %s, ); ''' for row in rows: connection.cursor.execute(sql % (row[0],row[1],)) connection.corsur.commit() but something binary in a cell, the pgdb says it is not in utf-8 format, or something like this. I know it's a newbi

Re: split problem if the delimiter is inside the text limiter

2009-03-18 Thread Tim Chase
Bruno Desthuilliers wrote: Tim Chase a écrit : (if your columns in your CSV happen to match the order of your INSERT statement, you can just use execute(sql, tuple(row)) Or more simply: cursor.execute(sql, row) that's always annoyed me with the mxODBC drivers I've us

Re: How complex is complex?

2009-03-18 Thread Tim Roberts
[email protected] wrote: > >In Python 3 those lines become shorter: > >for k, v in a.items(): >{k: v+1 for k, v in a.items()} That's a syntax I have not seen in the 2-to-3 difference docs, so I'm not familiar with it. How does that cause "a" to be updat

Re: python equivalent of java technologies

2009-03-19 Thread Tim Hoffman
Oops , for RIA there is always pyjamas (gwt for python ;-) T On Mar 19, 7:52 pm, Tim Hoffman wrote: > Hi > > Well zope has quite a few of these out of the box and have been around > for a bit longer than some of the java options. > > Specifically persistence (ZODB persistence

Re: mxODBC (was "split problem if the delimiter is inside the text limiter")

2009-03-19 Thread Tim Chase
DB-API 2.0 has cursor.executemany() to make this differentiation at the API level. mxODBC will lift this requirement in the next version, promised :-) glad to hear...will executemany() take an arbitrary iterable? My (albeit somewhat-antiquated) version balked at anything that wasn't a list/t

Re: python equivalent of java technologies

2009-03-19 Thread Tim Hoffman
Hi Well zope has quite a few of these out of the box and have been around for a bit longer than some of the java options. Specifically persistence (ZODB persistence in zope is pretty much completely autmomatic) you can inplement web services with it (xmlrpc out of the box, though I assume you me

Re: converting pipe delimited file to fixed width

2009-03-19 Thread Tim Chase
Caveat: none of the solutions (including mine) deal with the case of the field being longer than the width. You might want to throw an exception. Alternatively, you can just crop the results. Tweaking MRAB's elegant solution: field_widths = [14, 6, 18, 21, 21, 4, 6] infile = open("input.

Re: Threads not Improving Performance in Program

2009-03-19 Thread Tim Rowe
optimum for all possible applications, each one has different compromises. You've just discovered one of Python's. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: How complex is complex?

2009-03-20 Thread Tim Rowe
2009/3/20 Hendrik van Rooyen : > A joke based on the Monty Python series is BY DEFINITION not stupid! But may get /too/ silly. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: Obtaining the attributes and properties of a folder recursively.

2009-03-20 Thread Tim Golden
[email protected] wrote: Hello all, Is there any way to list out all the properties (name, type, size) and attributes( Accesstime, mod time, archived or readonly etc) of a folder and its contents recursively. Should I need ot go inside each and every directory to list them? This

Re: Obtaining the attributes and properties of a folder recursively.

2009-03-20 Thread Tim Golden
Tino Wildenhain wrote: Tim Golden wrote: ... and do the following: from winsys import fs for f in fs.flat ("c:/temp"): f.dump () ^ eeek! Was the k! for the space before the bracket (which, for some unaccountable reason disturbs some people)? Or for the idea of du

<    49   50   51   52   53   54   55   56   57   58   >