ifn parser tools for csound 1.05 is now available

2009-10-16 Thread edexter
Ifn parser tools includes a number of csound tools that are usefull within an ide along with a ifn renumbering tool that helps with numbering unencapsulated instruments in csound. The current version includes an ifn renumber, an ifn locater, a depreceated csound command locater and a pfield

Python-URL! - weekly Python news and links (Oct 15)

2009-10-16 Thread Gabriel Genellina
QOTW: It is however, much like the framework in question, best kept private and not made public. - Ed Singleton, on a perfectly healthful and acceptable practice ... left unnamed here http://groups.google.com/group/comp.lang.python/msg/987b1a7a4b9 01f3f Looking for a sane way of

pyArkansas - November 14th

2009-10-16 Thread Greg Lindstrom
The 2nd annual pyArkansas conference will be held on Saturday, November 14th, on the campus of the University of Central Arkansas in Conway, Arkansas. The conference is put on be the Python Artists of Arkansas (pyAR^2) and hosted by the UCA Department of Computer Science. Scheduled classes

Re: Load a list subset with pickle?

2009-10-16 Thread Gabriel Genellina
En Thu, 15 Oct 2009 16:28:11 -0300, Peng Yu pengyu...@gmail.com escribió: On Thu, Oct 15, 2009 at 12:01 PM, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Thu, 15 Oct 2009 13:05:18 -0300, Peng Yu pengyu...@gmail.com escribió: How do I determine if I have loaded all the elements? I use

Re: set using alternative hash function?

2009-10-16 Thread OKB (not okblacke)
Austin Bingham wrote: To put it in code, I want this: s = set(hash_func = lambda obj: hash(obj.name), eq_func = ...) ... x.name = 'foo' y.name = 'foo' s.add(x) s.add(y) # no-op because of uniqueness criteria assert len(s) == 1 The part of this that seems

Re: optparse, allowing both --foo and foo=99?

2009-10-16 Thread Carl Banks
On Oct 15, 10:29 pm, Mark Harrison m...@ohm.dynamic.pixar.com wrote: What's the magic to allow this?  If the value is not specified I would like to use the default value of 1. import optparse p=optparse.OptionParser() p.add_option(--debug) (opts, args) = p.parse_args(['--debug=22']); print

Re: How about adding slice notation to iterators/generators?

2009-10-16 Thread Terry Reedy
Eloff wrote: I was just working with a generator for a tree that I wanted to skip the first result (root node.) There is already an obvious standard way to do this. it = whatever next(it) #toss first item for item in it: And it occurs to me, why do we need to do: import sys from

optparse, allowing both --foo and foo=99?

2009-10-16 Thread Mark Harrison
What's the magic to allow this? If the value is not specified I would like to use the default value of 1. import optparse p=optparse.OptionParser() p.add_option(--debug) (opts, args) = p.parse_args(['--debug=22']); print opts (opts, args) = p.parse_args(['--debug']);print opts Many TIA!

Re: How about adding slice notation to iterators/generators?

2009-10-16 Thread Bearophile
Terry Reedy: 1. islice works with any iterator; generator method would only work with generators A slice syntax that's syntactic sugar for islice(some_iter,1,None) may be added to all iterators. 2. iterator protocol is intentionally simple. Slice syntax is already available for lists,

Re: Object Relational Mappers are evil (a meditation)

2009-10-16 Thread Tim Wintle
On Fri, 2009-10-16 at 01:01 +0200, Mick Krippendorf wrote: Maybe my English (and my memory) is just not so good. I'm german, and here abnormal and anormal are both negations of normal, but with a slight difference in meaning. anormal means just not normal, whereas the meaning of abnormal is

ANN: GUI2Exe 0.5.0

2009-10-16 Thread Andrea Gavana
Hi All, I am happy to announce a new release of GUI2Exe (0.5.0). What is it? = GUI2Exe is my first attempt to unify all the available executable builders for Python in a single and simple to use graphical user interface. At the moment the supported executable builders are: -

Re: optparse, allowing both --foo and foo=99?

2009-10-16 Thread Jean-Michel Pichavant
Carl Banks wrote: On Oct 15, 10:29 pm, Mark Harrison m...@ohm.dynamic.pixar.com wrote: What's the magic to allow this? If the value is not specified I would like to use the default value of 1. import optparse p=optparse.OptionParser() p.add_option(--debug) (opts, args) =

Re: optparse, allowing both --foo and foo=99?

2009-10-16 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Carl Banks wrote: On Oct 15, 10:29 pm, Mark Harrison m...@ohm.dynamic.pixar.com wrote: What's the magic to allow this? If the value is not specified I would like to use the default value of 1. import optparse p=optparse.OptionParser() p.add_option(--debug)

Re: struct curiosity

2009-10-16 Thread Richard Brodie
pjcoup pjc...@gmail.com wrote in message news:b1537079-6e3a-43e1-814b-7ccf185fb...@v15g2000prn.googlegroups.com... I would have expected calcsize('BB') to be either 10 or 12 (padding), but 11? Is there a simple explanation of what is going on here? The purpose of the padding is to

Re: How to schedule system calls with Python

2009-10-16 Thread Christian Heimes
MRAB wrote: You could use multithreading: put the commands into a queue; start the same number of worker threads as there are processors; each worker thread repeatedly gets a command from the queue and then runs it using os.system(); if a worker thread finds that the queue is empty when it

Iterators

2009-10-16 Thread Kelson Folkvard Braaten ZAWACK
Recently I was iterating through both a list and a file and I noticed a difference in behavior. When I create an iterator for a list by calling iter(list_name) and then call the iterators next method I get the first element in the list. When I then create another iterator over the same list and

Re: ANN: ActivePython 2.6.3.7 (and PyPM) is now available

2009-10-16 Thread denis
On Oct 7, 2:16 am, Sridhar Ratnakumar sridh...@activestate.com wrote: ... This release includes a new packaging tool by activestate called Python Package Manager (PyPM).PyPM- currently in beta - is the package Sridhar, folks, the ActivePython FAQ says While you can install most packages

Re: Iterators

2009-10-16 Thread Chris Rebert
On Fri, Oct 16, 2009 at 2:24 AM, Kelson Folkvard Braaten ZAWACK zawack...@gis.a-star.edu.sg wrote: Recently I was iterating through both a list and a file and I noticed a difference in behavior.  When I create an iterator for a list by calling iter(list_name) and then call the iterators  next

Re: how to write a unicode string to a file ?

2009-10-16 Thread Niklas Norrthon
On 16 Okt, 06:10, Donn donn.in...@gmail.com wrote: On Friday 16 October 2009 01:59:43 Stephen Hansen wrote: Just to say, thanks for that post. I am an old ascii dog and this notion of encoding and decoding is taking such a lng time to penetrate my thick skull. Little snippets like your

Re: struct curiosity

2009-10-16 Thread Peter Otten
Richard Brodie wrote: pjcoup pjc...@gmail.com wrote in message news:b1537079-6e3a-43e1-814b-7ccf185fb...@v15g2000prn.googlegroups.com... I would have expected calcsize('BB') to be either 10 or 12 (padding), but 11? Is there a simple explanation of what is going on here? The

Re: set using alternative hash function?

2009-10-16 Thread Dave Angel
Austin Bingham wrote: On Thu, Oct 15, 2009 at 7:49 PM, Ethan Furman et...@stoneleaf.us wrote: Austin Bingham wrote: I'm feeling really dense about now... What am I missing? What you're missing is the entire discussion up to this point. I was looking for a way to use an alternative

Re: how to write a unicode string to a file ?

2009-10-16 Thread Paul Boddie
On 16 Okt, 01:49, Benjamin Kaplan benjamin.kap...@case.edu wrote: Unicode is an abstract concept, and as such can't actually be written to a file. To write Unicode to a file, you have to specify an encoding so Python has actual bytes to write. If Python doesn't know what encoding it should

Re: windows side-by-side configuration woes on windows HPC

2009-10-16 Thread Nick Touran
Yes, I'll add the report to the bug ticket. As for the msvcr71.dll, the particular module I'm using was apparently compiled with VS2005, but I'm currently unable to rebuild it with VS2008 because I don't have the MSSQL developer headers, etc. So, in an ideal world, I'd compile the module myself

Re: restriction on sum: intentional bug?

2009-10-16 Thread Alan G Isaac
Alan G Isaac schrieb: I expected this to be fixed in Python 3: sum(['ab','cd'],'') Traceback (most recent call last): File stdin, line 1, inmodule TypeError: sum() can't sum strings [use ''.join(seq) instead] Of course it is not a good way to join strings, but it should work, should it

Re: Iterators

2009-10-16 Thread Aahz
In article xns9ca687fe4d6f8duncanbo...@127.0.0.1, Duncan Booth duncan.bo...@suttoncourtenay.org.uk wrote: Chris Rebert c...@rebertia.com wrote: Essentially, file iterators are dumb and don't keep track of where in the file the next line starts, instead relying on their associated file object

Re: restriction on sum: intentional bug?

2009-10-16 Thread Peter Otten
Alan G Isaac wrote: I expected this to be fixed in Python 3: sum(['ab','cd'],'') Traceback (most recent call last): File stdin, line 1, in module TypeError: sum() can't sum strings [use ''.join(seq) instead] Of course it is not a good way to join strings, but it should work, should

Re: Iterators

2009-10-16 Thread Harald Kraemer
Stephen Hansen wrote: On Fri, Oct 16, 2009 at 5:22 AM, Duncan Booth duncan.bo...@invalid.invalidwrote: Chris Rebert c...@rebertia.com wrote: Essentially, file iterators are dumb and don't keep track of where in the file the next line starts, [snip] Nothing 'dumb' or 'smart' about

Re: restriction on sum: intentional bug?

2009-10-16 Thread MRAB
Stephen Hansen wrote: On Fri, Oct 16, 2009 at 8:39 AM, Alan G Isaac alan.is...@gmail.com mailto:alan.is...@gmail.com wrote: I expected this to be fixed in Python 3: sum(['ab','cd'],'') Traceback (most recent call last): File stdin, line 1, in module

re.sub question (regular expressions)

2009-10-16 Thread Chris Seberino
What does this line do?... input_ = re.sub(([a-zA-Z]+), '\\1', input_) Does it remove parentheses from words? e.g. (foo) - foo ??? I'd like to replace [a-zA-Z] with \w but \w makes it blow up. In other words, re.sub((\w+), '\\1', input_) blows up. Why? cs --

Re: struct curiosity

2009-10-16 Thread pjcoup
Yes, this is basically what I expected as well. I would have expected some size that you can coax gcc to give, either 12 (as here), or 10 (with directives). Thanks to everyone for the responses! Pete On Oct 16, 4:30 am, Peter Otten __pete...@web.de wrote: I would have expected native size and

Re: Iterators

2009-10-16 Thread Stephen Hansen
On Fri, Oct 16, 2009 at 9:24 AM, Harald Kraemer har...@freenet.de wrote: Stephen Hansen wrote: Nothing 'dumb' or 'smart' about it: it is simply that a file object is already an iterator. Trying to create an iterator from an existing iterator in Python never duplicates the iterator. f =

Re: a splitting headache

2009-10-16 Thread Mensanator
On Oct 16, 10:30�am, John Posner jjpos...@optimum.net wrote: Mensenator said: c = '001110' c.split('0') ['', '', '1', '', '', '', '11', ''] Ok, the consecutive delimiters appear as empty strings for reasons unknown (except for the first one). Except when they start or end the

Re: re.sub question (regular expressions)

2009-10-16 Thread Jean-Michel Pichavant
Chris Seberino wrote: What does this line do?... input_ = re.sub(([a-zA-Z]+), '\\1', input_) Does it remove parentheses from words? e.g. (foo) - foo ??? I'd like to replace [a-zA-Z] with \w but \w makes it blow up. In other words, re.sub((\w+), '\\1', input_) blows up. Why? cs ( has a

Re: re.sub question (regular expressions)

2009-10-16 Thread MRAB
Chris Seberino wrote: What does this line do?... input_ = re.sub(([a-zA-Z]+), '\\1', input_) Why don't you try it? Does it remove parentheses from words? e.g. (foo) - foo ??? No, it puts quotes around them. I'd like to replace [a-zA-Z] with \w but \w makes it blow up. In other words,

SQL user function returning list for IN clause

2009-10-16 Thread Felix
I am using the Python SQLite3 interface, but the question is probably general to python and SQL. I want to run a query like select * from table a, table b where a.foo IN foobar(b.bar) where foobar is a user function (registered by create_function in pysqlite3) returning a list of integers.

Re: Yet Another Pic Problem

2009-10-16 Thread Victor Subervi
Well, I've spent the last 2 days chasing my tail just to discover that there was some screwy python deal going on. The following code works: sql = update productsX set Name='%s', Title='%s', Description='%s', Price='%s', Bedrooms='%s', Bathrooms='%s', Conditions='%s', Acreage='%s',

Re: restriction on sum: intentional bug?

2009-10-16 Thread Tim Chase
Stephen Hansen wrote: Why doesn't duck typing apply to `sum`? Because it would be so hideously slow and inefficient that it'd be way too easy a way for people to program something they think should work fine but really doesn't... alternatively, the function would have to do two /completely/

Re: restriction on sum: intentional bug?

2009-10-16 Thread Benjamin Peterson
MRAB python at mrabarnett.plus.com writes: It checks to see whether you're trying to sum strings, so it's already treating them as a special case. Why can't it just use str.join internally instead in that case instead of raising an exception? Because that violates explicit is better than

Re: restriction on sum: intentional bug?

2009-10-16 Thread Benjamin Peterson
Alan G Isaac alan.isaac at gmail.com writes: So of course join is better, as originally noted, but that does not constitute a reason to intentionally violate duck typing. As Stephen pointed out, duck typing is not an absolute. -- http://mail.python.org/mailman/listinfo/python-list

Re: SQL user function returning list for IN clause

2009-10-16 Thread Peter Otten
Felix wrote: I am using the Python SQLite3 interface, but the question is probably general to python and SQL. I want to run a query like select * from table a, table b where a.foo IN foobar(b.bar) where foobar is a user function (registered by create_function in pysqlite3) returning a

Re: SQL user function returning list for IN clause

2009-10-16 Thread Felix
Rewriting the query to say select * from table a, table b where foobar_predicate(a.foo, b.bar) would work (foobar_predicate checks if a.foo is in foobar(b.bar). But it does not allow to use an index on a.foo Define a function foobar_contains() as follows: def foobar_contains(foo, bar):

Re: The rap against while True: loops

2009-10-16 Thread Tim Rowe
2009/10/15 Steven D'Aprano st...@remove-this-cybersource.com.au: And with enough static analysis to guarantee that the break will be reached? I think it would be a bit much to expect Python to solve the halting problem! Not to what I thought was being proposed -- it seemed to make the break

Re: set using alternative hash function?

2009-10-16 Thread Ethan Furman
Austin Bingham wrote: On Thu, Oct 15, 2009 at 7:49 PM, Ethan Furman et...@stoneleaf.us wrote: Austin Bingham wrote: I'm feeling really dense about now... What am I missing? What you're missing is the entire discussion up to this point. I was looking for a way to use an alternative

Re: SQL user function returning list for IN clause

2009-10-16 Thread Peter Otten
Felix wrote: Define a function foobar_contains() as follows: def foobar_contains(foo, bar): return foo in foobar(bar) and change the query to select * from table a, table b where foobar_contains(a.foo, b.bar) I thought about that (see above), but it would not use an index on a.foo

Re: The rap against while True: loops

2009-10-16 Thread Tim Rowe
2009/10/15 Steven D'Aprano st...@remove-this-cybersource.com.au: Setting up a try...except block is cheap in Python. According to my tests, the overhead is little more than that of a single pass statement. But actually raising and catching the exception is not cheap. If you use a lot of

Re: restriction on sum: intentional bug?

2009-10-16 Thread Stephen Hansen
On Fri, Oct 16, 2009 at 9:59 AM, Tim Chase python.l...@tim.thechases.comwrote: Stephen Hansen wrote: Why doesn't duck typing apply to `sum`? Because it would be so hideously slow and inefficient that it'd be way too easy a way for people to program something they think should work fine but

Re: restriction on sum: intentional bug?

2009-10-16 Thread Jon Clements
On Oct 16, 5:59 pm, Tim Chase python.l...@tim.thechases.com wrote: Stephen Hansen wrote: Why doesn't duck typing apply to `sum`? Because it would be so hideously slow and inefficient that it'd be way too easy a way for people to program something they think should work fine but really

Re: set using alternative hash function?

2009-10-16 Thread Anthony Tolle
On Oct 16, 12:24 pm, Ethan Furman et...@stoneleaf.us wrote: [snip] As for what you want:  No, it's not currently possible.  If it's so big a deal that the various methods presented don't meet with your approval, break out the C and write your own.  Then you could give that back to the

Re: restriction on sum: intentional bug?

2009-10-16 Thread Ethan Furman
Jon Clements wrote: On Oct 16, 5:59 pm, Tim Chase python.l...@tim.thechases.com wrote: Stephen Hansen wrote: Why doesn't duck typing apply to `sum`? Because it would be so hideously slow and inefficient that it'd be way too easy a way for people to program something they think should work

cx_freeze install_exe error

2009-10-16 Thread james27
hello im currently installed cx_freeze on linux. and want to make win32 exe file on linux by use cx_freeze. and then will distribute on widows platform. one of my problem is ,i can build with no problem. but whenever i run,it something weird error message was show. follow is my log file. anybody

putchar(8)

2009-10-16 Thread gervaz
Hi all, is there a pythonic way to have the -- http://mail.python.org/mailman/listinfo/python-list

putchar(8)

2009-10-16 Thread gervaz
Hi all, is there in python the equivalent of the C function int putchar (int c)? I need to print putchar(8). Thanks, Mattia -- http://mail.python.org/mailman/listinfo/python-list

Re: The rap against while True: loops

2009-10-16 Thread Aahz
In article mailman.1540.1255714251.2807.python-l...@python.org, Tim Rowe digi...@gmail.com wrote: The understood meaning of throwing an exception is to say something happened that shouldn't have. If one uses it when something has happened that *should* have, because it happens to have the right

Re: putchar(8)

2009-10-16 Thread Jason Tackaberry
On Fri, 2009-10-16 at 12:01 -0700, gervaz wrote: Hi all, is there in python the equivalent of the C function int putchar (int c)? I need to print putchar(8). print '\x08' or: print chr(8) -- http://mail.python.org/mailman/listinfo/python-list

More More Fun w/ Pics MySQL

2009-10-16 Thread Victor Subervi
Hi; Okay, here's the code: #! /usr/bin/python import cgitb; cgitb.enable() import MySQLdb import cgi import sys,os sys.path.append(os.getcwd()) from login import login def pic(): user, passwd, db, host = login() form = cgi.FieldStorage() db = MySQLdb.connect(host, user, passwd, db)

Rename file if it exists.

2009-10-16 Thread Stephen Reese
The script below uploads files to a web server. Currently it overwrites a file if it already exists. I'm instead trying to rename the old file with an appended date/timestamp before the new file is uploaded. I *think* I have the idea down but it's not be implemented in the script correctly. Any

Re: An assessment of Tkinter and IDLE

2009-10-16 Thread Aahz
In article 87ljjhq7y7@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: TerryP bigboss1...@gmail.com writes: One thing you should also learn about me, is I do not deal in absolutes. What, *never*? Well, hardly ever. -- Aahz (a...@pythoncraft.com) *

Re: restriction on sum: intentional bug?

2009-10-16 Thread Tim Chase
Stephen Hansen wrote: There really is just a right way verses a wrong way to join strings together; using + is always the wrong way. Sometimes that level of 'wrong' is so tiny that no one cares, like if you are using it to join together two small strings. But when joining together a sequence of

Re: The rap against while True: loops

2009-10-16 Thread Bearophile
Paul Rubin:  http://scholar.google.com/scholar?cluster=17368311454828547380 Keep in mind that the article is 35 years old though, and is purely imperative.  Lots of stuff done with cockamamie looping constructs is more cleanly done with Python generators, itertools, higher-order functions,

Spawning Cmd Window via Subprocess

2009-10-16 Thread D
Hello, I would like to be able to spawn a new CMD window (specifing size, color and placement of the window), and write to it separately. Specifically, I have a backup program that displays each file backed up in the main window, and I would like to spawn and continually update a second CMD

Re: restriction on sum: intentional bug?

2009-10-16 Thread Alan G Isaac
On 10/16/2009 3:40 PM, Tim Chase wrote: What's always wrong is giving me an *error* when the semantics are perfectly valid. Exactly. Which is why I expected this to be fixed in Python 3. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: id( ) function question

2009-10-16 Thread Erik Max Francis
Mel wrote: True, I don't see that exact expression going wrong. The actual poster, trimmed for that post, used to go: def broadcast (self, message): for p in players: if p is not self: p.send (message) This use of `is` is fine. For my fears to come

Re: Rename file if it exists.

2009-10-16 Thread Diez B. Roggisch
Stephen Reese schrieb: The script below uploads files to a web server. Currently it overwrites a file if it already exists. I'm instead trying to rename the old file with an appended date/timestamp before the new file is uploaded. I *think* I have the idea down but it's not be implemented in the

Re: how to write a unicode string to a file ?

2009-10-16 Thread Stephen Fairchild
Stef Mientki wrote: hello, By writing the following unicode string (I hope it can be send on this mailing list) Bücken to a file fh.write ( line ) I get the following error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 9: ordinal not

Re: More More Fun w/ Pics MySQL

2009-10-16 Thread Carsten Haese
Victor Subervi wrote: [snip...] print 'Content-type: image/jpeg' print 'Content-Encoding: base64' print print pic().encode('base64') print '/body/html' [snip...] Why are you printing /body/html at the end of a page that is supposed to be a base64-encoded JPEG file? -- Carsten Haese

Re: restriction on sum: intentional bug?

2009-10-16 Thread Christian Heimes
Alan G Isaac schrieb: On 10/16/2009 3:40 PM, Tim Chase wrote: What's always wrong is giving me an *error* when the semantics are perfectly valid. Exactly. Which is why I expected this to be fixed in Python 3. It's not going to happen. Christian --

Re: Tracking down DLL load errors in Windows ?

2009-10-16 Thread Fred Pacquier
Christian Heimes li...@cheimes.de said : Fred P wrote: Is there any tool and/or methodology I could use to at least pinpoint the exact DLL that libpyexiv2 is failing to load, and ideally also the reason why ?... The depencency walker http://www.dependencywalker.com/ works fine for me.

print()

2009-10-16 Thread mattia
Is there a way to print to an unbuffered output (like stdout)? I've seen that something like sys.stdout.write(hello) works but it also prints the number of characters! -- http://mail.python.org/mailman/listinfo/python-list

Re: Rename file if it exists.

2009-10-16 Thread Stephen Reese
This isn't working because the else: is dangling. And I think your logic is flawed (I might be wrong of course) because you rename the *existing* file instead of giving the new one a new data. Thus e.g. a link to the file (if it's a webserver) will suddenly deliver a different file. I doubt

Re: print()

2009-10-16 Thread Chris Rebert
On Fri, Oct 16, 2009 at 2:04 PM, mattia ger...@gmail.com wrote: Is there a way to print to an unbuffered output (like stdout)? Just follow your prints or stdout.write()s with calls to stdout.flush() to flush the buffer. You could alternatively use the -u option to the python interpreter to make

Re: The rap against while True: loops

2009-10-16 Thread Russ P.
On Oct 10, 1:15 pm, kj no.em...@please.post wrote: I'm coaching a group of biologists on basic Python scripting.  One of my charges mentioned that he had come across the advice never to use loops beginning with while True.  Of course, that's one way to start an infinite loop, but this seems

Re: Spawning Cmd Window via Subprocess

2009-10-16 Thread TerryP
On Oct 16, 8:15 pm, D dmcclo...@gmail.com wrote: Hello, I would like to be able to spawn a new CMD window (specifing size, color and placement of the window),  and write to it separately. Specifically, I have a backup program that displays each file backed up in the main window, and I would

Re: How about adding slice notation to iterators/generators?

2009-10-16 Thread Eloff
On Oct 16, 3:54 am, Terry Reedy tjre...@udel.edu wrote: There is already an obvious standard way to do this. it = whatever next(it) #toss first item for item in it:   That fails if there is no first item. You're taking one corner case and saying there's an easy way to do it, which is

Re: print()

2009-10-16 Thread TerryP
On Oct 16, 9:04 pm, mattia ger...@gmail.com wrote: Is there a way to print to an unbuffered output (like stdout)? I've seen that something like sys.stdout.write(hello) works but it also prints the number of characters! http://docs.python.org/3.1/library/functions.html#print a suitable object

Re: More More Fun w/ Pics MySQL

2009-10-16 Thread Victor Subervi
I was trying all sorts of crap. I tried it without, too. Still didn't work :( V On Fri, Oct 16, 2009 at 4:42 PM, Carsten Haese carsten.ha...@gmail.comwrote: Victor Subervi wrote: [snip...] print 'Content-type: image/jpeg' print 'Content-Encoding: base64' print print

Re: restriction on sum: intentional bug?

2009-10-16 Thread Alan G Isaac
On 10/16/2009 5:03 PM, Christian Heimes wrote: It's not going to happen. That's a prediction, not a justification. As Tim explained in detail, and as Peter explained with brevity, whether it will happen or not, it should happen. This conversation has confirmed that current behavior is a

Re: restriction on sum: intentional bug?

2009-10-16 Thread ryles
On Oct 16, 11:39 am, Alan G Isaac alan.is...@gmail.com wrote: I expected this to be fixed in Python 3: sum(['ab','cd'],'') Traceback (most recent call last):    File stdin, line 1, in module TypeError: sum() can't sum strings [use ''.join(seq) instead] Then you probably haven't read

Re: restriction on sum: intentional bug?

2009-10-16 Thread Carl Banks
On Oct 16, 9:59 am, Tim Chase python.l...@tim.thechases.com wrote: So I agree with Alan Peter that this creates an unfortunate language wart among (as Peter aptly puts it) consenting adults. Perhaps, BUT... If, say, you were to accept that Python is going to guard against a small number of

One class one file?

2009-10-16 Thread Someone Something
I'm trying write a program that's going to be more than 100 lines or so but I need it all in one class. Is there a painless way to have one class in two files? -- http://mail.python.org/mailman/listinfo/python-list

ftplib connection fails with multiple nics

2009-10-16 Thread Sean DiZazzo
Hi all, I'm trying to connect to an ftp site from a windows machine with two nics going to two different networks, but I keep getting the below exception: Traceback (most recent call last): File ftp.pyo, line 70, in connect File ftp.pyo, line 17, in __init__ File ftplib.pyo, line 131, in

Re: restriction on sum: intentional bug?

2009-10-16 Thread Carl Banks
On Oct 16, 12:40 pm, Tim Chase python.l...@tim.thechases.com wrote: Then I'm fine with sum() being smart enough to recognize this horrid case and do the right thing by returning ''.join() instead. You don't want Python to get into this business. Trust me. Just don't go there. If you want

Re: More More Fun w/ Pics MySQL

2009-10-16 Thread Carsten Haese
Victor Subervi wrote: I was trying all sorts of crap. I tried it without, too. Still didn't work :( Please help us help you. Still didn't work tells us nothing. See http://catb.org/~esr/faqs/smart-questions.html for hints on how you can ask a questions in a way that makes them more likely to

Re: restriction on sum: intentional bug?

2009-10-16 Thread Carl Banks
On Oct 16, 8:39 am, Alan G Isaac alan.is...@gmail.com wrote: I expected this to be fixed in Python 3: A word of advice: the Python maintainers don't regard anything that behaves as it is documented to as a bug, no matter how wrong it seems. This is taken a lot more seriously than you would

Re: One class one file?

2009-10-16 Thread MRAB
Someone Something wrote: I'm trying write a program that's going to be more than 100 lines or so but I need it all in one class. Is there a painless way to have one class in two files? Python won't complain if you have more than 100 lines in one file, or even in one class in one file. There

Re: how to write a unicode string to a file ?

2009-10-16 Thread Stef Mientki
Stephen Hansen wrote: On Thu, Oct 15, 2009 at 4:43 PM, Stef Mientki stef.mien...@gmail.com mailto:stef.mien...@gmail.com wrote: hello, By writing the following unicode string (I hope it can be send on this mailing list) Bücken to a file fh.write ( line ) I

Re: restriction on sum: intentional bug?

2009-10-16 Thread Terry Reedy
Alan G Isaac wrote: As Tim explained in detail, and as Peter explained with brevity, whether it will happen or not, it should happen. This conversation has confirmed that current behavior is a wart: an error is raised despite correct semantics. Ugly! The fact that two or three people who

Re: More More Fun w/ Pics MySQL

2009-10-16 Thread Victor Subervi
I'm sorry. These scripts worked fine before and should have been plug-and-play. I have wasted 2 frustrating weeks trying to figure out why they don't work only to discover things that make no sense at all that do the trick. I thought programming was straight-forward and logical...boy, am I

sqlite question

2009-10-16 Thread koranthala
Hi, I use sqlalchemy to use a sqlite db in my program. The program is working perfectly as of now. But now, a new requirement has come that the db has to be encrypted. I found two options while searching internet - SQLite Encryption Extension and Sqlite-Crypt. Now, buying the license is not

Re: How about adding slice notation to iterators/generators?

2009-10-16 Thread Carl Banks
On Oct 16, 2:02 am, Bearophile bearophileh...@lycos.com wrote: Terry Reedy: 1. islice works with any iterator; generator method would only work with generators A slice syntax that's syntactic sugar for islice(some_iter,1,None) may be added to all iterators. All custom iterators would

Re: How about adding slice notation to iterators/generators?

2009-10-16 Thread ryles
On Oct 16, 5:28 pm, Eloff dan.el...@gmail.com wrote: By giving iterators a default, overridable, __getitem__ that is just syntactic sugar for islice, they would share a slightly larger interface subset with the builtin container types. In a duck-typed language like python, that's almost

Re: How about adding slice notation to iterators/generators?

2009-10-16 Thread Carl Banks
On Oct 16, 2:28 pm, Eloff dan.el...@gmail.com wrote: As long as it breaks no rationally existing code, I can think of no good reason why not to do this in a future python. You would burden everyone who writes a custom iterator to provide a __getitem__ method just because you're too lazy to type

Re: how to write a unicode string to a file ?

2009-10-16 Thread Stephen Hansen
On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki stef.mien...@gmail.comwrote: Unfortunately, there is no simple answer to these questions. Thanks guys, I didn't know the codecs module, and the codecs seems to be a good solution, at least it can safely write a file. But now I have to open that

Re: More More Fun w/ Pics MySQL

2009-10-16 Thread Carsten Haese
Victor Subervi wrote: I'm sorry. These scripts worked fine before and should have been plug-and-play. I have wasted 2 frustrating weeks trying to figure out why they don't work only to discover things that make no sense at all that do the trick. I thought programming was straight-forward and

Re: set using alternative hash function?

2009-10-16 Thread Carl Banks
On Oct 15, 9:31 pm, Austin Bingham austin.bing...@gmail.com wrote: Yes, what you've got there provides the interface of what I want. And no doubt we could concoct countless ways to implement some version of this. However, if set itself accepted an alternate hash function, then I could do it

Re: how to write a unicode string to a file ?

2009-10-16 Thread Kee Nethery
On Oct 16, 2009, at 5:49 PM, Stephen Hansen wrote: On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki stef.mien...@gmail.com wrote: snip The thing is, I'd be VERY surprised (neigh, shocked!) if Excel can't open a file that is in UTF8-- it just might need to be TOLD that its utf8 when you go

Re: a splitting headache

2009-10-16 Thread Thomas
On Oct 15, 9:18 pm, Mensanator mensana...@aol.com wrote: All I wanted to do is split a binary number into two lists, a list of blocks of consecutive ones and another list of blocks of consecutive zeroes. But no, you can't do that. c = '001110' c.split('0') ['', '', '1', '', '', '',

Re: restriction on sum: intentional bug?

2009-10-16 Thread Jon Clements
On Oct 17, 1:16 am, Terry Reedy tjre...@udel.edu wrote: Alan G Isaac wrote: As Tim explained in detail, and as Peter explained with brevity, whether it will happen or not, it should happen.  This conversation has confirmed that current behavior is a wart: an error is raised despite

Re: how to write a unicode string to a file ?

2009-10-16 Thread Stephen Hansen
On Fri, Oct 16, 2009 at 6:02 PM, Kee Nethery k...@kagi.com wrote: On Oct 16, 2009, at 5:49 PM, Stephen Hansen wrote: On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki stef.mien...@gmail.com wrote: snip The thing is, I'd be VERY surprised (neigh, shocked!) if Excel can't open a file that is

Re: Rename file if it exists.

2009-10-16 Thread Stephen Reese
This isn't working because the else: is dangling. And I think your logic is flawed (I might be wrong of course) because you rename the *existing* file instead of giving the new one a new data. Thus e.g. a link to the file (if it's a webserver) will suddenly deliver a different file. I doubt

Re: a splitting headache

2009-10-16 Thread Carl Banks
On Oct 15, 6:57 pm, Ishwor Gurung ishwor.gur...@gmail.com wrote: Too bad groupby is only available in Python2.6+ Since you're here, any chance of getting your NDK team to look into getting some small subset of STL, Boost into Android? Aren't Java collections bad enough? :) Carl Banks --

  1   2   >