Re: THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON. (e-mail get by the list moderator)

2012-01-15 Thread Steven D'Aprano
On Mon, 16 Jan 2012 09:03:54 +0300, _ wrote: > # THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON: Worddr = "56" # CREATE > A STRING: "56" Word = ["12"] # CREATE A LIST WITH ONE SIGNED: "12" Word > = Word.append("34") ... Do you have a question, or are you just dumping a lot of noise in one post

Re: THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON. (e-mail get by the list moderator)

2012-01-15 Thread alex23
On Jan 16, 4:03 pm, "_" wrote: > # THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON: > Word = Word.append("34") # APPEND TO LIST ONE MORE SIGNED: "34" list.append is an in-place operation; it doesn't return a copy of the list, so here you're setting Word to None. -- http://mail.python.org/mailman/

Re: understanding a program project

2012-01-15 Thread alex23
On Jan 14, 6:29 am, Tracubik wrote: > I remember at school time there was some schema or something to create to > display the interaction of different functions / modules > > My idea was to create a model with all the methods and arrows to link > they... Do you mean call graphs? http://pycallgrap

THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON. (e-mail get by the list moderator)

2012-01-15 Thread _
# THAT WHAT NEED EXPECT FROM OPERATORS OF PYTHON: Worddr = "56" # CREATE A STRING: "56" Word = ["12"] # CREATE A LIST WITH ONE SIGNED: "12" Word = Word.append("34") # APPEND TO LIST ONE MORE SIGNED: "34" Word = Word + "34" # MUST APPEND TO LIST ONE MORE SIGNED: "34" Wordpr = Word[1] # MUST SIGNED

Re: Problem while doing a cat on a tabbed file with pexpect

2012-01-15 Thread Michael Torrie
On 01/15/2012 05:11 PM, Saqib Ali wrote: > > Very good question. Let me explain why I'm not opening me.txt directly > in python with open. > > The example I have posted is simplified for illustrative purpose. In > reality, I'm not doing pexpect.spawn("/bin/tcsh"). I'm doing > pexpect.spawn("ssh m

Re: PyWarts: time, datetime, and calendar modules

2012-01-15 Thread Michael Torrie
On 01/14/2012 10:27 PM, Rick Johnson wrote: > Face it, Guido has broken Python's cherry. She is no longer pure. > You're acting like some over- protective father. WAKE UP! Python is a > promiscuous little whore and she's on girls gone wild (Volume 4000) > shaking her little money maker. We should a

Re: Problem while doing a cat on a tabbed file with pexpect

2012-01-15 Thread Steven D'Aprano
On Sun, 15 Jan 2012 09:51:44 -0800, Saqib Ali wrote: > I am using Solaris 10, python 2.6.2, pexpect 2.4 Are you sure about that? As far as I can see, pexpect's current version is 2.3 not 2.4. > I create a file called me.txt which contains the letters "A", "B", "C" > on the same line separated

Re: Problem while doing a cat on a tabbed file with pexpect

2012-01-15 Thread Cameron Simpson
On 15Jan2012 16:14, Saqib Ali wrote: | The file me.txt does indeed contain tabs. I created it with vi. | | >>> text = open("me.txt", "r").read() | >>> print "\t" in text | True | | % od -c me.txt | 000 A \t B \t C \n | 006 | | % ls -al me.txt | -rw-r--r-- 1 myUsermyGroup

Re: Two questions about logging

2012-01-15 Thread Vinay Sajip
On Jan 12, 2:19 am, Matthew Pounsett wrote: > First, I'd like to be able to permit users to do more typical log > rotation, based on their OS's log rotation handler, rather than > rotating logs from inside an application.  This is usually handled by > signalling an application with a HUP, whereup

Re: Problem while doing a cat on a tabbed file with pexpect

2012-01-15 Thread Saqib Ali
The file me.txt does indeed contain tabs. I created it with vi. >>> text = open("me.txt", "r").read() >>> print "\t" in text True % od -c me.txt 000 A \t B \t C \n 006 % ls -al me.txt -rw-r--r-- 1 myUsermyGroup 6 Jan 15 12:42 me.txt On Jan 15, 6:40 pm, Cameron Simp

Re: Problem while doing a cat on a tabbed file with pexpect

2012-01-15 Thread Saqib Ali
Very good question. Let me explain why I'm not opening me.txt directly in python with open. The example I have posted is simplified for illustrative purpose. In reality, I'm not doing pexpect.spawn("/bin/tcsh"). I'm doing pexpect.spawn("ssh myuser@ipaddress"). Since I'm operating on a remote syst

Re: Problem while doing a cat on a tabbed file with pexpect

2012-01-15 Thread Cameron Simpson
On 15Jan2012 23:04, Steven D'Aprano wrote: | On Sun, 15 Jan 2012 09:51:44 -0800, Saqib Ali wrote: | > I am using Solaris 10, python 2.6.2, pexpect 2.4 | > | > I create a file called me.txt which contains the letters "A", "B", "C" | > on the same line separated by tabs. | [...] | > Now, clearly t

Re: Problem while doing a cat on a tabbed file with pexpect

2012-01-15 Thread Steven D'Aprano
On Sun, 15 Jan 2012 09:51:44 -0800, Saqib Ali wrote: > I am using Solaris 10, python 2.6.2, pexpect 2.4 > > I create a file called me.txt which contains the letters "A", "B", "C" > on the same line separated by tabs. [...] > Now, clearly the file contains tabs. That is not clear at all. How do y

Re: why i can get nothing?

2012-01-15 Thread Robert Helmer
On Sat, Jan 14, 2012 at 7:54 PM, contro opinion wrote: > here is my code : > import urllib > import lxml.html > down='http://download.v.163.com/dl/open/00DL0QDR0QDS0QHH.html' > file=urllib.urlopen(down). > read() > root=lxml.html.document_fromstring(file) > tnodes = root.xpath("//a/@href[contains(

Re: why i can get nothing?

2012-01-15 Thread Roy Smith
In article , Chris Rebert wrote: > On Sun, Jan 15, 2012 at 7:40 AM, Jason Friedman wrote: > >> here is my code : > >> import urllib > >> import lxml.html > > > What version of python is this?  Based on the naked "print" I guess > > 2.x, and I got: > > import lxml.html > > Traceback (mos

Re: why i can get nothing?

2012-01-15 Thread Chris Rebert
On Sun, Jan 15, 2012 at 7:40 AM, Jason Friedman wrote: >> here is my code : >> import urllib >> import lxml.html > What version of python is this?  Based on the naked "print" I guess > 2.x, and I got: import lxml.html > Traceback (most recent call last): >  File "", line 1, in > ImportErro

Problem while doing a cat on a tabbed file with pexpect

2012-01-15 Thread Saqib Ali
I am using Solaris 10, python 2.6.2, pexpect 2.4 I create a file called me.txt which contains the letters "A", "B", "C" on the same line separated by tabs. My shell prompt is "% " I then do the following in the python shell: >>> import pexpect >>> x = pexpect.spawn("/bin/tcsh") >>> x.sendline

Re: Hash stability

2012-01-15 Thread Stefan Behnel
Chris Angelico, 15.01.2012 17:13: > Of course, it's still dodgy to depend on the stability of something > that isn't proclaimed stable, and would be far better to use some > other hashing algorithm (MD5 or SHA for uberreliability). I've seen things like MD5 or SHA* being used quite commonly for fi

Re: Hash stability

2012-01-15 Thread Heiko Wundram
Am 15.01.2012 17:13, schrieb Chris Angelico: On Mon, Jan 16, 2012 at 3:07 AM, Heiko Wundram wrote: I don't know the prevalence of suds, but I guess there's more people than me using it to query SOAP-services - all of those will be affected if the hash() output is changed. Additionally, if hash(

Re: Hash stability

2012-01-15 Thread Chris Angelico
On Mon, Jan 16, 2012 at 3:07 AM, Heiko Wundram wrote: > I don't know the prevalence of suds, but I guess there's more people than me > using it to query SOAP-services - all of those will be affected if the > hash() output is changed. Additionally, if hash() isn't stable between runs > (the randomi

Re: Hash stability

2012-01-15 Thread Heiko Wundram
Am 15.01.2012 13:22, schrieb Peter Otten: Heiko Wundram wrote: I agree completely with that (I hit the corresponding problem with suds while transitioning from 32-bit Python to 64-bit Python, where hashes aren't stable either), but as stated in my mail: that wasn't the original question. ;-) I

Re: why i can get nothing?

2012-01-15 Thread Jason Friedman
> here is my code : > import urllib > import lxml.html > down='http://download.v.163.com/dl/open/00DL0QDR0QDS0QHH.html' > file=urllib.urlopen(down). > read() > root=lxml.html.document_fromstring(file) > tnodes = root.xpath("//a/@href[contains(string(),'mp4')]") > for i,add in enumerate(tnodes): >  

Re: PyWarts: time, datetime, and calendar modules

2012-01-15 Thread Lie Ryan
On 01/15/2012 06:23 AM, Rick Johnson wrote: So how do we solve this dilemma you ask??? Well, we need to "mark" method OR variable names (OR both!) with syntactic markers so there will be NO confusion. Observe: def $method(self):pass self.@instanceveriable self.@@classvariable There is

Re: problem:emulate it in python with mechanize

2012-01-15 Thread Kev Dwyer
contro opinion wrote: > you can do it by hand , > 1.open > http://www.flvcd.com/' > 2.input > http://v.163.com/movie/2008/10/O/Q/M7F57SUCS_M7F5R3DOQ.html > 3.click submit > you can get > http://mov.bn.netease.com/movie/2012/1/V/7/S7MKQOBV7.flv > > i want to emulate it in python with mechanize

problem:emulate it in python with mechanize

2012-01-15 Thread contro opinion
you can do it by hand , 1.open http://www.flvcd.com/' 2.input http://v.163.com/movie/2008/10/O/Q/M7F57SUCS_M7F5R3DOQ.html 3.click submit you can get http://mov.bn.netease.com/movie/2012/1/V/7/S7MKQOBV7.flv i want to emulate it in python with mechanize,here is my code ,why i can't get the rig

Re: Hash stability

2012-01-15 Thread Peter Otten
Heiko Wundram wrote: > Am 15.01.2012 11:13, schrieb Stefan Behnel: >> That's a stupid design. Using a hash function that the application does >> not control to index into persistent storage just screams for getting the >> code broken at some point. > > I agree completely with that (I hit the corr

Re: Hash stability

2012-01-15 Thread Chris Angelico
On Sun, Jan 15, 2012 at 11:03 PM, Bryan wrote: > Chris Angelico wrote: >> Suggestion: Create a subclass of dict, the SecureDict or something, >> ... there's no point adding extra load to every >> name lookup just because of a security issue in an extremely narrow >> situation. > > That seemingly "

Re: Hash stability

2012-01-15 Thread Bryan
Chris Angelico wrote: > Suggestion: Create a subclass of dict, the SecureDict or something, > which could either perturb the hashes or even use a proper > cryptographic hash function; normal dictionaries can continue to use > the current algorithm. The description in Objects/dictnotes.txt > suggest

Re: Hash stability

2012-01-15 Thread Heiko Wundram
Am 15.01.2012 11:13, schrieb Stefan Behnel: That's a stupid design. Using a hash function that the application does not control to index into persistent storage just screams for getting the code broken at some point. I agree completely with that (I hit the corresponding problem with suds while

Re: Extension module question

2012-01-15 Thread Stefan Behnel
Evan Driscoll, 15.01.2012 08:37: > As I hinted at in an earlier email, I'm working on a module which will > allow calling readdir() (and FindFirstFile on Windows, hopefully pretty > uniformly) from Python. The responses I got convinced me that it was a > good idea to write a C-to-Python bridge as a

Re: defining class and subclass in C

2012-01-15 Thread Stefan Behnel
Daniel Franke, 14.01.2012 22:15: > I spent some days and nights on this already and my google-fu is running out. > I'd like to implement the equivalent of this Python code in a C-extension: > > >>> class A(object): > pass > >>> class B(A): > pass > >>> A > > >>> B > > >>> B.__bases__

Re: Hash stability

2012-01-15 Thread Stefan Behnel
Heiko Wundram, 14.01.2012 23:45: > Am 14.01.2012 10:46, schrieb Peter Otten: >> Steven D'Aprano wrote: >>> How many people rely on hash(some_string) being stable across Python >>> versions? Does anyone have code that will be broken if the string hashing >>> algorithm changes? >> >> Nobody who under