Re: file.read() doesn't read the whole file

2009-03-24 Thread Sreejith K
On Mar 24, 2:12 pm, Ant wrote: > On Mar 24, 7:59 am, Sreejith K wrote: > ... > > > data is the whole file, but 'less' gives only the two lines... > > From this statement (that you are using less), it appears that you are > redirecting sys.stdout to a file or

Re: file.read() doesn't read the whole file

2009-03-24 Thread Sreejith K
On Mar 24, 4:45 pm, "R. David Murray" wrote: > Sreejith K wrote: > > On Mar 24, 2:12 pm, Ant wrote: > > > On Mar 24, 7:59 am, Sreejith K wrote: > > > ... > > > > > data is the whole file, but 'less' gives only the two lines... >

Re: file.read() doesn't read the whole file

2009-03-24 Thread Sreejith K
> It's not a redirect to a file.  Fuse calls the 'read' function on the > class, the read function does a 'return' of the data, and fuse passes > the data up through the OS layer to be the result of the 'read' call > made by less. By redirection I meant reading the snapshot file instead of the ori

Re: recursive outline numbering for object trees

2009-03-30 Thread Alia K
Thanks Gabriel. Your solution works like a charm. (-: AK -- http://mail.python.org/mailman/listinfo/python-list

Re: recursive outline numbering for object trees

2009-03-30 Thread Alia K
"Gabriel Genellina" wrote: > You should thank Aaron Brady who wrote the original function. I just   > smoothed some edges and glued it with your own code. Ah, Aaron Brady is castironpi... Well, thank you both then. (-: AK -- http://mail.python.org/mailman/listinfo/python-list

statvfs clearance

2009-04-04 Thread Sreejith K
Python's statvfs module contains the following indexes to use with os.statvfs() that contains the specified information statvfs.F_BSIZE Preferred file system block size. statvfs.F_FRSIZE Fundamental file system block size. statvfs.F_BLOCKS Total number of blocks in the filesystem. s

Re: Dynamically fill prepared (PDF?) forms

2009-04-27 Thread Alia K
pom wrote: > So I want to create PDF output based on an external layout file. You can allow for a transformation file which is read by your program to change the layout of the output. Think templates. AK -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with money datatype based calculations in python

2009-05-02 Thread anusha k
Do calculations in postgresql and then call that calculated value from the python.So no need to calculate in python at all Njoy the share of Freedom, Anusha Kadambala On Sat, May 2, 2009 at 1:15 PM, Krishnakant wrote: > hello all, > I am using postgresql as a database server for my db applicati

threading issue

2009-05-17 Thread anusha k
hi, i am using pygtk,glade in the front end and postgresql,python-twisted (xmlrpc) as the back end.My issue is i am trying to add the progress bar in my application but when the progress bar comes up it is blocking the backend process.So i started using threading in my application.But when i added

URGENT! Changing IE PAC Settings with Python

2009-05-20 Thread K-Dawg
Hello, Thanks for any response. I am in a crisis where one of our networking guys moved where our PAC file is housed. There was a group policy set in Active Directory that set the PAC file location in Internet Explorer to the new location. However, we have 100 remote centers that have about 3 t

Urllib2 proxy settings

2009-06-01 Thread K-Dawg
Hello, I am having trouble with an application running on a linux server. It keeps reverting to old proxy settings and messing up the web application. I have checked everything I can think of, and since the application is written in Python and uses urllib to call a web service (which is where th

Re: Distributing Python App

2008-07-18 Thread K-Dawg
On Fri, Jul 18, 2008 at 3:43 PM, Stephen Johnson <[EMAIL PROTECTED]> wrote: > Look up py2app and py2exe, for OS X and Windows, respectively. They are > extensively documented and easy to use. > On Jul 18, 2008, at 3:35 PM, KDawg44 wrote: > > Hi, > > I am very new to Python but find it very interes

Adding Microsoft objects in Boa Constuctor Palette

2008-08-06 Thread Sid K
This is what I wanted to do: Add Microsoft Active objects like Excel sheets and Word files to the Palette in Boa Constructor. There is a User tab in the GUI builder menu, but I'm not sure how to use/enable it. 1. Does anyone know how to do this? 2. Is anyone aware of any work that is currently go

Re: Adding Microsoft objects in Boa Constuctor Palette

2008-08-07 Thread Sid K
On Aug 7, 10:13 am, TheSeeker <[EMAIL PROTECTED]> wrote: > On Aug 6, 5:59 pm, Sid K <[EMAIL PROTECTED]> wrote: > > > > > This is what I wanted to do: > > > Add Microsoft Active objects like Excel sheets and Word files to the > > Palette in Boa Constr

File IO Issues, help :(

2008-04-28 Thread Kevin K
Hey everyone, I'm new to python and am trying to do a little project with it. I'm running into problems writing over a file. I read from the file and loop through for a specfic case in which I change something. After I open and give it opening options (w, r, etc) one of two things happens: either t

Re: File IO Issues, help :(

2008-04-28 Thread Kevin K
On Apr 29, 12:38 am, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > chuck in a jsfile.close(). The buffer isn't flushing with what you > are doing now. jsfile.flush() might work... not sure. Closing and > re-opening the file for sure will help though. > Yeah sorry I forgot to include the close() i

Re: File IO Issues, help :(

2008-04-28 Thread Kevin K
On Apr 29, 12:55 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Kevin K wrote: > > On Apr 29, 12:38 am, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > >> chuck in a jsfile.close(). The buffer isn't flushing with what you > >> are doing now. jsfil

Re: File IO Issues, help :(

2008-04-29 Thread Kevin K
On Apr 29, 1:07 am, Kevin K <[EMAIL PROTECTED]> wrote: > On Apr 29, 12:55 am, Peter Otten <[EMAIL PROTECTED]> wrote: > > > > > Kevin K wrote: > > > On Apr 29, 12:38 am, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > > >> chuck in a

newbie question

2008-08-25 Thread sharon k
hi all, i am new to python. i fetch a webpage with urllib, extract a few numbers in a format as follow; 10,884 24,068 my question is how to remove the comma between the number, since i have to add them up later. sorry for my bad english. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question

2008-08-25 Thread sharon k
e 1, in > ValueError: invalid literal for int() with base 10: '(12 123)' > > the comma has become an empty space, it cannot be converted to an integer. > i try the above in a winxp python command line. > > > On Mon, Aug 25, 2008 at 10:48 PM, Gerhard Häring <[EMAIL P

Re: newbie question

2008-08-25 Thread sharon k
>> a = int(a.replace(',', '')) > > I don't know the urllib, but I suppose if you use it to fetch content from > a web page it will return strings anyway. > > > On Aug 25, 2008, at 5:14 PM, sharon k wrote: > > >> >> thank you for your

Windows drag & drop with win32com and IDropTarget

2010-01-14 Thread Greg K
I'm trying to create a program that will process files dragged into its window, however I can't seem to get the cursor to change correctly when something is dragged over the window. I've created an object that implements the IDropTarget interface, but it seems the value returned by its DragEnter me

Re: Windows drag & drop with win32com and IDropTarget

2010-01-15 Thread Greg K
> It looks as though you're returning an OK *and* the effect > which isn't how the thing is implemented via the pywin32 > wrappers. Thanks for the reply, however even after I change the return value to just the effect code, I still have the same problem. There must still be something else I'm doin

covert number into string

2010-01-21 Thread anusha k
Hi, Can anyone tell me how to convert number to words For example: If number = then it should give me *Nine thousand nine hundred ninetynine* Is there any build-in function or something that can do this for me Thank you in advance Anusha Kadambala -- http://mail.python.org/mailman/listinfo/py

PyGUI menubar

2009-10-23 Thread dr k
I want to completely eliminate the menu bar from my PyGUI 2.0.5 application. the obvious thing, app.menus = [] doesn't work. i want not only the menus but the menu bar to disappear. help? [ a quick look at the code makes me suspect that it cannot be done presently but maybe there is a sneaky

Creating Import Hooks

2010-02-17 Thread Sreejith K
Hi everyone, I need to implement custom import hooks for an application (http:// www.python.org/dev/peps/pep-0302/). I want to restrict an application to import certain modules (say socket module). Google app engine is using a module hook to do this (HardenedModulesHook in google/ appengine/tools/

Re: Creating Import Hooks

2010-02-18 Thread Sreejith K
On Feb 18, 1:57 pm, Steven D'Aprano wrote: > On Thu, 18 Feb 2010 00:03:51 -0800, Jonathan Gardner wrote: > > On Feb 17, 10:48 pm, Sreejith K wrote: > >> Hi everyone, > > >> I need to implement custom import hooks for an application > >> (http://w

Re: Creating Import Hooks

2010-02-18 Thread Sreejith K
On Feb 18, 3:49 pm, Jean-Michel Pichavant wrote: > Sreejith K wrote: > > On Feb 18, 1:57 pm, Steven D'Aprano > > wrote: > > >> On Thu, 18 Feb 2010 00:03:51 -0800, Jonathan Gardner wrote: > > >>> On Feb 17, 10:48 pm, Sreejith K wrote: > >

Re: Files required for porting python

2010-02-22 Thread Kiran K
I will try to provide the API's on windows that my RTOS provides ex. If my RTOS has "fosCreateSemaphore" to create a semaphore I will implement the same API [ same function prototype] on windows using win32 CreateSemaphore. Similarly I will write a wrapper functions for accesing file system, task m

Re: Scalable python dict {'key_is_a_string': [count, some_val]}

2010-03-10 Thread Krishna K
On Fri, Feb 19, 2010 at 11:27 PM, Jonathan Gardner < jgard...@jonathangardner.net> wrote: > On Fri, Feb 19, 2010 at 10:36 PM, krishna > wrote: > > I have to manage a couple of dicts with huge dataset (larger than > > feasible with the memory on my system), it basically has a key which > > is a st

re.Scanner - match python dot notation

2011-02-07 Thread Christian K.
Hi, I am trying to find a regexp to be used with re.Scanner that matches the 'package.module.member' syntax. More specifically I want to parse function strings like numpy.sin(x*a+w) and sort out variables/constants. This one here works using re.match but fails when used with Scanner (due t

Re: re.Scanner - match python dot notation

2011-02-07 Thread Christian K.
Am 07.02.11 17:47, schrieb MRAB: On 07/02/2011 15:34, Christian K. wrote: Hi, I am trying to find a regexp to be used with re.Scanner that matches the 'package.module.member' syntax. More specifically I want to parse function strings like numpy.sin(x*a+w) and sort out variables

Re: assigning multi-line strings to variables

2010-04-27 Thread Sagar K
Use triple quote: d = """ this is a sample text which does not mean anything""" "goldtech" wrote in message news:4e25733e-eafa-477b-a84d-a64d139f7...@u34g2000yqu.googlegroups.com... On Apr 27, 7:31 pm, Brendan Abel <007bren...@gmail.com> wrote: > On Apr 27, 7:20 pm, goldtech wrote: > > > Hi, >

help need to write a python spell checker

2010-05-15 Thread harry k
Write a spell checking tool that will identify all misspelled word in a text file using a provided dictionary. The program will accept either one or two command line parameters. 1. The first command line parameter is the name of the text file that will be checked. 2. The optional seco

Re: Jew JUDGE shows off JEW POWER by BULLYING and BLACKMAILING a BLACK PRESIDENT OBAMA

2010-06-23 Thread k...@att.bizzzzzzzzzzzz
On Wed, 23 Jun 2010 19:10:45 -0700 (PDT), MooseFET wrote: >On Jun 23, 2:02 pm, nanothermite911fbibustards > wrote: >> FASCINATING !!! >> An ECOLOGICAL DISASTER is taking place. >> There is a need for HERCULEAN effort to STOP the oil spill. >> Then there is need for a THOROUGH study of the inciden

Re: python version in snow leopard?

2009-06-09 Thread Alia K
Mark Dickinson wrote: > The python-dev thread starting at > > http://mail.python.org/pipermail/python-3000/2008-September/014816.html > > suggests that back in September 2008, there was a 'MajorOS Vendor > (tm)' > who was interested in getting Python 2.6 into their next OS release, > provided that

Re: retrieve bitwise float representation

2009-06-11 Thread Tom K.
On Jun 10, 8:41 am, Ulrich Eckhardt wrote: > I need to pack a floating point value into a vector of 32-bit unsigned > values in IEEE format. Further, I maintain a CRC32 checksum for integrity > checking. For the latter, I actually need the float as integral value. ... > What I'm wondering is wheth

Addind imports to a class namespace

2009-07-10 Thread Ryan K
Greetings, In order to avoid circular imports, I have a class that I want to improve upon: Class GenerateMenuXhtml(threading.Thread): """ Subclasses a threading.Thread class to generate a menu's XHTML in a separate thread. All Link objects that have this menu associated with it are ga

Re: Addind imports to a class namespace

2009-07-11 Thread Ryan K
Thanks for your help Peter. I'm thinking that perhaps this isn't a circular import and that I don't understand importing. Here is a better explanation of my case (I am using Django): I have file x.py that declares classes A, B, C. There is also a file y.py that contains two methods T, U and the

Re: Addind imports to a class namespace

2009-07-11 Thread Ryan K
Okay so below is the acutal code. I am starting to think there is no reason why I can't install the post_save signal in signals.py itself and thereby avoid this issue entirely. models.py: class Link(CommonAbstractModel): ... class Menu(CommonAbstractModel): class StaticPage(CommonA

Re: Addind imports to a class namespace

2009-07-13 Thread Ryan K
Thank you for your replies. I have factored out the dependency and everything is solved. Cheers, Ryan -- http://mail.python.org/mailman/listinfo/python-list

Changing Python Opcodes

2009-08-17 Thread Sreejith K
Hi, I know this is not the best way to do it. But I have to do it at least to make it *hard* to decompile the python bytecode. I want to distribute a software written in Python without the source. So I compiled Python from source changing some opcode values (Taking care of HAVE_ARGUMENT value) an

Re: Changing Python Opcodes

2009-08-18 Thread Sreejith K
On Aug 18, 12:19 pm, "Diez B. Roggisch" wrote: > Did you try installing the egg *without* pyc-files in there? Because > naturally those shouldn't work. They shouldn't crash the interpreter > either, but then again - you *did* modify it. Hi Diez, thanks for the immediate reply :) I installed the

Re: Python and glade program - without errors but didn't display anything

2009-09-01 Thread anusha k
hi, You forgot to show the window.So in init method of py file and add self.window = self.wTree.get_widget("window_calculator") self.window.show() Njoy the share of Freedom, Anusha Kadambala On Tue, Sep 1, 2009 at 2:04 PM, Raji Seetharaman wrote: > Hi all, > i tried to develop a calculator us

Tkinter and Chess problems

2012-07-02 Thread Lalitha Prasad K
Dear All Recently I have been playing with Tkinter. I wrote two scripts to solve well known chess problems: eight queens and knight's tour. Both are available here: https://github.com/LalithaPrasad/PythonScripts All are welcome to download and improve them if required. Hope to rewrite them using t

python 6 compilation failure on RHEL

2012-08-20 Thread Ganesh Reddy K
Hi All, We are trying python 2.6 installation on an RHEL PC , whose 'uname -a' is (Linux 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux ) But, python compilation is not successfully done and showing a failure log. Below is the capture of the same. Please se

Understanding '?' in regular expressions

2012-11-15 Thread krishna . k . kishor3
Can someone explain the below behavior please? >>> re1 = re.compile(r'(?:((?:1000|1010|1020))[ ]*?[\,]?[ ]*?){1,3}') >>> re.findall(re_obj,'1000,1020,1000') ['1000'] >>> re.findall(re_obj,'1000,1020, 1000') ['1020', '1000'] However when I use "[\,]??" instead of "[\,]?" as below, I see a differen

Re: Is a with on open always necessary?

2012-01-25 Thread K Richard Pixley
On 1/20/12 07:44 , Andrea Crotti wrote: I normally didn't bother too much when reading from files, and for example I always did a content = open(filename).readlines() But now I have the doubt that it's not a good idea, does the file handler stays open until the interpreter quits? So maybe doin

Re: Is a with on open always necessary?

2012-01-25 Thread K Richard Pixley
On 1/21/12 03:38 , Lie Ryan wrote: It is only strictly necessary for programs that opens thousands of files in a short while, since the operating system may limit of the number of active file handlers you can have. The number you're looking for is 20 on many unix systems. That's all. 20 concu

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-25 Thread K Richard Pixley
On 1/23/12 21:57 , Rick Johnson wrote: Here is a grep from the month of September 2011 showing the rampantly egregious misuse of the following words and phrases: * pretty * hard * right * used to * supposed to "Pretty" is the most ludicrous of them all! As you will see, "pretty" is u

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-25 Thread K. Richard Pixley
On 1/25/12 12:14 , Rick Johnson wrote: You don't even need "pretty" to get your point across. If that's your argument, then we can drop the verb "to be", most articles, most verb conjugations, and nearly all adjectives and adverbs. For that matter, the vast majority of posts here can be drop

ANN: Leo 4.10 b1 released

2012-03-22 Thread Edward K. Ream
Leo 4.10 b1 is now available at: http://sourceforge.net/projects/leo/files/ Leo is a text editor, data organizer, project manager and much more. http://webpages.charter.net/edreamleo/intro.html Leo 4.10 contains 9 months of intense work on Leo. Several very important features are subtle; you coul

ANN: Leo 4.10 final released

2012-04-02 Thread Edward K. Ream
eo-editor/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html Edward K. Ream -- Edward K. Ream email: edream...@gmail.com Leo: http://webpages.charter.net/edreamleo/front.html -

Leo 4.9 b4 released

2011-06-14 Thread Edward K. Ream
ad.net/leo-editor/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html Edward K. Ream June 14, 2011 -- http://mail.python.org/mailman/listinfo/python-list

Re: Fun and games with lambda

2011-06-17 Thread Lalitha Prasad K
I would rate it as a great example of human ingenuity Lalit On Fri, Jun 17, 2011 at 9:40 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > If you've ever wondered what lambda and reduce are good for, run this one- > liner and wonder no more... > > (Be patient, it may take a fe

ANN: Leo 4.9 final released

2011-06-21 Thread Edward K. Ream
ogle.com/group/leo-editor Download: http://sourceforge.net/projects/leo/files/ Bzr: http://code.launchpad.net/leo-editor/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html Edward K. Ream June 21, 2011 -- http://mail.python.org/mailman/listinfo/python-list

Re: Significant figures calculation

2011-06-26 Thread Lalitha Prasad K
In numerical analysis there is this concept of machine zero, which is computed like this: e=1.0 while 1.0+e > 1.0: e=e/2.0 print e The number e will give you the precision of floating point numbers. Lalitha Prasad On Sun, Jun 26, 2011 at 9:05 PM, Harold wrote: > > >I'm curious. Is there

sqlite3 double quote behavior

2022-12-12 Thread John K. Parejko
Asking here before I file an improvement request issue on the python GitHub: sqlite has a known misfeature with double-quoted strings, whereby they will be interpreted as string literals if they don’t match a valid identifier [1]. The note in the sqlite docs describe a way to disable this misfea

Re: sqlite3 double quote behavior

2022-12-15 Thread John K. Parejko
:58, Chris Angelico wrote: > > On Wed, 14 Dec 2022 at 08:19, Roel Schroeven wrote: >> >> Chris Angelico schreef op 13/12/2022 om 20:01: >>> On Wed, 14 Dec 2022 at 06:00, Roel Schroeven wrote: >>>> >>>> Stefan Ram schreef op 13/12/2022 om 8:42: >

[Promotion] Book for Data Science Aspirants

2018-08-09 Thread Karthikeyan A K
y struggle and answers to it in this book. I hope this book would help you. - Karthikeyan A K -- https://mail.python.org/mailman/listinfo/python-list

Re: Making Python the Best App Dev Platform

2020-09-21 Thread Bonface M. K.
to hear from you. And if you’d > like to help, super! > > Best, > Val Also, just a suggestion: how about a way to bootstrap tests. I haven't really seen that on theGH link shared above. -- Bonface M. K. (https://www.bonfacemunyoki.com) Chief Emacs Mchochezi / Twitter: @BonfaceK

Re: Making Python the Best App Dev Platform

2020-09-21 Thread Bonface M. K.
gt; That being said, it would be nice to see your project have that-- doing bootstrapping for tests for you; and having somewhere that mentions how to run them. I'll try to have a look at it over the weekend? That's seems like something I'd use- though it'd have to

Re: replacments for stdio?

2005-09-23 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: >i was wondering if anyone have written a GUI module that can > function as a replacment for stdin/stdout? ie. has a file like > interface, by which one could just assaign it to sys.stdout or > sys.stdin and have all your prints and raw_inputs and other such things > sh

Re: __call__ in module?

2005-09-27 Thread Leif K-Brooks
ncf wrote: > I have a feeling that this is highly unlikely, but does anyone in here > know if it's possible to directly call a module, or will I have to wrap > it up in a class? You could use trickery with sys.modules to automatically wrap it in a class: import sys from types import ModuleType c

Re: Help with syntax warnings

2005-09-29 Thread Leif K-Brooks
Ivan Shevanski wrote: > is there a way to turn off syntax warnings or just make them not > visible? import warnings warnings.filterwarnings('ignore', category=SyntaxWarning) -- http://mail.python.org/mailman/listinfo/python-list

Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-01 Thread Leif K-Brooks
Sam wrote: > And "foo if bar" is Perl-ish; yet, even Perl has the ? : operators. What _isn't_ Perl-ish? -- http://mail.python.org/mailman/listinfo/python-list

Re: Distributing programs

2005-10-02 Thread Leif K-Brooks
Jeff Schwab wrote: > Sorta, but not really. Typically, you might distribute the source (.py) > files, but if you don't want to do that, you can distribute the > compiled .pyc files instead. Python creates these files automatically > when your modules are imported. But remember that Python bytec

Re: 2 class with same name in different module

2005-10-05 Thread Leif K-Brooks
Iyer, Prasad C wrote: > I have a class in a module which is getting imported in main module. > How do you differentiate between the 2 class import foo import bar foo.TheClass().dostuff() bar.TheClass().dostuff() -- http://mail.python.org/mailman/listinfo/python-list

Re: Python eats gator.

2005-10-05 Thread Leif K-Brooks
Sam wrote: > http://www.wnbc.com/family/5060215/detail.html > > I know there's an on-topic joke in here somewhere, but I'm having some > problem finding it, at the moment. > > You may take a crack at it, if you'd like… Hmm... has anyone ever written a spyware removal tool in Python? -- http://m

Re: os.access with wildcards

2005-10-06 Thread Leif K-Brooks
mike wrote: > i'd like to use > >os.access(path,mode) > > where path may contain linux style wildcards. os.access(glob.glob(path), mode) -- http://mail.python.org/mailman/listinfo/python-list

Re: Changing an AST

2005-10-10 Thread Leif K-Brooks
beza1e1 wrote: > Is it possible compiler.parse a statement, then change and then > execute/resolve it? This should work: >>> from compiler.pycodegen import ModuleCodeGenerator >>> from compiler.misc import set_filename >>> from compiler import parse >>> >>> tree = parse('foo = 42') >>> set

ANN: Leo 4.4a1 released

2005-10-17 Thread Edward K. Ream
nload: http://sourceforge.net/project/showfiles.php?group_id=3458 CVS: http://sourceforge.net/cvs/?group_id=3458 Quotes: http://webpages.charter.net/edreamleo/testimonials.html Edward K. Ream October 17, 2005 ---- Edward K. Ream

Re: newbie regex

2005-10-17 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > I want to filter some strings,but i don t know how to use compile > method. Why not? > first character must be [a-zA-z] group and others can only be digits or > letters. if re.search('^[a-zA-Z][a-zA-Z0-9]*$', foo): print "Valid string." else: print "Invalid str

Re: newbie regex

2005-10-17 Thread Leif K-Brooks
Leif K-Brooks wrote: > [EMAIL PROTECTED] wrote: > >>I want to filter some strings,but i don t know how to use compile >>method. > > Why not? Sorry: I misread that as not _wanting_ to use the compile method. -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting 2bit hex representation to integer ?

2005-10-19 Thread Leif K-Brooks
Madhusudan Singh wrote: > I am using binascii.b2a_hex to convert some binary data to hex. The > result is a two bit hex representation (i. e., without the leading > 0x). Surely you mean two-byte? > How do I convert the resulting two bit representation into an integer > ? int(foo, 16) -- http://

Re: dictionary that have functions with arguments

2005-11-02 Thread Leif K-Brooks
Alex Martelli wrote: > execfunc = { 'key1' : (func1, ()), > 'key2' : (func2, args) } > > now, something like: > > f, a = execfunc[k] > f(**a) > > will work for either key. Shouldn't func1's args be a dictionary,

ANN: Leo 4.4a2 released

2005-11-03 Thread Edward K. Ream
Vim and other 'plain-key' input modes. Links: -- Leo: http://webpages.charter.net/edreamleo/front.html Home: http://sourceforge.net/projects/leo/ Download: http://sourceforge.net/project/showfiles.php?group_id=3458 CVS: http://sourceforge.net/cvs/?group_id=3458 Quotes: htt

Re: I Need Motivation Part 2

2005-11-04 Thread Leif K-Brooks
Sybren Stuvel wrote: > There are over 2800 header files on my system in /usr/include. What do > you mean "a limited number of header files"? I assume he's saying that the number is < ∞. (Of course, the same is true of Python modules unless you use a special __import__ hook or something...) -- htt

Re: How can I do this in Python?

2005-11-04 Thread Leif K-Brooks
Steve Holden wrote: > Another alternative might be to serve a script that sent the browser > back 2 pages in its history, as long as server state hasn't changed in > the meantime. What about users with JavaScript disabled? -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a List into a String

2005-11-05 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > list = ['f', 'e', 'd', 'c', 'b', 'a'] > > How can i convert it into a string so the output is > > fedcba print ''.join(list) -- http://mail.python.org/mailman/listinfo/python-list

ANN: Leo 4.4a2 withdrawn

2005-11-05 Thread Edward K. Ream
Leo 4.4a2 has been withdrawn due to problems that can cause Leo to lose what you have recently typed. Leo 4.4a3 will be released in about a week. Edward Edward K. Ream email: [EMAIL PROTECTED] Leo: http

Re: overloading *something

2005-11-07 Thread Leif K-Brooks
James Stroud wrote: > Hello All, > > How does one make an arbitrary class (e.g. class myclass(object)) behave like > a list in method calls with the "*something" operator? What I mean is: > > myobj = myclass() > > doit(*myobj) Make it iterable: >>> class Foo(object): ... def __iter__(se

Re: how to stop a loop with ESC key? [newbie]

2005-11-08 Thread Leif K-Brooks
mo wrote: > Can somebody explain how to stop a WHILE loop in running program by pressing > ESC key? On Unix-like systems try: import termios, fcntl, sys, os fd = sys.stdin.fileno() oldterm = termios.tcgetattr(fd) newattr = termios.tcgetattr(fd) newattr[3] = newattr[3] & ~termios.ICANON & ~termio

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > George Sakkis wrote: > >list(takewhile(p, xrange(1000))) >> >>[0, 1] > > thanks. that is what I am doing now, in a more generic form : > > takewhile(p, (x for x in xrange(1))) How does a useless generator expression make it more generic? -- http://mail

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > Leif K-Brooks wrote: > >>[EMAIL PROTECTED] wrote: >> >>>thanks. that is what I am doing now, in a more generic form : >>> >>>takewhile(p, (x for x in xrange(1))) >> >>How does a useless generator expressi

Re: Confusion about __call__ and attribute lookup

2005-11-10 Thread Leif K-Brooks
Kent Johnson wrote: > But why doesn't Foo.__call__ shadow type.__call__? Normally an instance > attribute takes precedence over a class attribute. Is it something > special about how function call syntax is handled internally, or do all > special methods work this way, or is there something else go

Re: Recompile AST?

2005-11-10 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > Is it possible to recompile the AST generated by compiler.parse, back > into code or an executable code object? Into a bytecode object: >>> from compiler.pycodegen import ModuleCodeGenerator >>> from compiler.misc import set_filename >>> from compiler import parse >

Re: list of lambda

2005-11-11 Thread Leif K-Brooks
jena wrote: > hello, > when i create list of lambdas: > l=[lambda:x.upper() for x in ['a','b','c']] > then l[0]() returns 'C', i think, it should be 'A' Fredrik Lundh provided the general solution, but in this specific case, the simplest solution is: l = [x.upper for x in ['a', 'b', 'c']] -- htt

Re: Parse file into array

2005-11-14 Thread Leif K-Brooks
amfr wrote: > I was wondering how i could parse the contents of a file into an array. > the file would look something like this: > > gif:image/gif > html:text/html > jpg:image/jpeg > ... > > As you can see, it contains the mime type and the file extension > seperated by commas, 1 per line. I wa

Re: Parse file into array

2005-11-14 Thread Leif K-Brooks
Leif K-Brooks wrote: > line = line.rsplit('\r\n') Er, that should be line.rstrip, not line.rsplit. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert a "long in a string" to a "long"?

2005-11-18 Thread Leif K-Brooks
Sion Arrowsmith wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: > >>[EMAIL PROTECTED] wrote: >> >>>s = long("0xL") >>>ValueError: invalid literal for long(): 0xL >>> >int("0x", 0) >> >>4294967295L > > So why does the base argument to int() (or long()) default to >

Re: python speed

2005-12-01 Thread Leif K-Brooks
Krystian wrote: >>I would also like to see Half Life 2 in pure Python. > > or even quake1, do you think it could have any chances to run > smoothly? If can run at a reasonably speed, yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute an EXE via os.system() with spaces in the directory name?

2005-12-04 Thread Leif K-Brooks
Leif K-Brooks wrote: > It's perfectly reasonable behavior, and it also applies to Linux. The > shell uses spaces to separate arguments; how do you expect it to know > that you want a space to be part of the program's name unless you escape it? I'm sorry, disregard my messa

Re: How to execute an EXE via os.system() with spaces in the directory name?

2005-12-04 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > This comes up from time to time. The brain damage is all Windows', > not Python's. It's perfectly reasonable behavior, and it also applies to Linux. The shell uses spaces to separate arguments; how do you expect it to know that you want a space to be part of the progra

ANN: Leo 4.4a4 released

2005-12-06 Thread Edward K. Ream
e the keyboard. - Support for Vim and other 'plain-key' input modes. ---- Edward K. Ream email: [EMAIL PROTECTED] Leo: http://webpages.charter.net/edreamleo/front.html -

Re: date/time

2005-01-05 Thread Binu K S
>>> import time >>> time.strftime('%Y%m%d',time.localtime()) '20050105' On Wed, 05 Jan 2005 15:08:37 +0100, Nader Emami <[EMAIL PROTECTED]> wrote: > L.S., > > Could somebody help me how I can get the next format of date > from the time module? > > example: I have to have this time 20050105. It i

Re: file.readlines() - gives me error (bad file descriptor)

2005-01-05 Thread Binu K S
There's nothing crazy going on here. The file's current position moves as you write into it. Both read and write operation use the same offset. The tell() method gives you the current position at any time. When you append to a file the position moves to the end of the file so that the next write ha

Re: file.readlines() - gives me error (bad file descriptor)

2005-01-06 Thread Binu K S
On Thu, 6 Jan 2005 13:17:11 +0530, Gurpreet Sachdeva <[EMAIL PROTECTED]> wrote: > On Thu, 6 Jan 2005 12:55:22 +0530, Binu K S <[EMAIL PROTECTED]> wrote: > >>>The file's current position moves as you write into it. > I concure and have figured out the solution BUT

Re: file.readlines() - gives me error (bad file descriptor)

2005-01-06 Thread Binu K S
http://mail.python.org/pipermail/python-bugs-list/2001-October/007650.html Rest assured you're not on drugs :) On Thu, 6 Jan 2005 14:45:24 +0530, Gurpreet Sachdeva <[EMAIL PROTECTED]> wrote: > On Thu, 6 Jan 2005 14:27:40 +0530, Binu K S <[EMAIL PROTECTED]> wrote: > > I&

Python C Object Comparison

2005-01-06 Thread Anand K Rayudu
Dear All, I have some question regarding embedding and exposing of C pointers. We have embedded python and extended to expose our APIs and c objects to python. Every thing is working fine as far as customizing our application through python. How ever i am expecting following behavior but it fail

<    1   2   3   4   5   6   7   8   >