Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread Peter Otten
dmtr wrote: >> > Well... 63 bytes per item for very short unicode strings... Is there >> > any way to do better than that? Perhaps some compact unicode objects? >> >> There is a certain price you pay for having full-feature Python objects. > > Are there any *compact* Python objects? Optimized fo

Re: Perl -> Python unpack

2010-08-06 Thread James Mills
On Sat, Aug 7, 2010 at 4:30 AM, James Mills wrote: > What does a* or A* translate to in Python when unpacking > binary data with struct.unpack(...) ? Fine I"ll answer my own question. Python _does not_ support implicit size in struct formatting rules. sizes are explicit meaning that you must "co

Re: Is there any way to minimize str()/unicode() objects memory usage ?[Python 2.6.4] ?

2010-08-06 Thread garabik-news-2005-05
dmtr wrote: > > What I'm really looking for is a dict() that maps short unicode > strings into tuples with integers. But just having a *compact* list > container for unicode strings would help a lot (because I could add a > __dict__ and go from it). > At this point, I'd suggest to use one of th

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread dmtr
On Aug 6, 10:56 pm, Michael Torrie wrote: > On 08/06/2010 07:56 PM, dmtr wrote: > > > Ultimately a dict that can store ~20,000,000 entries: (u'short > > string' : (int, int, int, int, int, int, int)). > > I think you really need a real database engine.  With the proper > indexes, MySQL could be ve

Re: new to python - trouble calling a function from another function

2010-08-06 Thread Michael Torrie
On 08/05/2010 01:25 AM, Brandon McCombs wrote: > How can that be? I don't get any errors when the script > executes. Surely this isn't some limitation I'm encountering? > > > yield (p.destination - self.currenteFloor) * TRAVELTIME, self ^ To be succinct, goUp(

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread Michael Torrie
On 08/06/2010 07:56 PM, dmtr wrote: > Ultimately a dict that can store ~20,000,000 entries: (u'short > string' : (int, int, int, int, int, int, int)). I think you really need a real database engine. With the proper indexes, MySQL could be very fast storing and retrieving this information for you.

Re: Python "why" questions

2010-08-06 Thread Chris Rebert
On Fri, Aug 6, 2010 at 8:05 PM, Default User wrote: > >From "the emperor's new clothes" department: > > 1)  Why do Python lists start with element [0], instead of element [1]? > "Common sense" would seem to suggest that lists should start with [1]. (In addition to the other good answers already g

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread Carl Banks
On Aug 6, 6:56 pm, dmtr wrote: > > > Well...  63 bytes per item for very short unicode strings... Is there > > > any way to do better than that? Perhaps some compact unicode objects? > > > There is a certain price you pay for having full-feature Python objects. > > Are there any *compact* Python o

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Ben Finney
Steven D'Aprano writes: > On Thu, 05 Aug 2010 12:07:53 -0400, wheres pythonmonks wrote: > > > P.S. Sorry for the top-post -- is there a way to not do top posts > > from gmail? I haven't used usenet since tin. > > Er, surely you can just move the cursor before you start typing??? I like to think

Re: Python "why" questions

2010-08-06 Thread Vito 'ZeD' De Tullio
Default User wrote: >>From "the emperor's new clothes" department: > > 1) Why do Python lists start with element [0], instead of element [1]? > "Common sense" would seem to suggest that lists should start with [1]. http://userweb.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html > 2)

sched() function questions

2010-08-06 Thread Chris Hare
I am currently using threading.timer to execute an event in my big chunk of code. This is causing a problem with sqlite, so I am trying to figure out the sched function import sched import time def timerfunc(): print "hello", time.time() return(time.time()) def delay(period): time

Re: Python "why" questions

2010-08-06 Thread Ryan Kelly
On Fri, 2010-08-06 at 22:05 -0500, Default User wrote: > >From "the emperor's new clothes" department: > > 1) Why do Python lists start with element [0], instead of element > [1]? "Common sense" would seem to suggest that lists should start > with [1]. "Common sense" is wrong. There are many

Python "why" questions

2010-08-06 Thread Default User
>From "the emperor's new clothes" department: 1) Why do Python lists start with element [0], instead of element [1]? "Common sense" would seem to suggest that lists should start with [1]. 2) In Python 3, why is print a function only, so that: print "Hello, World" is not okay, but it must be pri

Re: python interview quuestions

2010-08-06 Thread Tim Chase
On 08/06/10 15:37, James Mills wrote: On Sat, Aug 7, 2010 at 6:28 AM, geremy condra wrote: If I had to wait 5 minutes while a candidate tried to solve this problem I would not hire them. Yes you do raise a valid point. It should really only take you a mere few seconds or so to write a solutio

Re: python interview quuestions

2010-08-06 Thread geremy condra
On Fri, Aug 6, 2010 at 6:25 PM, Steven D'Aprano wrote: > On Sat, 07 Aug 2010 06:37:05 +1000, James Mills wrote: > >> On Sat, Aug 7, 2010 at 6:28 AM, geremy condra >> wrote: >>> If I had to wait 5 minutes while a candidate tried to solve this >>> problem I would not hire them. >> >> Yes you do rai

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread Neil Hodgson
dmtr: > What I'm really looking for is a dict() that maps short unicode > strings into tuples with integers. But just having a *compact* list > container for unicode strings would help a lot (because I could add a > __dict__ and go from it). Add them all into one string or array and use indexe

Re: [Tutor] Finding the version # of a module, and py module problem

2010-08-06 Thread Philip Semanchuk
On Aug 6, 2010, at 3:14 PM, W. eWatson wrote: I must be missing something. I tried this. (Windows, IDLE, Python 2.5) Yes, as Benjamin Kaplan pointed out and as I said in the email where I posted this code snippet, "dependencies is a list of custom classes that represent modules we need (e

Re: Why is python not written in C++ ?

2010-08-06 Thread Lawrence D'Oliveiro
In message , David Cournapeau wrote: > I have yet seen a project where you could build C code with a C++ > compiler - the only ones I know are specifically designed that way and > it is painful. I seem to recall a FAQ entry, might have been on kernelnewbies.org, asking why the Linux kernel wasn

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread Christian Heimes
> I'm running into some performance / memory bottlenecks on large lists. > Is there any easy way to minimize/optimize memory usage? > > Simple str() and unicode objects() [Python 2.6.4/Linux/x86]: sys.getsizeof('') 24 bytes sys.getsizeof('0')25 bytes sys.getsizeof(u'')2

Re: python interview quuestions

2010-08-06 Thread Roy Smith
Steven D'Aprano wrote: > Personally, I'd rather see how a potential hire *tests* his code than how > he writes it. Writing code is easy. Testing code is harder. Testing it > properly is harder still -- it's amazing how many people forget that it's > not just necessary to test the function on d

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread Chris Rebert
On Fri, Aug 6, 2010 at 6:39 PM, dmtr wrote: >> > Well...  63 bytes per item for very short unicode strings... Is there >> > any way to do better than that? Perhaps some compact unicode objects? >> >> If you think that unicode objects are going to be *smaller* than byte >> strings, I think you're

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread dmtr
> > Well...  63 bytes per item for very short unicode strings... Is there > > any way to do better than that? Perhaps some compact unicode objects? > > There is a certain price you pay for having full-feature Python objects. Are there any *compact* Python objects? Optimized for compactness? > Wha

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread dmtr
Steven, thank you for answering. See my comments inline. Perhaps I should have formulated my question a bit differently: Are there any *compact* high performance containers for unicode()/str() objects in Python? By *compact* I don't mean compression. Just optimized for memory usage, rather than per

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Gregory Ewing
Steven D'Aprano wrote: Generally, when testing for None, you actually want None and not some look-alike that merely tests equal to None. That's true, although I can't think of a use case for an object that compares equal to None but isn't -- except for obfuscated code competition entries and m

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Gregory Ewing
Ethan Furman wrote: Instead of using 'is' use '=='. Maybe not as cute, but definitely more robust! It's also just as efficient if you use strings that resemble identifiers, because they will be interned, so the comparison will end up just doing an indentity test anyway. -- Greg -- http://mai

Re: python interview quuestions

2010-08-06 Thread Steven D'Aprano
On Sat, 07 Aug 2010 06:37:05 +1000, James Mills wrote: > On Sat, Aug 7, 2010 at 6:28 AM, geremy condra > wrote: >> If I had to wait 5 minutes while a candidate tried to solve this >> problem I would not hire them. > > Yes you do raise a valid point. It should really only take you a mere > few se

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread Thomas Jollans
On 08/07/2010 02:45 AM, dmtr wrote: > I'm running into some performance / memory bottlenecks on large lists. > Is there any easy way to minimize/optimize memory usage? > > Simple str() and unicode objects() [Python 2.6.4/Linux/x86]: sys.getsizeof('') 24 bytes sys.getsizeof('0')2

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread Steven D'Aprano
On Fri, 06 Aug 2010 17:45:31 -0700, dmtr wrote: > I'm running into some performance / memory bottlenecks on large lists. > Is there any easy way to minimize/optimize memory usage? Yes, lots of ways. For example, do you *need* large lists? Often a better design is to use generators and iterators

Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-06 Thread dmtr
I'm running into some performance / memory bottlenecks on large lists. Is there any easy way to minimize/optimize memory usage? Simple str() and unicode objects() [Python 2.6.4/Linux/x86]: >>> sys.getsizeof('') 24 bytes >>> sys.getsizeof('0')25 bytes >>> sys.getsizeof(u'')28 bytes >>>

Microsoft lessening commitment to IronPython and IronRuby

2010-08-06 Thread Neil Hodgson
There is a blog post from Jimmy Schementi who previously worked at Microsoft on IronRuby about the state of dynamic language work there. http://blog.jimmy.schementi.com/2010/08/start-spreading-news-future-of-jimmy.html Neil -- http://mail.python.org/mailman/listinfo/python-list

How to implement a pipeline...??? Please help

2010-08-06 Thread Ritchy lelis
Hi guys In the development of my ADC project i have a new new challenge. First i need to implement a 10 Bit pipelineADC that will be the basis to later implement any kind of pipeline arquitecture (i mean, with 10 Bit, 16 Bit or any other configuration i want) i wish to... What's a 10 Bit pipil

Re: default behavior

2010-08-06 Thread John Posner
On 8/6/2010 6:24 PM, Wolfram Hinderer wrote: This is probably nitpicking, but the patch calls __missing__ a special method. However, unlike special methods, it is not invoked by "special syntax" but by the dict's __getitem__ method. (len() invokes __len__ on any object - you can't do something s

Re: Python Portability--Not very portable?

2010-08-06 Thread Steven D'Aprano
On Fri, 06 Aug 2010 10:58:24 -0700, W. eWatson wrote: > Is there a complete illustration of using disutils? Our only > dependencies are on Python Org material. We use no commercial or > licensed code. Oh my, the sheer ignorance that sentence reveals. Python and the standard library *is* licensed

Re: Python Portability--Not very portable?

2010-08-06 Thread Steven D'Aprano
On Thu, 05 Aug 2010 18:50:14 -0700, W. eWatson wrote: > As an example, my inexperienced Python partner 30 miles away has gotten > out of step somehow. I think by installing a different version of numpy > than I use. I gave him a program we both use months ago, and he had no > trouble. (We both use

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Steven D'Aprano
On Fri, 06 Aug 2010 11:42:39 +0200, Jean-Michel Pichavant wrote: > Steven D'Aprano wrote: >> On Thu, 05 Aug 2010 12:07:53 -0400, wheres pythonmonks wrote: >> >>> P.S. Sorry for the top-post -- is there a way to not do top posts from >>> gmail? I haven't used usenet since tin. >>> >> Er, sure

Re: Python Portability--Not very portable?

2010-08-06 Thread Steven D'Aprano
On Fri, 06 Aug 2010 10:35:38 -0700, W. eWatson wrote: > So you think Python is part of open software in terms of distributing a > "product"? Python itself *is* open source software. It doesn't *require* you to write open source software. > So I should stick to C, where one can distribute progra

Re: Unicode error

2010-08-06 Thread Steven D'Aprano
On Fri, 06 Aug 2010 11:23:50 +, kj wrote: > I don't get your point. Even when I *know* that a certain exception may > happen, I don't necessarily catch it. I catch only those exceptions for > which I can think of a suitable response that is *different* from just > letting the program fail.

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Steven D'Aprano
On Fri, 06 Aug 2010 15:37:04 +0200, Stefan Schwarzer wrote: >> Plus, I believe the >> "==" operator will check if the variables point to the same object. > > No, that's what `is` is for. Actually, yes, equality is implemented with a short-cut that checks for identity first. That makes something

Re: Python Portability--Not very portable?

2010-08-06 Thread Steven D'Aprano
On Fri, 06 Aug 2010 08:00:55 -0700, W. eWatson wrote: >>> I would think there are some small time and big time Python players >>> who sell executable versions of their programs for profit? >> >> Yes. What's your point? > That someone must know how to distribute them without having the source > cod

Re: default behavior

2010-08-06 Thread Wolfram Hinderer
On 6 Aug., 22:07, John Posner wrote: > On 8/2/2010 11:00 PM, John Posner wrote: > > > On 7/31/2010 1:31 PM, John Posner wrote: > > >> Caveat -- there's another description of defaultdict here: > > >>http://docs.python.org/library/collections.html#collections.defaultdict > > >> ... and it's bogus.

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Steven D'Aprano
On Fri, 06 Aug 2010 05:28:40 -0700, DG wrote: > I've always thought of it as you don't compare strings with "is", you > *should* use == The reasoning is that you don't know if that string > instance is the only one in memory. This is excellent advice. I won't say that there is "never" a use-case

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Steven D'Aprano
On Fri, 06 Aug 2010 17:20:30 +, Peter Pearson wrote: > On Fri, 06 Aug 2010 15:37:04 +0200, Stefan Schwarzer wrote: [snip] >> I can imagine a case where you might want to compare a string with >> `is`: >> >> FORWARD = "forward" >> BACKWARD = "backward" [...] >> Actually, I've never seen

Re: new to python - trouble calling a function from another function

2010-08-06 Thread geremy condra
On Thu, Aug 5, 2010 at 8:15 AM, Brandon McCombs wrote: > Jon Clements wrote: >> >> On 5 Aug, 08:25, Brandon McCombs wrote: >>> >>> Hello, >>> >>> I'm building an elevator simulator for a class assignment. I recently >>> ran into a roadblock and don't know how to fix it. For some reason, in >>> my

HL7 v3 (XML) importer

2010-08-06 Thread Luke Kenneth Casson Leighton
an HL7 v2 importer was written by john paulett, and it has been enhanced to support some of the HL7 v3 standard, which is XML-based. no dependencies are required: xml.sax is used so as to reduce the dependencies to purely python. additionally, as HL7 has versions/revisions, published data specific

Re: new to python - trouble calling a function from another function

2010-08-06 Thread Jon Clements
On 5 Aug, 16:15, Brandon McCombs wrote: > Jon Clements wrote: > > On 5 Aug, 08:25, Brandon McCombs wrote: > >> Hello, > > >> I'm building an elevator simulator for a class assignment. I recently > >> ran into a roadblock and don't know how to fix it. For some reason, in > >> my checkQueue functio

Re: python interview quuestions

2010-08-06 Thread James Mills
On Sat, Aug 7, 2010 at 6:28 AM, geremy condra wrote: > If I had to wait 5 minutes while a candidate tried to solve this > problem I would not hire them. Yes you do raise a valid point. It should really only take you a mere few seconds or so to write a solution to this. More over, it can be done

Re: python interview quuestions

2010-08-06 Thread geremy condra
On Fri, Aug 6, 2010 at 11:45 AM, James Mills wrote: > On Sat, Aug 7, 2010 at 4:32 AM, Tim Chase > wrote: >>> I would like to aquint myself with Python Interview questions >> >> This came up a while ago: >> >> http://www.mail-archive.com/python-list@python.org/msg168961.html >> >> Most of that th

Re: ctypes: pointer to method

2010-08-06 Thread Martin Landa
Hi, On Aug 6, 10:10 pm, Martin Landa wrote: > Any idea how to solve it. Thanks, Martin I overlooked note """ Make sure you keep references to CFUNCTYPE objects as long as they are used from C code. ctypes doesn’t, and if you don’t, they may be garbage collected, crashing your program when a ca

Re: ctypes: pointer to method

2010-08-06 Thread Martin Landa
Hi, On Aug 5, 9:32 pm, Nobody wrote: > I don't know about methods, but it works for functions. > > > Sample code: > > >     ... > >     G_set_error_routine(byref(self._print_error)) > > This won't work; you have to be more explicit, e.g.: > >         errtype = CFUNCTYPE(c_int, POINTER(c_char), PO

Re: default behavior

2010-08-06 Thread John Posner
On 8/2/2010 11:00 PM, John Posner wrote: On 7/31/2010 1:31 PM, John Posner wrote: Caveat -- there's another description of defaultdict here: http://docs.python.org/library/collections.html#collections.defaultdict ... and it's bogus. This other description claims that __missing__ is a method o

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Ethan Furman
Stefan Schwarzer wrote: Hello Peter, On 2010-08-06 19:20, Peter Pearson wrote: On Fri, 06 Aug 2010 15:37:04 +0200, Stefan Schwarzer wrote: [snip] I can imagine a case where you might want to compare a string with `is`: FORWARD = "forward" BACKWARD = "backward" ... def func(d

Re: [Tutor] Finding the version # of a module, and py module problem

2010-08-06 Thread Tommy Grav
On Aug 6, 2010, at 3:14 PM, W. eWatson wrote: > I must be missing something. I tried this. (Windows, IDLE, Python 2.5) > # Try each module > import sys > import numpy > import scipy > import string > > dependencies = "numyp", "scipy" > for dependency in dependencies: >try: >__import_

Re: Easy questions from a python beginner

2010-08-06 Thread Albert van der Horst
In article <4c495b50$0$28634$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: >On Thu, 22 Jul 2010 21:23:05 -0700, Stephen Hansen wrote: > >> On 7/22/10 7:47 PM, wheres pythonmonks wrote: >[...] >>> The truth is that I don't intend to use these approaches in anything >>> serious. However, I've

Re: [Tutor] Finding the version # of a module, and py module problem

2010-08-06 Thread Benjamin Kaplan
On Fri, Aug 6, 2010 at 12:14 PM, W. eWatson wrote: > I must be missing something. I tried this. (Windows, IDLE, Python 2.5) > # Try each module > import sys > import numpy > import scipy > import string > > dependencies = "numyp", "scipy" > for dependency in dependencies: >    try: >        __impo

Re: [Tutor] Finding the version # of a module, and py module problem

2010-08-06 Thread W. eWatson
I must be missing something. I tried this. (Windows, IDLE, Python 2.5) # Try each module import sys import numpy import scipy import string dependencies = "numyp", "scipy" for dependency in dependencies: try: __import__(dependency.name) except ImportError: # Uh oh!

Re: python interview quuestions

2010-08-06 Thread James Mills
On Sat, Aug 7, 2010 at 5:11 AM, Tim Chase wrote: > Another common thing you can do on a newsgroup is mention the "FizzBuzz" > problem.  Any good competent newsgroup will produce a multitude of proposed > solutions, the majority of which will be wrong. ;-) That's actually a very good point! Someon

Re: python interview quuestions

2010-08-06 Thread Tim Chase
On 08/06/10 13:45, James Mills wrote: On Sat, Aug 7, 2010 at 4:32 AM, Tim Chase wrote: I would like to aquint myself with Python Interview questions This came up a while ago: http://www.mail-archive.com/python-list@python.org/msg168961.html Most of that thread is still relevant (perhaps thr

Re: Python Portability--Not very portable?

2010-08-06 Thread geremy condra
On Fri, Aug 6, 2010 at 10:58 AM, W. eWatson wrote: > Is there a complete illustration of using disutils? Our only dependencies > are on Python Org material. We use no commercial or licensed code. http://tinyurl.com/3yhwjfj Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list

Re: python interview quuestions

2010-08-06 Thread James Mills
On Sat, Aug 7, 2010 at 4:32 AM, Tim Chase wrote: >> I would like to aquint myself with Python Interview questions > > This came up a while ago: > > http://www.mail-archive.com/python-list@python.org/msg168961.html > > Most of that thread is still relevant (perhaps throw in some py3l questions > to

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Stefan Schwarzer
Hello Peter, On 2010-08-06 19:20, Peter Pearson wrote: > On Fri, 06 Aug 2010 15:37:04 +0200, Stefan Schwarzer wrote: > [snip] >> I can imagine a case where you might want to compare a >> string with `is`: >> >> FORWARD = "forward" >> BACKWARD = "backward" >> >> ... >> >> def func(d

Perl -> Python unpack

2010-08-06 Thread James Mills
Hey all, Quick question for you Python enthusiasts that also happen to know Perl quite well... What does a* or A* translate to in Python when unpacking binary data with struct.unpack(...) ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/

Re: python interview quuestions

2010-08-06 Thread Tim Chase
I would like to aquint myself with Python Interview questions This came up a while ago: http://www.mail-archive.com/python-list@python.org/msg168961.html Most of that thread is still relevant (perhaps throw in some py3l questions too) -tkc -- http://mail.python.org/mailman/listinfo/pyth

Re: Python Portability--Not very portable?

2010-08-06 Thread CM
> As an example, my inexperienced Python partner 30 miles away has gotten > out of step somehow. I think by installing a different version of numpy > than I use. I gave him a program we both use months ago, and he had no > trouble. (We both use IDLE on 2.5). I made a one character change to it > an

Re: Python Portability--Not very portable?

2010-08-06 Thread CM
On Aug 5, 9:50 pm, "W. eWatson" wrote: > In my on-again-off-again experience with Python for 18 months, > portability seems an issue. > > As an example, my inexperienced Python partner 30 miles away has gotten > out of step somehow. I think by installing a different version of numpy > than I use.

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Terry Reedy
On 8/6/2010 5:27 AM, Richard D. Moores wrote: So there would be a different implementation for each operating system? One for Windows, one for linux? Or one for Vista and one for XP? I'm just trying to clarify what is meant by "implementation". Different version of CPython (that string cachin

Re: Python Portability--Not very portable?

2010-08-06 Thread Peter Otten
W. eWatson wrote: > So you think Python is part of open software in terms of distributing a > "product"? So I should stick to C, where one can distribute programs w/o > revealing code details, and having a customer compile the code? It's No, I'm trying to make you reconsider what you're going to

Re: Python Portability--Not very portable?

2010-08-06 Thread W. eWatson
On 8/6/2010 10:31 AM, geremy condra wrote: On Fri, Aug 6, 2010 at 8:00 AM, W. eWatson wrote: I would think there are some small time and big time Python players who sell executable versions of their programs for profit? Yes. What's your point? That someone must know how to distribute them

Re: [Tutor] Finding the version # of a module, and py module problem

2010-08-06 Thread W. eWatson
On 8/5/2010 6:47 PM, Philip Semanchuk wrote: On Aug 5, 2010, at 8:55 PM, W. eWatson wrote: It's been awhile since I've used python, and I recall there is a way to find the version number from the IDLE command line prompt. dir, help, __version.__? Hi Wayne, FYI it's got nothing to do with IDL

Re: python interview quuestions

2010-08-06 Thread Gary Herron
On 08/06/2010 10:44 AM, prakash jp wrote: Hi all, I would like to aquint myself with Python Interview questions . I am a Python Scripter, so if u could orient the pointers in the same direction it would be very handy Regards Huh??? -- http://mail.python.org/mailman/listinfo/python-list

python interview quuestions

2010-08-06 Thread prakash jp
Hi all, I would like to aquint myself with Python Interview questions . I am a Python Scripter, so if u could orient the pointers in the same direction it would be very handy Regards -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Portability--Not very portable?

2010-08-06 Thread W. eWatson
On 8/6/2010 9:03 AM, Peter Otten wrote: ... Seriously, I try to make a joke once in a while, usually with devastating results. The idea you were meant to take away was that once you start thinking about a protection scheme there is always a next step until you reach the point where your software

Re: Python Portability--Not very portable?

2010-08-06 Thread geremy condra
On Fri, Aug 6, 2010 at 8:00 AM, W. eWatson wrote: > >>> I would think there are some small time and big time Python players who >>> sell >>> executable versions of their programs for profit? >> >> Yes. What's your point? > > That someone must know how to distribute them without having the source c

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Peter Pearson
On Fri, 06 Aug 2010 15:37:04 +0200, Stefan Schwarzer wrote: [snip] > I can imagine a case where you might want to compare a > string with `is`: > > FORWARD = "forward" > BACKWARD = "backward" > > ... > > def func(direction=FORWARD): > if direction is FORWARD: > .

Re: Need help from someone that have PIL installed

2010-08-06 Thread Thomas Jollans
On 08/06/2010 04:37 PM, alejandro wrote: > >> # the last tuple is the background color >> img = Image.new("RGBA",(300, 50), (0, 0, 0, 0)) > Thank you for this > >> # I think that the PIL can cope with unicode, so add a u-prefix here: >> text = u"proba test ¾æèð¹" >> draw.text((20,8), text ,fo

Re: Smith-Waterman Algorithm in Python

2010-08-06 Thread Daniel Fetchinson
> Does any one about any implementation of classical Smith Waterman > local alignment algorithm and it's variants for aligning natural > language text? Please see http://tinyurl.com/2wy43fh Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.

Smith-Waterman Algorithm in Python

2010-08-06 Thread Muhammad Adeel
Hi, Does any one about any implementation of classical Smith Waterman local alignment algorithm and it's variants for aligning natural language text? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Checking that 2 pdf are identical (md5 a solution?)

2010-08-06 Thread Aahz
In article , rlevesque wrote: > >Given your expertise I will not be able to 'repay' you by helping on >Python problems but if you ever need help with SPSS related problems I >will be pleased to provide the assistance you need. Generally speaking, the community philosophy is "pay forward" -- help

Re: Python Portability--Not very portable?

2010-08-06 Thread Peter Otten
W. eWatson wrote: > I can't respond to otten directly, since he uses gmane. Here's my > response. > > W. eWatson wrote: > > >>> >>> I would think there are some small time and big time Python > players who > >>> >>> sell executable versions of their programs for profit? > >> >> > >> >> Yes.

Re: Need help from someone that have PIL installed

2010-08-06 Thread Peter Otten
alejandro wrote: >> Make sure that >> >> # encoding:utf-8 >> >> is the first line of your script, details and fineprint here: >> >> http://www.python.org/dev/peps/pep-0263/ >> >> Peter > > Tryed that... What happened? > What was the output of my script on your computer? $ python -V Python 2.6.

Re: Python Portability--Not very portable?

2010-08-06 Thread W. eWatson
I can't respond to otten directly, since he uses gmane. Here's my response. W. eWatson wrote: >>> >>> I would think there are some small time and big time Python players who >>> >>> sell executable versions of their programs for profit? >> >> >> >> Yes. What's your point? > > That someone must

Re: Need help from someone that have PIL installed

2010-08-06 Thread alejandro
> > Make sure that > > # encoding:utf-8 > > is the first line of your script, details and fineprint here: > > http://www.python.org/dev/peps/pep-0263/ > > Peter Tryed that... What was the output of my script on your computer? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Portability--Not very portable?

2010-08-06 Thread Peter Otten
W. eWatson wrote: >>> I would think there are some small time and big time Python players who >>> sell executable versions of their programs for profit? >> >> Yes. What's your point? > That someone must know how to distribute them without having the source > code ripped off. Yes, but he won't tel

Re: [Tutor] Finding the version # of a module, and py module problem

2010-08-06 Thread Philip Semanchuk
On Aug 6, 2010, at 10:20 AM, Richard D. Moores wrote: On Thu, Aug 5, 2010 at 18:47, Philip Semanchuk wrote: it's just a question of whether or not the module in question exposes any kind of a version attribute. There's no standard, unfortunately. The most popular convention seems to be

Re: Python Portability--Not very portable?

2010-08-06 Thread W. eWatson
I would think there are some small time and big time Python players who sell executable versions of their programs for profit? Yes. What's your point? That someone must know how to distribute them without having the source code ripped off. disutils. Sounds familiar. I'm pretty sure I was u

Re: Need help from someone that have PIL installed

2010-08-06 Thread Peter Otten
alejandro wrote: >> # the last tuple is the background color >> img = Image.new("RGBA",(300, 50), (0, 0, 0, 0)) > Thank you for this > >> # I think that the PIL can cope with unicode, so add a u-prefix here: >> text = u"proba test �" >> draw.text((20,8), text ,font=arial, fill="red") > >

Re: new to python - trouble calling a function from another function

2010-08-06 Thread nn
On Aug 5, 2:01 pm, Daniel Urban wrote: > > I'm building an elevator simulator for a class assignment. I recently ran > > into a roadblock and don't know how to fix it. For some reason, in my > > checkQueue function below, the call to self.goUp() is never executed. It is > > on the last line of cod

Re: Need help from someone that have PIL installed

2010-08-06 Thread alejandro
> # the last tuple is the background color > img = Image.new("RGBA",(300, 50), (0, 0, 0, 0)) Thank you for this > # I think that the PIL can cope with unicode, so add a u-prefix here: > text = u"proba test ¾æèð¹" > draw.text((20,8), text ,font=arial, fill="red") Nope i gives: SyntaxError: (u

Re: [Tutor] Finding the version # of a module, and py module problem

2010-08-06 Thread Richard D. Moores
On Thu, Aug 5, 2010 at 18:47, Philip Semanchuk wrote: > > it's just a question of whether or not > the module in question exposes any kind of a version attribute. There's no > standard, unfortunately. The most popular convention seems to be via an > attribute called __version__, but I've also seen

Re: How to read large amounts of output via popen

2010-08-06 Thread loial
Ok, thats great. Thanks for the very elegant solution(s) On 6 Aug, 13:44, Nobody wrote: > On Fri, 06 Aug 2010 02:06:29 -0700, loial wrote: > > I need to read a large amount of data that is being returned in > > standard output by a shell script I am calling. > > > (I think the script should re

Re: Need help from someone that have PIL installed

2010-08-06 Thread Peter Otten
alejandro wrote: > Can please someone run this little script that should output characters > like � in an image. > If it does it correctly can you tell me what OS, python version & PIL > version you have? > Or better if someone can tell me why this is not working properly on my > PC? (Win XP,

Need help from someone that have PIL installed

2010-08-06 Thread alejandro
Can please someone run this little script that should output characters like ¾æè¹ð in an image. If it does it correctly can you tell me what OS, python version & PIL version you have? Or better if someone can tell me why this is not working properly on my PC? (Win XP, PIL 1.1.6., Python 2.6...)

Re: Why is python not written in C++ ?

2010-08-06 Thread David Cournapeau
On Fri, Aug 6, 2010 at 8:39 PM, Roy Smith wrote: > In article , >  David Cournapeau wrote: > >> > Yes, there are a few corner cases where valid C syntax has different >> > semantics in C and C++.  But, they are very few.  Calling C++ a superset >> > of C is essentially correct. >> >> This is only

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Stefan Schwarzer
Hi DG, On 2010-08-06 14:28, DG wrote: > I've always thought of it as you don't compare strings with "is", you > *should* use == The reasoning is that you don't know if that string > instance is the only one in memory. I've heard as an implementation > detail, since strings are immutable, that Py

Re: Import python modules from sub-directories

2010-08-06 Thread Navkirat Singh
On 06-Aug-2010, at 1:13 PM, 夏震 wrote: > > >> Hi guys, >> >> I am new to python and would like to import certain classes in >> sub-directories of the >> working directory. I was wondering how will I be able to achieve this? >> >> Regards, >> Nav >> -- >> http://mail.python.org/mailman/listinf

Re: pylint scores

2010-08-06 Thread Matteo Landi
On Sun, Aug 1, 2010 at 12:27 PM, News123 wrote: > Hi, > > > On 07/31/2010 11:04 AM, Matteo Landi wrote: >> What are the messages one should really care about while evaluating >> its code using pylint? It's easy to get 5 scored with a "lot of public >> methods" or bad named variables such as 'x' or

Re: How to read large amounts of output via popen

2010-08-06 Thread Nobody
On Fri, 06 Aug 2010 02:06:29 -0700, loial wrote: > I need to read a large amount of data that is being returned in > standard output by a shell script I am calling. > > (I think the script should really be writing to a file but I have no > control over that) If the script is writing to stdout, y

Re: easy question on parsing python: "is not None"

2010-08-06 Thread DG
On Aug 6, 2:32 am, Bruno Desthuilliers wrote: > Richard D. Moores a écrit : > > > > > On Thu, Aug 5, 2010 at 16:15, Rhodri James > > wrote: > >> On Thu, 05 Aug 2010 17:07:53 +0100, wheres pythonmonks > >> wrote: > > >> You're not testing for equivalence there, you're testing for identity.   > >

Re: Why is python not written in C++ ?

2010-08-06 Thread Roy Smith
In article , David Cournapeau wrote: > > Yes, there are a few corner cases where valid C syntax has different > > semantics in C and C++.  But, they are very few.  Calling C++ a superset > > of C is essentially correct. > > This is only true if you limit yourself to C89 (as python seems to >

Re: Python Portability--Not very portable?

2010-08-06 Thread Tiago Katcipis
On Fri, Aug 6, 2010 at 12:28 AM, W. eWatson wrote: > On 8/5/2010 7:45 PM, geremy condra wrote: > >> On Thu, Aug 5, 2010 at 6:50 PM, W. eWatson >> wrote: >> >>> In my on-again-off-again experience with Python for 18 months, >>> portability >>> >>> seems an issue. >>> >>> As an example, my inexper

Re: Unicode error

2010-08-06 Thread kj
In Nobody writes: >On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote: >> Don't write bare excepts, always catch the error you want and nothing >> else. >That advice would make more sense if it was possible to know which >exceptions could be raised. In practice, that isn't possible, a

  1   2   >