sending executable data over network..

2008-06-24 Thread Piyush Anonymous
hi, i wish to change the way the function definition at run time in a running server. new function code which is to be executed is provided by a client at different location. i am getting it by reading a file and sending it using makefile() with server/client connected using sockets. how can make

Sending information to a website

2008-06-24 Thread Alex Bryan
Okay, so what I want to do is connect to dictionary.com and send the website a word, and later receive the definition. But for now, I want to focus on sending the word. A good guy from this mailing list said I should look into the code and then figure out what the word you want to be define

Re: Is there any way to find out sizeof an object

2008-06-24 Thread Paddy
On Jun 24, 6:00 am, srinivasan srinivas <[EMAIL PROTECTED]> wrote: > Hi, > I have written a class which has some attributes. I want to know how do i > find out the size of an instance of this class?? > class T(object): >     def __init__(self, fn_name, *args, **kwds): >         self.fn_name = fn_n

Re: Python 3000 vs Perl 6

2008-06-24 Thread cokofreedom
On Jun 24, 8:20 am, "Corey G." <[EMAIL PROTECTED]> wrote: > If Perl 6 ever does get on its feet and get released, how does it > compare to Python 3000? Is Perl 6 more like Java now with Parrot? I > just want to make sure that Python is staying competitive. > > If this is the wrong mailing list, j

Re: String question

2008-06-24 Thread cokofreedom
On Jun 24, 5:38 am, "Mark Tolonen" <[EMAIL PROTECTED]> wrote: > "Andreu" <[EMAIL PROTECTED]> wrote in messagenews:[EMAIL PROTECTED] > > Yes, ... don't ask me why, but in fact v1,v2,v3 = str1.split() > > does not seem to work. My original problem was I forgot about > > the parenthesis as Tim point

binary representation of an integer

2008-06-24 Thread eliben
Hello, I'm interested in converting integers to a binary representation, string. I.e. a desired function would produce: dec2bin(13) => "1101" The other way is easily done in Python with the int() function. Perl has a very efficient way to do dec2bin, because its pack/unpack have a B format for

Re: binary representation of an integer

2008-06-24 Thread Maric Michaud
Le Tuesday 24 June 2008 10:03:58 eliben, vous avez écrit : > Hello, > > I'm interested in converting integers to a binary representation, > string. I.e. a desired function would produce: > > dec2bin(13) => "1101" > > The other way is easily done in Python with the int() function. > > Perl has a ver

Re: MD5 hash for url and utf unicode converting to ascii

2008-06-24 Thread Nick Craig-Wood
joe shoemaker <[EMAIL PROTECTED]> wrote: > I would like to convert url into md5 hash. My question is that md5 > hash will create collision at 2^64. If you do long(value,16), where > value is the md5 hash string, would value returned from long(value, > 16) be unique as long as md5 hashed string

Re: Python 3000 vs Perl 6

2008-06-24 Thread Corey G.
What I meant, in terms of dealing with accurate or non-accurate rumors is with speed, yes. There are plenty of comparisons where Perl is 4-15x faster then Python for 'some' operations regarding regular expressions, etc. For me personally, this means absolutely nothing because if I spend

Re: binary representation of an integer

2008-06-24 Thread Mark Dickinson
On Jun 24, 9:03 am, eliben <[EMAIL PROTECTED]> wrote: > What would be the quickest way to do this ? I think that for dec2bin > conversion, using hex() and then looping with a hex->bin lookup table > would be probably much faster than the general baseconvert from the > recipe. I suspect you're righ

Re: poplib - retr() getting stuck

2008-06-24 Thread Gabriel Genellina
En Fri, 20 Jun 2008 04:37:32 -0300, Roopesh <[EMAIL PROTECTED]> escribió: I am using poplib's retr() to fetch mails from my gmail account. It works fine, in some cases it gets stuck inside the retr() method and does not come out. Probably the server stopped responding. By default, sockets ha

String split with " and/or ' and/or \

2008-06-24 Thread Kurt Mueller
How to (super)split a string (literal) containing " and/or ' and/or \. example: ' a " b b " c\ c '.supersplit(' ') -> ['a', ' b b ', 'c c'] Thanks and Grüessli -- Kurt Müller: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3000 vs Perl 6

2008-06-24 Thread cokofreedom
On Jun 24, 10:36 am, "Corey G." <[EMAIL PROTECTED]> wrote: > What I meant, in terms of dealing with accurate or non-accurate rumors > is with speed, yes. There are plenty of comparisons where Perl is > 4-15x faster then Python for 'some' operations regarding regular > expressions, etc. > > For me

Re: string.Template.delimiter cannot be overriden?

2008-06-24 Thread Gabriel Genellina
En Tue, 17 Jun 2008 02:20:23 -0300, Raymond Hettinger <[EMAIL PROTECTED]> escribió: On Jun 16, 9:53 pm, kretik <[EMAIL PROTECTED]> wrote: I've been trying to coax this class to use something other than the default '$' but it seems setting it to something else has no discernible effect. Is it

Re: String split with " and/or ' and/or \

2008-06-24 Thread Paul McGuire
On Jun 24, 3:56 am, Kurt Mueller <[EMAIL PROTECTED]> wrote: > How to (super)split a string (literal) containing " and/or ' and/or \. > > example: > > ' a  "  b b   "  c\ c '.supersplit(' ') > -> > ['a', '  b b   ', 'c c'] > > Thanks and Grüessli > -- > Kurt Müller: > [EMAIL PROTECTED] >>> re.split

Re: String split with " and/or ' and/or \

2008-06-24 Thread Paul McGuire
On Jun 24, 3:56 am, Kurt Mueller <[EMAIL PROTECTED]> wrote: > How to (super)split a string (literal) containing " and/or ' and/or \. > > example: > > ' a  "  b b   "  c\ c '.supersplit(' ') > -> > ['a', '  b b   ', 'c c'] > > Thanks and Grüessli > -- > Kurt Müller: > [EMAIL PROTECTED] Or did you m

Re: Python 3000 vs Perl 6

2008-06-24 Thread Michele Simionato
On Jun 24, 11:16 am, [EMAIL PROTECTED] wrote: > Towards it being more advanced than Python 3k, time will tell. It is worth reminding that, in more than one sense, the most advanced language is the one with less features ... Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: very large graph

2008-06-24 Thread MRAB
On Jun 24, 1:26 am, [EMAIL PROTECTED] wrote: > I need to represent the hyperlinks between a large number of HTML > files as a graph.  My non-directed graph will have about 63,000 nodes > and and probably close to 500,000 edges. > > I have looked into igraph (http://cneurocvs.rmki.kfki.hu/igraph/doc

Re: String split with " and/or ' and/or \

2008-06-24 Thread Peter Otten
Kurt Mueller wrote: > How to (super)split a string (literal) containing " and/or ' and/or > \. > > example: > > ' a " b b " c\ c '.supersplit(' ') > -> > ['a', ' b b ', 'c c'] > > > Thanks and Grüessli >>> import shlex >>> shlex.split(' a " b b " c\ c ') ['a', ' b b ', 'c c']

calling a .exe from Python

2008-06-24 Thread yoevidentemente
Hi, i am trying to call a .exe from my .py file, i have found the exec function, but i'm not sure of how to use it:S would it be f.e.: execl (mypath/myfile.exe,myfile,arg1,arg2,...) Another question is, when i call my .exe with exec, i understand that my .py file will stop running, and ins

calling a .exe from Python

2008-06-24 Thread evidentemente.yo
Hi, i am trying to call a .exe from my .py file, i have found the exec function, but i'm not sure of how to use it:S would it be f.e.: execl (mypath/myfile.exe,myfile,arg1,arg2,...) Another question is, when i call my .exe with exec, i understand that my .py file will stop running, and ins

How to import filenames with special characters?

2008-06-24 Thread inhahe
How would I import a python file whose name contains characters like .'s or !'s? Is there really _no_ way to do that? I have to use plain jane letters and numbers for everything? -- http://mail.python.org/mailman/listinfo/python-list

Difference between two dates

2008-06-24 Thread sniipe
Hi! I am new in Python, so I count for your help. I need to get difference in months between two dates. How to do it in python? I am substracting two dates, for example date1 - date2 and I got result in days, how to change it? Best regards -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between two dates

2008-06-24 Thread Cédric Lucantis
Le Tuesday 24 June 2008 12:11:03 [EMAIL PROTECTED], vous avez écrit : > Hi! > > I am new in Python, so I count for your help. I need to get difference > in months between two dates. How to do it in python? I am substracting > two dates, for example date1 - date2 and I got result in days, how to > c

Re: binary representation of an integer

2008-06-24 Thread Nick Craig-Wood
eliben <[EMAIL PROTECTED]> wrote: > I'm interested in converting integers to a binary representation, > string. I.e. a desired function would produce: > > dec2bin(13) => "1101" > > The other way is easily done in Python with the int() function. > > Perl has a very efficient way to do dec2bi

Re: sending executable data over network..

2008-06-24 Thread Cédric Lucantis
Le Tuesday 24 June 2008 08:59:40 Piyush Anonymous, vous avez écrit : > hi, > i wish to change the way the function definition at run time in a running > server. new function code which is to be executed is provided by a client > at different location. > i am getting it by reading a file and sending

Re: very large graph

2008-06-24 Thread A.T.Hofkamp
On 2008-06-24, MRAB <[EMAIL PROTECTED]> wrote: > On Jun 24, 1:26 am, [EMAIL PROTECTED] wrote: >> I need to represent the hyperlinks between a large number of HTML >> files as a graph.  My non-directed graph will have about 63,000 nodes >> and and probably close to 500,000 edges. >> >> I have looked

Re: Difference between two dates

2008-06-24 Thread A.T.Hofkamp
On 2008-06-24, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi! > > I am new in Python, so I count for your help. I need to get difference > in months between two dates. How to do it in python? I am substracting > two dates, for example date1 - date2 and I got result in days, how to > change it?

Re: calling a .exe from Python

2008-06-24 Thread MRAB
On Jun 24, 10:50 am, "evidentemente.yo" <[EMAIL PROTECTED]> wrote: > Hi, i am trying to call a .exe from my .py file, i have found the exec > function, but i'm not sure of how to use it:S > > would it be f.e.: > > execl (mypath/myfile.exe,myfile,arg1,arg2,...) > > > > Another question is, when

Re: Python 3000 vs Perl 6

2008-06-24 Thread bearophileHUGS
[EMAIL PROTECTED]: > I believe Python 3k will (when out of beta) will have a speed > similar to what it has currently in 2.5, possibly with speed ups > in some locations. Python 3 uses by default unicode strings and multiprecision integers, so a little slowdown is possible. Michele Simionato: >

Re: Python 3000 vs Perl 6

2008-06-24 Thread Nick Craig-Wood
Corey G. <[EMAIL PROTECTED]> wrote: > The main concern (my concern) is whether or not Perl 6 is > more like Java with pre-compiled byte code (did I say that right) See below for some python VM comments > and whether or not individuals without the ability to see past the > surface will begin

Bit substring search

2008-06-24 Thread Kris Kennaway
I am trying to parse a bit-stream file format (bzip2) that does not have byte-aligned record boundaries, so I need to do efficient matching of bit substrings at arbitrary bit offsets. Is there a package that can do this? This one comes close: http://ilan.schnell-web.net/prog/bitarray/ but it

Re: Bit substring search

2008-06-24 Thread bearophileHUGS
Kris Kennaway: > I am trying to parse a bit-stream file format (bzip2) that does not have > byte-aligned record boundaries, so I need to do efficient matching of > bit substrings at arbitrary bit offsets. > Is there a package that can do this? You may take a look at Hachoir or some other modules:

Re: Terminating processes on Windows (handles and IDs)

2008-06-24 Thread geoffbache
Thanks for the tip. This does seem rather overkill to introduce all these dependencies just to be able to kill a process though... I've discovered that subprocess.Popen objects have a member "_handle" which is undocumented but appears to work, so I'm using that for now. Better suggestions gratefu

Re: binary representation of an integer

2008-06-24 Thread cokofreedom
On Jun 24, 10:38 am, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Jun 24, 9:03 am, eliben <[EMAIL PROTECTED]> wrote: > > > What would be the quickest way to do this ? I think that for dec2bin > > conversion, using hex() and then looping with a hex->bin lookup table > > would be probably much fast

Re: binary representation of an integer

2008-06-24 Thread cokofreedom
And: # return as a string def itob_string(integer, count = 8): return "".join(str((integer >> i) & 1) for i in range(count - 1, -1, -1)) # return as an iterator (i.e [0, 0, 0, 0, 1, 0, 1, 0]) def itob_list(integer, count = 8): return [(integer >> i) & 1 for i in range(count - 1, -1, -1)]

Re: calling a .exe from Python

2008-06-24 Thread Nick Craig-Wood
evidentemente.yo <[EMAIL PROTECTED]> wrote: > Hi, i am trying to call a .exe from my .py file, i have found the exec > function, but i'm not sure of how to use it:S > > would it be f.e.: > > execl (mypath/myfile.exe,myfile,arg1,arg2,...) > > > > Another question is, when i call my .e

Re: sending executable data over network..

2008-06-24 Thread Piyush Anonymous
any idea or pointer how i could link it to running code in server? for example, i get a new method definition for a method and i wish to change it. client sent new definition, i compile it in server. how can i link it to old code? if it will running in same environment, i would write objectA.getdat

Re: Terminating processes on Windows (handles and IDs)

2008-06-24 Thread Tim Golden
Val-Amart wrote: On Jun 23, 6:33 pm, geoffbache <[EMAIL PROTECTED]> wrote: Hi all, I've always wondered why os.kill isn't supported on Windows. I found a discussion somewhere from 2006 about this so it seems others have wanted it, but still nothing. So I have a half-baked solution involving cal

Re: binary representation of an integer

2008-06-24 Thread bearophileHUGS
eliben: > Python's pack/unpack don't have the binary format for some reason, so > custom solutions have to be developed. One suggested in the ASPN > cookbook is:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/111286 > However, it is very general and thus inefficient. Try mine, it may be fa

Re: Difference between two dates

2008-06-24 Thread sniipe
Thank you for answers. I used Cédric Lucantis's way to resolve this problem and it works :D -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between two dates

2008-06-24 Thread sniipe
Thank you for answers :) I used Cédric Lucantis's way to resolve this problem and it works :D -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3000 vs Perl 6

2008-06-24 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > The fact that > it still hasn't been released after 8 years of development (Larry > announced it in his State of the Onion speech in 2000 I think) makes > me think that I made the right choice. Sometimes you gotta be pa

Re: Python 3000 vs Perl 6

2008-06-24 Thread Michele Simionato
On Jun 24, 1:19 pm, [EMAIL PROTECTED] wrote: > Michele Simionato: > > > It is worth reminding that, in more than one sense, the most advanced > > language is the one with less features ... > > I don't agree, Scheme or Brainfuck may have less features, but this > doesn't make them more advanced, it

Re: Bit substring search

2008-06-24 Thread Kris Kennaway
[EMAIL PROTECTED] wrote: Kris Kennaway: I am trying to parse a bit-stream file format (bzip2) that does not have byte-aligned record boundaries, so I need to do efficient matching of bit substrings at arbitrary bit offsets. Is there a package that can do this? You may take a look at Hachoir or

Re: Sending information to a website

2008-06-24 Thread Jim
One way is to use a package that allows you to simulate being a browser: http://wwwsearch.sourceforge.net/mechanize/ . -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending information to a website

2008-06-24 Thread Jeff McNeil
On Jun 24, 12:13 am, Alex Bryan <[EMAIL PROTECTED]> wrote: > Okay, so what I want to do is connect to dictionary.com and send the > website a word, and later receive the definition. But for now, I want > to focus on sending the word. A good guy from this mailing list said I > should look into the c

Re: String split with " and/or ' and/or \

2008-06-24 Thread Kurt Mueller
Peter Otten schrieb: Kurt Mueller wrote: How to (super)split a string (literal) containing " and/or ' and/or \. example: ' a " b b " c\ c '.supersplit(' ') -> ['a', ' b b ', 'c c'] import shlex shlex.split(' a " b b " c\ c ') ['a', ' b b ', 'c c'] Thanks Peter Thanks Paul

Re: Bit substring search

2008-06-24 Thread bearophileHUGS
Kris Kennaway: > Unfortunately I didnt find anything else useful here yet :( I see, I'm sorry, I have found hachoir quite nice in the past. Maybe there's no really efficient way to do it with Python, but you can create a compiled extension, so you can see if it's fast enough for your purposes. To

Re: Python 3000 vs Perl 6

2008-06-24 Thread bearophileHUGS
Michele Simionato: Also consider the famous Clinger's maxim > “Programming languages should be designed not by piling feature > on top of feature, but by removing the weaknesses and restrictions > that make additional features appear necessary.” I'm relaxed, don't worry :-) I know that maxim, but

Re: python script for tortoise cvs

2008-06-24 Thread sandeep
On Jun 20, 2:54 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 19 Jun 2008 10:26:09 -0300, Simon Brunning <[EMAIL PROTECTED]> > escribió: > > > > > On Thu, Jun 19, 2008 at 2:14 PM, sandeep <[EMAIL PROTECTED]> wrote: > >> hi > > >> we are using tortoise cvs and putty. i want to write

Re: string.Template.delimiter cannot be overriden?

2008-06-24 Thread Raymond Hettinger
[kretik] >> I've been trying to coax this class to use something other than the > >> default '$' but it seems setting it to something else has no discernible > >> effect. Is it necessary to inherit from the class to do this? [raymond] > > Yes, subclassing is the intended way to produce variants of

Re: Bit substring search

2008-06-24 Thread Kris Kennaway
[EMAIL PROTECTED] wrote: Kris Kennaway: Unfortunately I didnt find anything else useful here yet :( I see, I'm sorry, I have found hachoir quite nice in the past. Maybe there's no really efficient way to do it with Python, but you can create a compiled extension, so you can see if it's fast en

Re: How to import filenames with special characters?

2008-06-24 Thread Gary Herron
inhahe wrote: How would I import a python file whose name contains characters like .'s or !'s? Is there really _no_ way to do that? I have to use plain jane letters and numbers for everything? The import statement can't help you, but take a look at the __import__ builtin function and th

Re: Python 3000 vs Perl 6

2008-06-24 Thread Kay Schluehr
On 24 Jun., 13:19, [EMAIL PROTECTED] wrote: > If you want to see an advanced language, you may take a look at > PyMeta, that's a bit of the future of the computer > science:http://washort.twistedmatrix.com/ Er, no. The future of CS is also its past i.e. EBNF ;) -- http://mail.python.org/mailman

percent string replacement with index

2008-06-24 Thread Ulrich Eckhardt
Hi! I'm still mostly learning Python and there is one thing that puzzles me about string formatting. Typical string formatting has these syntaxes: "%s is %s" % ("GNU", "not Unix") "%(1)s %(2)s" % ("1":"one", "2":"two") What I'm surprised is that this isn't supported: "%(1)s %(2)s" % ("zer

Re: very large graph

2008-06-24 Thread castironpi
On Jun 24, 5:58 am, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-06-24, MRAB <[EMAIL PROTECTED]> wrote: > > > On Jun 24, 1:26 am, [EMAIL PROTECTED] wrote: > >> I need to represent the hyperlinks between a large number of HTML > >> files as a graph.  My non-directed graph will have about 63,00

Re: Python 3000 vs Perl 6

2008-06-24 Thread Kay Schluehr
On 24 Jun., 13:19, [EMAIL PROTECTED] wrote: > If you want to see an advanced language, you may take a look at > PyMeta, that's a bit of the future of the computer > science:http://washort.twistedmatrix.com/ Er, no. The future of CS is also its past i.e. EBNF ;) -- http://mail.python.org/mailman

Re: Fwd: xml to mysql (vice versa ) too

2008-06-24 Thread Stefan Behnel
> Le Tuesday 24 June 2008 07:08:46 swapna mudavath, vous avez écrit : >> can anybody help me in this >> >> -swapna >> >> -- Forwarded message -- >> From: swapna mudavath <[EMAIL PROTECTED]> >> Date: Mon, Jun 23, 2008 at 5:27 PM >> Subject: xml to mysql (vice versa ) too >> To: P

Re: Python 3000 vs Perl 6

2008-06-24 Thread Eric Wertman
Flaming Thunder FTW!!! thank you, I'm here all week. -- http://mail.python.org/mailman/listinfo/python-list

Connecting through another program

2008-06-24 Thread animefanfive
I am attempting to make an addon to a game. The game developers allow what I want to do but in order to comply with the rules I must allow the user to connect with the default client and then I can close it if I don't need it. How would I call the client and take it's connection so I can close it o

NameError: name 'maketrans' is not defined, pythonchallenge

2008-06-24 Thread cirfu
im doing the python challenge and well, i solved this problem with ruby :) phrase = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj." puts phra

Re: Python 3000 vs Perl 6

2008-06-24 Thread Michele Simionato
On Jun 24, 5:11 pm, [EMAIL PROTECTED] wrote: > Well chosen restrictions sometimes are very useful, they may act like > a scaffolding, you can build higher constructions on them (Python has > no macros, this is a restriction. But this restriction has some > advantages. One of the main advantages is

Python-URL! - weekly Python news and links (Jun 24)

2008-06-24 Thread Gabriel Genellina
QOTW: "I find that eloquent Python speakers often tend to write a for loop when mere good ones will try to stick a list comprehension in!" - Arnaud Delobelle http://groups.google.com/group/comp.lang.python/msg/dfc72ea32f1f9c91 The first beta release of Python 3.0 is out (jointly with

Re: NameError: name 'maketrans' is not defined, pythonchallenge

2008-06-24 Thread cirfu
from string import maketrans ok but how can i write: pattern = maketrans('A-XY-Za-xy-z', 'C-ZA-Bc-za-b') pattern = maketrans('A-Za-z', 'C-Bc-b') none works -- http://mail.python.org/mailman/listinfo/python-list

Re: NameError: name 'maketrans' is not defined, pythonchallenge

2008-06-24 Thread cirfu
import string text = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj." table = string.maketrans(string.ascii_lowercase, string.ascii_lowercase[

shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":

2008-06-24 Thread cirfu
if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz": cant i write something like: if char in "[A-Za-z]": ? -- http://mail.python.org/mailman/listinfo/python-list

Re: String question

2008-06-24 Thread Terry Reedy
[EMAIL PROTECTED] wrote: On Jun 24, 5:38 am, "Mark Tolonen" <[EMAIL PROTECTED]> wrote: In Python 3k I believe you can put a * next to one of the variables to hold multiple arguments. That'll be aidful! IDLE 3.0b1 >>> a,b,*c=[1,2,3,4,5] >>> c [3, 4, 5] >>> a,*b,c = [1,2,3,4,5] >>> b [2, 3, 4

Re: shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":

2008-06-24 Thread Brian Victor
cirfu wrote: > if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz": > > cant i write something like: > if char in "[A-Za-z]": Either of the following should do what you want, without resorting to regular expressions: import string if char in string.letters: or if char.isalpha():

Re: shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":

2008-06-24 Thread [EMAIL PROTECTED]
On 24 juin, 20:32, cirfu <[EMAIL PROTECTED]> wrote: > if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz": > > cant i write something like: > if char in "[A-Za-z]": > Nope. But there are other solutions. Here are two: # 1 import string if char in string.letters: print "yay" # 2

Re: NameError: name 'maketrans' is not defined, pythonchallenge

2008-06-24 Thread Guilherme Polo
On Tue, Jun 24, 2008 at 3:11 PM, cirfu <[EMAIL PROTECTED]> wrote: > from string import maketrans > > ok but how can i write: > pattern = maketrans('A-XY-Za-xy-z', 'C-ZA-Bc-za-b') > pattern = maketrans('A-Za-z', 'C-Bc-b') > none works maketrans doesn't work like that, you would need something l

Re: sending executable data over network..

2008-06-24 Thread Terry Reedy
Piyush Anonymous wrote: any idea or pointer how i could link it to running code in server? for example, i get a new method definition for a method and i wish to change it. client sent new definition, i compile it in server. how can i link it to old code? Code to be hot-updated (while runnin

Re: Using Python and MS-SQL Server

2008-06-24 Thread Ed Leafe
On Jun 23, 2008, at 11:10 AM, [EMAIL PROTECTED] wrote: The current script that I am working on requires pulling in some information from a Microsoft SQL Server. I was wondering if anyone could suggest the best way of doing this? I have looked at the different modules that are specific to SQL s

Re: shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":

2008-06-24 Thread Guilherme Polo
On Tue, Jun 24, 2008 at 3:47 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On 24 juin, 20:32, cirfu <[EMAIL PROTECTED]> wrote: >> if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz": >> >> cant i write something like: >> if char in "[A-Za-z]": >> > > Nope. But there are other sol

Re: binary representation of an integer

2008-06-24 Thread Terry Reedy
[EMAIL PROTECTED] wrote: On Jun 24, 10:38 am, Mark Dickinson <[EMAIL PROTECTED]> wrote: Interestingly, unlike hex and oct, bin doesn't add a trailing 'L' for longs: bin(13L) '0b1101' I wonder whether this is a bug... Strange in 2.6, but I know at least in 3.0 that all integers are C

Python on Gcc llvm

2008-06-24 Thread Marco Bazzani
I would like to point you to this post readed some days ago got from planet python I search inside this group but I didn't find anything related (am I wrong?) anyway here it is, http://sayspy.blogspot.com/2008/06/i-cant-build-python-using-llvm.html I've more or less the same questions reported in t

Re: percent string replacement with index

2008-06-24 Thread Terry Reedy
Ulrich Eckhardt wrote: What I'm surprised is that this isn't supported: "%(1)s %(2)s" % ("zero", "one", "two") i.e. specifying the index in a sequence instead of the key into a map (maybe I would use [1] instead of (1) though). Further, the key can't be a simple number it seems, which make

Re: sending executable data over network..

2008-06-24 Thread Piyush Anonymous
assuming security is not of concern at the moment, how can i add in update capability? please help me out or show some pointers to look into. i wish to change the way the method definition of a class at run time in a running server (actually i m planning to support many changes at run time). new

Re: shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":

2008-06-24 Thread Walter Cruz
another way: import string if char in string.ascii_letters: print('hello buddy!') []'s - Walter -- http://mail.python.org/mailman/listinfo/python-list

Wrap Numpy with Cython?

2008-06-24 Thread martin . nordstrom87
Hi! I'm trying to wrap numpy with Cython and I've tried to use this guide to manage this: http://wiki.cython.org/WrappingNumpy However when I send an array to mysum() it gives me the right answer only when dtype of the array is float, otherwise it gives me random answers. The problem may be that th

Re: Wrap Numpy with Cython?

2008-06-24 Thread Robert Kern
[EMAIL PROTECTED] wrote: Hi! I'm trying to wrap numpy with Cython and I've tried to use this guide to manage this: http://wiki.cython.org/WrappingNumpy However when I send an array to mysum() it gives me the right answer only when dtype of the array is float, otherwise it gives me random answers.

newb question on strings

2008-06-24 Thread regex_jedi
ok, I have looked a lot of places, and can't seem to get a clear answer... I have a string called each_theme Some values of the string may contain a single quote as in - Happy Sad Nice Frank's Laundry Explosion Notice that the 4th value has a single quote in it. Well, I need to

Re: newb question on strings

2008-06-24 Thread [EMAIL PROTECTED]
Are you trying to escape for a regular expression? Just do re.escape(). >>> print re.escape('Happy') Happy >>> print re.escape("Frank's Diner") Frank\'s\ Diner If you're escaping for URLs, there's urllib2.quote(), for a command line, use subprocess.list2cmdline. Generally, the module that consu

Re: percent string replacement with index

2008-06-24 Thread Matimus
On Jun 24, 12:26 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Ulrich Eckhardt wrote: > > What I'm surprised is that this isn't supported: > > >   "%(1)s %(2)s" % ("zero", "one", "two") > > > i.e. specifying the index in a sequence instead of the key into a map (maybe > > I would use [1] instead of

logging module's documentation lies?

2008-06-24 Thread [EMAIL PROTECTED]
Quote from the docs: FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s" logging.basicConfig(format=FORMAT) d = {'clientip': '192.168.0.1', 'user': 'fbloggs'} logging.warning("Protocol problem: %s", "connection reset", extra=d) would print something like 2006-02-08

Sequence iterators with __index__

2008-06-24 Thread schickb
I think it would be useful if iterators on sequences had the __index__ method so that they could be used to slice sequences. I was writing a class and wanted to return a list iterator to callers. I then wanted to let callers slice from an iterator's position, but that isn't supported without creat

Re: shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":

2008-06-24 Thread MRAB
On Jun 24, 7:59 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > On Tue, Jun 24, 2008 at 3:47 PM, [EMAIL PROTECTED] > > > > <[EMAIL PROTECTED]> wrote: > > On 24 juin, 20:32, cirfu <[EMAIL PROTECTED]> wrote: > >> if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz": > > >> cant i write

Re: shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":

2008-06-24 Thread John Machin
On Jun 25, 4:32 am, cirfu <[EMAIL PROTECTED]> wrote: > if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz": > > cant i write something like: > if char in "[A-Za-z]": You can write that if you want to, but it's equivalent to if char in "zaZa]-[": i.e. it doesn't do what you want.

Python libraries for log mining and event abstraction? (possibly OT)

2008-06-24 Thread felciano
Hi -- I am trying to do some event abstraction to mine a set of HTTP logs. We have a pretty clean stateless architecture with user IDs that allows us to understand what is retrieved on each session, and should allow us to detect the higher-order user activity from the logs. Ideally I'd love a pyth

Re: The Importance of Terminology's Quality

2008-06-24 Thread John W Kennedy
David Combs wrote: passing *unnamed* functions as args (could Algol 60 also do something like that, via something it maybe termed a "thunk") No, the "thunks" were necessary at the machine-language level to /implement/ ALGOL 60, but they could not be expressed /in/ ALGOL. -- John W. Kennedy

Re: Sequence iterators with __index__

2008-06-24 Thread Matimus
On Jun 24, 3:29 pm, schickb <[EMAIL PROTECTED]> wrote: > I think it would be useful if iterators on sequences had the __index__ > method so that they could be used to slice sequences. I was writing a > class and wanted to return a list iterator to callers.  I then wanted > to let callers slice from

Re: logging module's documentation lies?

2008-06-24 Thread Matimus
On Jun 24, 2:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Quote from the docs: > >     FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s" >     logging.basicConfig(format=FORMAT) >     d = {'clientip': '192.168.0.1', 'user': 'fbloggs'} >     logging.warning("Protocol problem:

Re: Passing arguments to subclasses

2008-06-24 Thread Michael Mabin
But if you couldn't find readily available confirmation of what you presumed to be true, weren't the responses showing how you might come that answer using the interpreter helpful, rather than harsh? The Python interpreter is the shizzit. On Mon, Jun 23, 2008 at 12:17 PM, John Dann <[EMAIL PROTECT

Re: shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":

2008-06-24 Thread s0suk3
On Jun 24, 5:36 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jun 25, 4:32 am, cirfu <[EMAIL PROTECTED]> wrote: > > > if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz": > > > cant i write something like: > > if char in "[A-Za-z]": > > You can write that if you want to, but it's eq

Re: Sequence iterators with __index__

2008-06-24 Thread schickb
On Jun 24, 3:45 pm, Matimus <[EMAIL PROTECTED]> wrote: > > > I think it would be useful if iterators on sequences had the __index__ > > method so that they could be used to slice sequences. I was writing a > > class and wanted to return a list iterator to callers.  I then wanted > > to let callers

Porn Addiction

2008-06-24 Thread Hughjar700
Help, I'm addicted to porn. I've been downloading porn online and masturbating to it for a few years... Lately it's gotten even worse, I spend hours and hours surfing and masturbating to it. It's taking over my life and ruining everything.. I even missed days from work because of this addiction. I

Re: Porn Addiction

2008-06-24 Thread mikecdj
On Jun 24, 7:24 pm, [EMAIL PROTECTED] wrote: > Help, I'm addicted to porn. I've been downloading porn online and > masturbating to it for a few years... Lately it's gotten even worse, I > spend hours and hours surfing and masturbating to it. It's taking over > my life and ruining everything.. I eve

Re: shorten this: if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz":

2008-06-24 Thread John Machin
On Jun 25, 9:06 am, [EMAIL PROTECTED] wrote: > On Jun 24, 5:36 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > On Jun 25, 4:32 am, cirfu <[EMAIL PROTECTED]> wrote: > > > > if char in "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz": > > > > cant i write something like: > > > if char in "[A-Z

Re: Sequence iterators with __index__

2008-06-24 Thread Terry Reedy
schickb wrote: On Jun 24, 3:45 pm, Matimus <[EMAIL PROTECTED]> wrote: I think it would be useful if iterators on sequences had the __index__ method so that they could be used to slice sequences. I was writing a class and wanted to return a list iterator to callers. I then wanted to let caller

how to convert '8868' to u'\u8868'

2008-06-24 Thread CodeHunter
a = '8868' b = u'\u8868' I want to convert a to b who can help me ? thank you very much! -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >