Re: Getting rid of virtual environments with a better dependency system

2020-11-11 Thread j c
On Wednesday, 11 November 2020 at 12:22:24 UTC+1, Chris Angelico wrote: > On Wed, Nov 11, 2020 at 10:06 PM j c wrote: > > > > Hello all, > > > > I don't know if this suggestion is missing some point, or it's part of > > something already propos

Re: Human readable number formatting

2005-09-27 Thread J Correia
"Alex Willmer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > When reporting file sizes to the user, it's nice to print '16.1 MB', > rather than '16123270 B'. This is the behaviour the command 'df -h' > implements. There's no python function that I could find to perform this > format

Re: Searching for txt file and importing to ms access

2005-10-21 Thread J Correia
"Mark Line" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello! > > > I've also managed to connect to my access database, and just print out a > field in a table, but I cant find anywhere on the web that will help me to > import data? Any help would be great?! > > Another meth

Re: Pregunta sobre python

2005-11-14 Thread J Correia
Para Windows: import win32api handle = win32api.OpenProcess(1, False, pid_del_proceso) win32api.TerminateProcess(handle, -1) win32api.CloseHandle(handle) "Yves Glodt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Andres de la Cuadra wrote: > > Hola, me llamo Andres de la cuadra,

Re: how to start a process and get it's pid?

2005-11-14 Thread J Correia
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Fredrik Lundh wrote: > > Daniel Crespo wrote: > >>os.spawnl(os.P_NOWAIT, "c:/windows/notepad.exe") > >>>1944 > >> > >>I don't get the correct PID. > >> > >>When I do os.spawnl(os.P_NOWAIT, "c:/windows/notepad.exe") >

Python Guru Needed Fast!!!!

2005-11-30 Thread j-rock
Talking Panda LLC is looking for a programmer to take over building applications for the iPod. Required skills below. Please email me personally. [EMAIL PROTECTED] - Expertise in text parsing and formatting. Specifically, developing parsers to extract meaningful information from freeform text, XM

Re: get the IP address of a host

2005-01-06 Thread J Berends
Lee Harr wrote: I found that the socket solutions only work if your DNS entries are correct ... which in my case was not true. So I came up with this: That is indeed correct, and even if the DNS entries are correct at times it does not give the full list of IPs by gethostbyname or gethostbyaddr.

sorting on keys in a list of dicts

2005-01-06 Thread J Berends
Suppose I have a list of dictionaries and each dict has a common keyname with a (sortable) value in it. How can I shuffle their position in the list in such way that they become sorted. Maybe I am doing it wrongly and you would say: why don't you get yourself a (slimmed-down) implementation of

Re: sorting on keys in a list of dicts

2005-01-06 Thread J Berends
Jp Calderone wrote: On Thu, 06 Jan 2005 15:31:22 +0100, J Berends <[EMAIL PROTECTED]> wrote: Suppose I have a list of dictionaries and each dict has a common keyname with a (sortable) value in it. How can I shuffle their position in the list in such way that they become sorted. In

Re: get the IP address of a host

2005-01-06 Thread J Berends
Jp Calderone wrote: On Thu, 06 Jan 2005 14:35:16 +0100, J Berends <[EMAIL PROTECTED]> wrote: From several approached I came up with the following code: def getipaddr(hostname='default'): """Given a hostname, perform a standard (forward) lookup and return

Re: login website that using PHP

2005-06-20 Thread J Correia
"frost" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I am trying to login a website that using PHP and javascript. This is > what happend if you browse that website using IE, after you login, you > can go anywhere without enter your name and password again, as long as > you

J-Integra for COM (Java COM interoperability)

2005-07-18 Thread j-integra_support
Looking for Java/COM interoperability tools? Thousands of companies world-wide are using J-Integra for COM for interoperability between Java and Microsoft COM applications. J-Integra for COM is a pure Java implementation of the DCOM protocol, making it several times faster than Web Services. J

Re: Using win32com for web automation

2005-07-26 Thread J Correia
> from win32com.client import Dispatch > from time import sleep > > ie = Dispatch('InternetExplorer.Application') > ie.Visible = 1 > ie.Navigate("http://ispds-sepsr.prv:7500/cs/welcome.jsp";) > > while ie.ReadyState != 4: > sleep(1) > > doc = ie.Document > > while doc.readyState != "complete":

Python 2.4 Tix failing on Windows XP

2004-12-09 Thread j vickroy
Hello, I've just installed (accepted all installation defaults) Python 2.4 (final) on my Microsoft Windows XP (home edition - service pack 2) computer, and I am experiencing the following behavior regarding Tix: >>> import sys >>> sys.version '2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit

Re: [Newby] Problem with compilation.

2004-12-09 Thread j vickroy
The Python modules documentation indicates crypt is only available on Unix platforms. <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi folks! > > Can't compile my file due to some problems with crypt module. > My platform is WinXP: > First I launch my Python Shell, > Than I open th

Re: Python 2.4 Tix failing on Windows XP

2004-12-09 Thread j vickroy
Ok, that indeed did work. Thanks for your help. "Michael Auerswald" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ok, problem solved, more or less. What happens is that Tcl isnt looking > for the Tix DLL along the python path nor is it looking along the > os.environ path, but

Re: How to get rid of FutureWarning: hex/oct constants...

2005-04-05 Thread J Correia
Assuming you're just trying to get rid of the message each time the program runs, the following suppresses it: import warnings warnings.filterwarnings('ignore', category=FutureWarning) HTH, -- http://mail.python.org/mailman/listinfo/python-list

Re: 'Address already in use' when using socket

2005-04-08 Thread J Berends
Peter Hansen wrote: Bearish wrote: I get 'Address already in use' errors when using sockets. Generally one can fix this using: sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) where "sock" is the server socket in question. Do this prior to attempting to bind to the port. -Peter I agree

Re: Internet Explorer, COM+, Javascript and Python

2005-04-28 Thread J Correia
"Roger Upole" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Something like this should be close: > > import win32com.client, pythoncom > ie=win32com.client.Dispatch('internetexplorer.application') > ie.Visible=1 > ie.Navigate('somepagewithjavascript.html') > id=ie.Document.Script._

Total Python Newbie needs geting started info.

2013-11-20 Thread Ev J
I am learning Python and wish to develop GUI applications to run on Windows. I have installed the Visual Studio integrated shell (Ver. 12.0.21005.1 REL) IDE and the Python 3.3 interpreter. I have gone through some of the 3.3 tutorial available at http://docs.python.org/3.3/tutorial/. The tutoria

Registry Key Value Help

2014-01-02 Thread J. McGaha
Good evening, I am a complete noob at Python. I am attempting to create a key and update its value. The code below is what I have come up with after reading everything I can get my hands on. When I run the this code I get an error that says the 'int' can't be called. I appreciate your h

Re: Python, C++ interaction

2014-12-07 Thread Gayathri J
Cython and number it is... they definitely rule! But of course I am also interfacing my python code (with all the structuring and UI and object orientation) with some sse and fortran. if u can get a grip of programming fortran/sse, they work too On 12/7/14, Mark Lawrence wrote: > On 07/12/2014

Getting a stable virtual env

2014-02-17 Thread P J
Hi ppl, I'm trying to figure out the whole virtualenv story. Right now I'm using it to creating an environment for our upcoming debian upgrade to squeeze. I'm doing some tests in our current distrib (python 2.5). I have come to realize that a lot of packages in the version I'm interested in are n

[no subject]

2014-03-17 Thread J Prashanthan
i am doing my masters currently and im stuck up with my final project. As i was interested in learning a new language i opted to do my final project in python. im currently working on building an unit tester for multithreaded code. Due to various reasons i got stuck with my project. basically my la

removing BOM prepended by codecs?

2013-09-24 Thread J. Bagg
I'm having trouble with the BOM that is now prepended to codecs files. The files have to be read by java servlets which expect a clean file without any BOM. Is there a way to stop the BOM being written? It is seriously messing up my work as the servlets do not expect it to be there. I could d

removing BOM prepended by codecs?

2013-09-24 Thread J. Bagg
then edited. The files use a whole variety of languages from Sanskrit to Cyrillic and more obscure ones too. I'll probably have to remove it in the servlet as we have standardised on utf-8. This was done some years ago when utf-16 was rare (apart from Macs). J -- https://mail.python.org/mailman/listinfo/python-list

removing BOM prepended by codecs?

2013-09-24 Thread J. Bagg
inly there: <86> %R 10C0203z-621 %A François-Xavier Le_Bourdonnec 000 206 255 373 % R 1 0 C 0 2 0 3 z - J -- https://mail.python.org/mailman/listinfo/python-list

removing BOM prepended by codecs?

2013-09-24 Thread J. Bagg
process of updating this to Python as it is getting too difficult to maintain. J -- https://mail.python.org/mailman/listinfo/python-list

removing BOM prepended by codecs?

2013-09-25 Thread J. Bagg
So it is just a random sequence of "junk". It will be a matter of finding the real start of the record (in this case a %) and throwing the "junk" away. I was misled by the note in the codecs class that BOMs were being prepended. Should have looked more carefully. Mea culpa. -- https://mail.

RE: Python-list Digest, Vol 131, Issue 6

2014-08-05 Thread J Prashanthan
Sent from my Windows Phone From: python-list-requ...@python.org Sent: ‎05-‎08-‎2014 15:37 To: python-list@python.org Subject: Python-list Digest, Vol 131, Issue 6 Send Python-list mailing list submissions to python-list@python.org To subscribe or unsubscribe via the World Wide Web, visit

Re: Pythonic way to iterate through multidimensional space?

2014-08-05 Thread Gayathri J
loop"* *python_dot_loop1(f,times,N)* *print "nested loop using itertools.product()"* *python_dot_loop2(f,times,N)* *def python_dot_loop1(f,times,N):* *for t in range(times):* * t1=time.time()* * for i in range(N):* * for j in range(N):* *

Re: Pythonic way to iterate through multidimensional space?

2014-08-06 Thread Gayathri J
Dear Peter Yes the f[t] or f[:,:,:] might give a marginal increase, but then i need to do further operations using the indices, in which case this wouldnt help Dear Wojciech np.flat() works if u dont care about the indices and only the matrix/array values matter. but if the matters, flatten

Re: Pythonic way to iterate through multidimensional space?

2014-08-06 Thread Gayathri J
loops and not to distract us to the operation done inside the loop. right? On Wed, Aug 6, 2014 at 6:09 PM, Peter Otten <__pete...@web.de> wrote: > Gayathri J wrote: > > > Dear Peter > > > > Yes the f[t] or f[:,:,:] might give a marginal increase, > > The spe

Re: what is the easiest way to install multiple Python versions?

2014-10-12 Thread Gayathri J
I have been using Anaconda's (Continnum) conda installation for system installation (python 2.7) and for python 3 conda lets us maintain diferent environments with different python and different combinations of other packages like numpy etc... sure not to disappoint! On 10/12/14, Albert-Jan Ros

Re: executable builder

2011-12-12 Thread J A
I am having some issues compiling an exe myself but most of that stems from the version of python I am using. That being said, try using GUI2EXE http://code.google.com/p/gui2exe this program makes the setup file go a lot easier, also it will tie in a few different tools like py2exe which is wha

syslog best practices -- when to call closelog?

2006-07-10 Thread J Rice
I have a question: When should syslog.closelog() be called? I have a daemon that spends most of its time asleep and quiet, but writes messages to the mail log when active. Should I open the log at the start and keep it open until the program closes? This seems much simpler than issuing three c

HowTo feed AcctName and Password into a website via HTTP

2007-01-01 Thread J. Richards
I'm doing QA testing of a WebApp. First step before crawling the links is to enter the two texts mentioned. Do I extract the login page using: import sys, os, urllib, urlparse Then figure out the HTTP string and then feed that into a HTTP Post ? Or do I use Forms, CGI or Pamie ?? Whats the

Re: Webbrowser On Windows

2005-05-01 Thread J Correia
><[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >It seems to me that there is no way to create a new instance of Internet >Explorer (if there are already some IE windows opened). >Does anyone know a possible solution? Or a workaround (without using >startfile, maybe?) that will force I

Re: Webbrowser On Windows

2005-05-02 Thread J Correia
"M.E.Farmer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I played around with it. > > import pythoncom > from win32com.client import Dispatch > ###

Re: How to receive events (eg. user mouse clicks) from IE

2005-05-20 Thread J Correia
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks for the response again. The solution is pretty close but not yet > complete > This is what I observed. > a) I tried to use the delay mechanism as suggested below > ie. > ie.Navigate('www.google.com') > while ie.ReadyState !- 4 >

Re: How to receive events (eg. user mouse clicks) from IE

2005-05-21 Thread J Correia
"Roger Upole" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > There does appear to be some sort of conflict between the two event > hooks. I wasn't seeing it before since IE was getting google from my > browser cache and it was coming up almost instantaneously. As soon > as I switch

Re: Access lotus notes using Python

2005-05-23 Thread J Correia
> >>The Great 'Sateesh' uttered these words on 5/23/2005 7:14 AM: > >>>Is it possible to access Lotus notes using Python? Can anyone provide me > >>>some pointers? This might help you get started once you've installed the win32 modules. http://tinyurl.com/a9ocy -- http://mail.python.org/mail

Re: Pressing A Webpage Button

2005-06-01 Thread J Correia
"Elliot Temple" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How do I make Python press a button on a webpage? I looked at > urllib, but I only see how to open a URL with that. I searched > google but no luck. > > For example, google has a button how would i make a script to

Re: Pressing A Webpage Button

2005-06-03 Thread J Correia
"Esben Pedersen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How do i know which methods the ie object has? dir(ie) doesn't show > Navigate. For ie object: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/ifaces/IWebBrowser2/IWebBrowser2.asp For document object: h

Re: separate IE instances?

2005-06-06 Thread J Correia
"Chris Curvey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I need to create a set of IE instances that have different sets of > session cookies. I thought that using the win32com.DispatchEx function > would do this, but it doesn't seem to. In other words > > ie1 = win32com.Dispa

Re: separate IE instances?

2005-06-07 Thread J Correia
'll hunt around and see if I can find a solution which I'll post back. J -- http://mail.python.org/mailman/listinfo/python-list

Re: separate IE instances?

2005-06-07 Thread J Correia
from the Start menu. (Of course, that doesn't > > mean that I can launch them programmatically, but I'm hoping that > > someone can give me a definitive answer.) > > "J Correia" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Right, I ha

Re: separate IE instances?

2005-06-07 Thread J Correia
>Chris Curvey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > thanks for all the help. I'll give the ShellExecute() approach a try > in the morning. > > The short version of what I'm trying to do is > > Have my website login to a 3rd party website on behalf of my customer, > fil

Re: How to receive events (eg. user mouse clicks) from IE

2005-06-13 Thread J Correia
> <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Resurrecting an old thread.. > > It seems that this solution does not return events on objects within > > frames in webpages eg . if you go to www.andersondirect.com - the page > > is composed of three frames called as topFrame main

Re: separate IE instances?

2005-06-13 Thread J Correia
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sorry about that I had an instance of ie running in the background that > was version 0 didn't see the problem tell this morining when my > computer started to not work. it should be hwnds[1] should be > hwnds[0]. I woud enumerate the

Re: win32evtlog

2005-06-13 Thread J Correia
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Doh! I didn't think to look in the demo directory. Silly me. > http://www.win32com.de/index.php?option=com_content&task=view&id=163&Itemid=189 -- http://mail.python.org/mailman/listinfo/python-list

Re: Determinant of Large Matrix

2007-06-06 Thread J. Robertson
James Stroud wrote: > Hello All, > > I'm using numpy to calculate determinants of matrices that look like > this (13x13): > > [[ 0. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.] [snip] > But I have a feeling I'm exceeding the capacity of floats here. Does > anyone have an idea for how to

Re: The best platform and editor for Python

2007-07-06 Thread J Sisson
On 7/6/07, Ed Jensen <[EMAIL PROTECTED]> wrote: Alex Martelli <[EMAIL PROTECTED]> wrote: > Calling all vi/vim users (and we'll heartily appreciate the support of > TextMate fans, BBEdit ones, etc, etc) -- we're at risk being defined out > of existence, since we're neither happy with Emacs nor wa

Re: How to calculate definite integral with python

2007-05-15 Thread J. Robertson
[EMAIL PROTECTED] wrote: > I'm trying to do some integral calculation. I have searched the web, but > haven't found any useful information. Will somebody point me to the > right resources on the web for this job ? > > Thanks a lot. > > ps. Can numpy be used for this job?* > * It can be done wi

Re: Need to generate some functions.

2007-08-17 Thread J. Robertson
you can use the dictionary returned by the built in function vars, along the lines of >>> vars()["foo"] = lambda x: 3*x >>> foo(2) 6 but polluting your name space with data counts as bad style and will probably bite you at some point -- you probably are better of putting closures in a dictio

Re: Co-developers wanted: document markup language

2007-08-24 Thread J. Robertson
olive wrote: >>> [snip] > > But few people are used to Plain Text Markup (excepted in some > scientific area maybe) and it is error prone. > It looks very much like Gummi's authors and target audience actually are part of the few people you are talking about: i.e. console-happy folks that ar

Re: Asking all python programmers.

2007-08-28 Thread J Sisson
On 8/28/07, Lamonte Harris <[EMAIL PROTECTED]> wrote: > > From a python starter, I don't like the word noob because it sounds very > unprofessional. > Touche`...haha I second the motion for "Dive Into Python." It's an excellent book, and you really can't beat the price (free online as Shawn has

Re: Beginners Query - Simple counter problem

2007-09-06 Thread J Sisson
Silly question, but are you importing random somewhere in that file? It works on both my XP machine and my Linux machine (both from CLI) after importing random...though it runs through this: while count <= i: i + 1 times...(You initialize count to 0, then loop over it until it hits i+1 (at which

Willa Ford Angelina Joli Paris Hilton

2007-04-14 Thread A - J
Willa Ford Angelina Joli Paris Hilton www.alphasearch.GR-- http://mail.python.org/mailman/listinfo/python-list

Re: Can you determine the sign of the polar form of a complex number?

2007-10-17 Thread J. Robertson
[EMAIL PROTECTED] wrote: > Just to clarify what I'm after: > > If you plot (-3)^n where n is a set of negative real numbers between 0 > and -20 for example, then you get a discontinuos line due to the > problem mentioned above with fractional exponents. > > .. > It looks like you crash-landed

recording sound with python

2007-11-08 Thread jesse j
Hello Everyone, I'm new to python. I have worked through some tutorials and played around with the language a little bit but I'm stuck. I want to know how I can make python run a program. More specifically, I want to get python to work with SOX to record a sound through the microphone, save the

Re: Loop three lists at the same time?

2007-11-13 Thread J. Robertson
t3 = [7,8,9] >>> for a,b,c in zip(list1,list2,list3): ...print a, b, c ... 1 4 7 2 5 8 3 6 9 hth j. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem using os.environ.get

2007-11-14 Thread J. Robertson
e too (on netbsd at least). So, that's a bash problem - not that it helps I guess :-) but bash docs may have some more info about this issue. j. -- http://mail.python.org/mailman/listinfo/python-list

Re: Seeking Python Developer

2007-11-15 Thread J. Robertson
[EMAIL PROTECTED] wrote: > Hi, I work for an IT company in Phoenix, AZ and am trying to find an > experienced python developer in the area. Can anyone help? Hi, There's a Python job board at http://www.python.org/community/jobs/ The first link on the page documents how to get your ad

How to suggest a new Python list? Was: Science list

2007-11-29 Thread J. Robertson
tea break), surely that can't hurt. Anyway, I do not see how to suggest a new mailing list on http://www.python.org/community/lists/ - does anyone know? cheers, J. -- http://mail.python.org/mailman/listinfo/python-list

Re: Science list

2007-11-30 Thread J. Robertson
ly achieved by not reading c.l.p. > > If it succeeds, you may easily get the same amount of traffic as you have now > here. > I hope you're wrong :-) How about that: anyone that care for such a mailing list please drop me a line privately. I'll report how many people do. Cheers, J -- http://mail.python.org/mailman/listinfo/python-list

Re: GUI development with 3D view

2007-12-10 Thread J. Robertson
Diez B. Roggisch wrote: > Achim Domma wrote: > [snip] >> >> Is there an alternative to wx+pyOpenGL? > > The usual suspects - mainly Qt, possibly Tk (not sure if there is a > python-available version of open gl canvasses for Tk) > > Diez togl is a Tk/OpenGL widget that can be used with python as

Re: GUI development with 3D view

2007-12-10 Thread J. Robertson
Méta-MCI (MVP) wrote: >> no idea how it works with windows. > > On XP: fine. > On Vista: very difficult... Hello Captain Obvious :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Floating point subtraction rounding error (NOT display error)

2007-12-14 Thread J. Robertson
Keflavich wrote: > [snip] > > I feel fairly certain, however, that floats are exactly what I want > for my purposes: I need moderately high precision and I'm not > concerned about the least-significant-bit errors except when they > violate function domains. I guess the overriding lesson is that e

no pass-values calling?

2008-01-15 Thread J. Peng
Hello, I saw this statement in Core Python Programming book, All arguments of function calls are made by reference, meaning that any changes to these parameters within the function affect the original objects in the calling function. Does this mean there is not pass-values calling to a function

Re: no pass-values calling?

2008-01-15 Thread J. Peng
On Jan 16, 2008 1:45 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 16 Jan 2008 11:09:09 +0800, "J. Peng" <[EMAIL PROTECTED]> > > alist = [] > anint = 2 > astr = "Touch me" > > dummy(alist, anint, astr) > > "

Re: no pass-values calling?

2008-01-15 Thread J. Peng
On Jan 16, 2008 2:30 PM, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 16 Jan 2008 13:59:03 +0800, J. Peng wrote: > > > Hi, > > > > How to modify the array passed to the function? I tried something like > > this: > > > >>>

Re: no pass-values calling?

2008-01-15 Thread J. Peng
On Jan 16, 2008 3:03 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 16 Jan 2008 13:59:03 +0800, "J. Peng" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > How to modify the array passed to the function? I tried somethi

assigning values in python and perl

2008-01-16 Thread J. Peng
I just thought python's way of assigning value to a variable is really different to other language like C,perl. :) Below two ways (python and perl) are called "pass by reference", but they get different results. Yes I'm reading 'Core python programming', I know what happened, but just a little con

Re: assigning values in python and perl

2008-01-16 Thread J. Peng
May I ask, python's pass-by-reference is passing the object's reference to functions, but perl, or C's pass-by-reference is passing the variable itself's reference to functions. So althought they're all called pass-by-reference,but will get different results.Is it? On

Re: assigning values in python and perl

2008-01-16 Thread J. Peng
On Jan 17, 2008 2:03 PM, Christian Heimes <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > Python's parameter passing is like passing a pointer in C/C++. > [snip] > > It's not (I repeat NOT) like passing a pointer in C. Please read > http://effbot.org/zone/call-by-object.htm > Yes I agree. No

Re: assigning values in python and perl

2008-01-16 Thread J. Peng
On Jan 17, 2008 1:54 PM, Mel <[EMAIL PROTECTED]> wrote: > > test(a) (along with def test(x)) takes the object named 'a' in the > current namespace and binds it with the name 'x' in function test's > local namespace. So, inside test, the name 'x' starts by referring to >the list that contains [

Re: assigning values in python and perl

2008-01-16 Thread J. Peng
On Jan 17, 2008 2:55 PM, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > > @$ref = (4, 5, 6) intentionally assigns to the same list pointed to by > the reference. That would be spelled as x[:] = [4, 5, 6] in Python. > What Python does in your example is assign the same as Perl's $ref = > [4, 5, 6]. So

array and list

2008-01-17 Thread J. Peng
what's the difference between an array and a list in python? I see list has all features of array in C or perl. so please tell me.thanks. -- http://mail.python.org/mailman/listinfo/python-list

too long float

2008-01-17 Thread J. Peng
hello, why this happened on my python? >>> a=3.9 >>> a 3.8999 I wanted 3.9 but got 3.89 How to avoid it? thanks. this is my python version: >>> sys.version '2.3.4 (#1, Feb 6 2006, 10:38:46) \n[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)]' -- http://mail.python.org/mailma

Re: too long float

2008-01-18 Thread J. Peng
thanks all! On Jan 18, 2008 3:49 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Fri, 18 Jan 2008 13:55:17 +0800, "J. Peng" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > > why this happened on my python? > &g

Re: array and list

2008-01-18 Thread J. Peng
> On Jan 18, 3:23 am, "J. Peng" <[EMAIL PROTECTED]> wrote: > >> what's the difference between an array and a list in python? >> I see list has all features of array in C or perl. >> so please tell me.thanks. >> > > If you are n

dynamic type variable

2008-01-20 Thread J. Peng
Python's variable is dynamic type,is it? But why this can't work? >>> 3 + 'a' Traceback (most recent call last): File "", line 1, in ? TypeError: unsupported operand type(s) for +: 'int' and 'str' So I see the number 3 can't be converted to string type automacially. -- http://mail.python.org/ma

Re: object scope

2008-01-20 Thread J. Peng
J. Peng 写道: > Please see the code below,what's the scope for object "name"? > I thought it should be located in the while block, but it seems not > really,it can be accessed out of while (the db[name] statement).Thanks > in advance. > > sorry the before code

object scope

2008-01-20 Thread J. Peng
Please see the code below,what's the scope for object "name"? I thought it should be located in the while block, but it seems not really,it can be accessed out of while (the db[name] statement).Thanks in advance. db = {} def newuser(): prompt = 'login desired: ' while 1: name = raw_input(prompt)

Re: Sorting a list depending of the indexes of another sorted list

2008-01-21 Thread J. Peng
J. Peng 写道: >k = (i.split())[3] >y = (i.split())[1] btw, why can't I write the above two into one statement? (k,y) = (i.split())[3,1] -- http://mail.python.org/mailman/listinfo/python-list

Re: object scope

2008-01-20 Thread J. Peng
Dennis Lee Bieber 写道: > The scope of "name" is the entire function; lacking a "global name" > statement, AND being on the left side of an assignment, it is a function > local name. Thank you. Does python have so-called 'block scope' object? or if you can,please show me the doc for python's o

Re: Sorting a list depending of the indexes of another sorted list

2008-01-21 Thread J. Peng
I tried to write it below,it can work,:) v= """preference 10 host mx1.domain.com preference 30 host anotherhost.domain.com preference 20 host mx2.domain.com""" x=v.split("\n") li =[] for i in x: k = (i.split())[3] y = (i.split())[1] li.append((y,k)) li.sort() print li the output is:

Re: Sorting a list depending of the indexes of another sorted list

2008-01-21 Thread J. Peng
Steven D'Aprano 写道: > On Mon, 21 Jan 2008 16:23:50 +0800, J. Peng wrote: > >> J. Peng 写道: >> >>>k = (i.split())[3] >>>y = (i.split())[1] >> btw, why can't I write the above two into one statement? >> >> (k,y) = (i.split()

read files

2008-01-21 Thread J. Peng
first I know this is the correct method to read and print a file: fd = open("/etc/sysctl.conf") done=0 while not done: line = fd.readline() if line == '': done = 1 else: print line, fd.close() I dont like that flag of "done",then I tried to re-write it as: fd = open

Re: read files

2008-01-21 Thread J. Peng
Thank you. That gave so much solutions. And thanks all. Steven D'Aprano 写道: > On Tue, 22 Jan 2008 11:00:53 +0800, J. Peng wrote: > >> first I know this is the correct method to read and print a file: >> >> fd = open("/etc/sysctl.conf") >> done=0

Re: read files

2008-01-21 Thread J. Peng
Gabriel Genellina 写道: > En Tue, 22 Jan 2008 02:03:10 -0200, Paul Rubin > <"http://phr.cx"@NOSPAM.invalid> escribió: > >> "J. Peng" <[EMAIL PROTECTED]> writes: >>> print line, >> Do you really want all the lines crunched toge

what's this instance?

2008-01-21 Thread J. Peng
def safe_float(object): try: retval = float(object) except (ValueError, TypeError), oops: retval = str(oops) return retval x=safe_float([1,2,3,4]) print x The code above works well.But what's the instance of "oops"? where is it coming from? I'm totally confused on it.thanks. -- ht

Re: what's this instance?

2008-01-22 Thread J. Peng
Bruno Desthuilliers 写道: > J. Peng a écrit : >> def safe_float(object): >> try: >> retval = float(object) >> except (ValueError, TypeError), oops: >> retval = str(oops) >> return retval > >> The code above works well. > > For whi

python modules collection

2008-01-30 Thread J. Peng
Hello, Is there a site for python,which collects most kinds of python modules? like CPAN for Perl. Sometime I want to use a module,like the time/date modules,don't know where I should search from. Sorry if I have repeated this question on the list. Thanks! -- http://mail.python.org/mailman/listi

urllib supports javascript

2008-02-01 Thread J. Peng
hello, Which useragent lib supports javascript? I know something about these libs: urllib,urllib2,cookielib,httplib But I'm not sure which one of them can support javascript scripts. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib supports javascript

2008-02-01 Thread J. Peng
js 写道: > AFAIK, nothing. > How abount letting a browser do it? > By using pamie [1] or selenium, you can drive a browser from python. > > [1] http://pamie.sourceforge.net/ > > On Feb 2, 2008 11:07 AM, J. Peng <[EMAIL PROTECTED]> wrote: >> hello, >> >

Re: multi-Singleton-like using __new__

2008-02-08 Thread J Peyret
I think the metaclass stuff is a bit too black magic for a pretty simple requirement. Txs in any case for showing me the __init__ issue, I wasn't aware of it. Here's a workaround - not exactly elegant in terms of OO, with the isInitialized flag, but it works. >>> class RDFObject(object): ...

Re: multi-Singleton-like using __new__

2008-02-08 Thread J Peyret
On Feb 8, 5:38 pm, Freek Dijkstra <[EMAIL PROTECTED]> wrote: If you want to subclass, my initial example did not cover that. This will, or at least, I don't have any problems with similar code: ... def __new__(cls,uri,*args,**kwds): ... try: ... return cls.cache[(cls,uri

Coverage.py reporting and UML tools - what exists already?

2008-02-13 Thread J Peyret
I got coverage.py to work after somewhat of a difficult start... Hint: if moving your code from Windows to Linux and if running 'coverage.py -r mymodule.py' causes SyntaxError/SyntaxException, the 'flip' utility is your friend to deal with removing those nasty \r\n newlines that are preventing co

<    1   2   3   4   5   6   7   8   9   10   >