Re: How Does requests.get Work?

2020-04-02 Thread Abdur-Rahmaan Janhangeer
Ah i get it from .api import request, get, head, post, patch, put, delete, options Whatever you import in __init__.py, you can access it directly. Thanks! Kind Regards, Abdur-Rahmaan Janhangeer compileralchemy.com | github

Re: How Does requests.get Work?

2020-04-02 Thread Chris Angelico
On Thu, Apr 2, 2020 at 5:12 PM Abdur-Rahmaan Janhangeer wrote: > > When dev a package, if you can do: > > >>> from package import x > > does not mean you can do > > >>> import package > >>> package.x > > for requests i was wondering how requests package can have > > >>> requests.get > > while

Re: How Does requests.get Work?

2020-04-02 Thread Abdur-Rahmaan Janhangeer
When dev a package, if you can do: >>> from package import x does not mean you can do >>> import package >>> package.x for requests i was wondering how requests package can have >>> requests.get while requests is defined in api.py Kind Regards, Abdur-Rahmaan Janhangeer

Re: How Does requests.get Work?

2020-04-01 Thread Juergen Brendel
Hello! Can you elaborate on what you mean by "use directly"? Juergen On Thu, 2020-04-02 at 01:12 +0400, Abdur-Rahmaan Janhangeer wrote: > Greetings list, > > I was viewing requests https://github.com/psf/requests > > I know we can do `requests.get` > > Found `get` defined in api.py > > I

How Does requests.get Work?

2020-04-01 Thread Abdur-Rahmaan Janhangeer
Greetings list, I was viewing requests https://github.com/psf/requests I know we can do `requests.get` Found `get` defined in api.py I would appreciate an explanation as to how to configure the package so that we can use get directly. Thanks. Kind Regards, Abdur-Rahmaan Janhangeer

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Chris Angelico
On Wed, Mar 9, 2016 at 5:25 PM, Veek. M wrote: > ah, okay - i'm familiar with the py3 syntax where you do: > eval('whatever stmt', globals={}, locals={}) > I suppose this: exec " " in NS; syntax is strictly py2? > > Many thanks :) Yeah, that's one of the things that was

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Veek. M
Steven D'Aprano wrote: > On Wednesday 09 March 2016 16:27, Veek. M wrote: > >> What is the return value of `exec`? Would that object be then used to >> iterate the sequence in 'a'? I'm reading this: >> https://www.python.org/download/releases/2.2.3/descrintro/ > > > exec is a statement, not a

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Veek. M
Ben Finney wrote: > "Veek. M" writes: > >> What is the return value of `exec`? > > You can refer to the documentation for questions like that. > > >> Would that object be then used to iterate the sequence in 'a'?

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Steven D'Aprano
On Wednesday 09 March 2016 16:27, Veek. M wrote: > What is the return value of `exec`? Would that object be then used to > iterate the sequence in 'a'? I'm reading this: > https://www.python.org/download/releases/2.2.3/descrintro/ exec is a statement, not a function, so it doesn't have a return

Re: exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Ben Finney
"Veek. M" writes: > What is the return value of `exec`? You can refer to the documentation for questions like that. > Would that object be then used to iterate the sequence in 'a'? The ‘for’ or ‘while’ statements

exec "x = 3; print x" in a - How does it work?

2016-03-08 Thread Veek. M
What is the return value of `exec`? Would that object be then used to iterate the sequence in 'a'? I'm reading this: https://www.python.org/download/releases/2.2.3/descrintro/ -- https://mail.python.org/mailman/listinfo/python-list

Re: function code snippet that has function calls I have never seen before. How does it work.

2015-10-04 Thread Steven D'Aprano
On Sun, 4 Oct 2015 04:40 am, Ronald Cosentino wrote: > def funA(x,y,z): > return (x+y) * z > def funB(x,y): > return(x-y) > print(funA(4,funB(2,3), funB(3,2))) > > the answer is 3. I don't know how it works. Break it up and consider it a little at a time, starting with the three values

function code snippet that has function calls I have never seen before. How does it work.

2015-10-03 Thread Ronald Cosentino
def funA(x,y,z): return (x+y) * z def funB(x,y): return(x-y) print(funA(4,funB(2,3), funB(3,2))) the answer is 3. I don't know how it works. -- https://mail.python.org/mailman/listinfo/python-list

Re: function code snippet that has function calls I have never seen before. How does it work.

2015-10-03 Thread Joel Goldstick
On Sat, Oct 3, 2015 at 1:40 PM, Ronald Cosentino wrote: > def funA(x,y,z): > return (x+y) * z > The above takes 3 values and returns a value > def funB(x,y): > return(x-y) > The above takes 2 values and returns a value > print(funA(4,funB(2,3), funB(3,2))) >

Re: function code snippet that has function calls I have never seen before. How does it work.

2015-10-03 Thread Denis McMahon
On Sat, 03 Oct 2015 10:40:57 -0700, Ronald Cosentino wrote: > def funA(x,y,z): > return (x+y) * z > def funB(x,y): > return(x-y) > print(funA(4,funB(2,3), funB(3,2))) > > the answer is 3. I don't know how it works. def funA(x, y, z): return (x+y) * z def funB(x, y): return

RE: function code snippet that has function calls I have never seen before. How does it work.

2015-10-03 Thread Joseph Lee
never seen before. How does it work. def funA(x,y,z): return (x+y) * z def funB(x,y): return(x-y) print(funA(4,funB(2,3), funB(3,2))) the answer is 3. I don't know how it works. JL: Okay, let's step through the print routine. 1. Before print does its job, the function result

Re: function code snippet that has function calls I have never seen before. How does it work.

2015-10-03 Thread Ervin Hegedüs
hi, On Sat, Oct 03, 2015 at 10:40:57AM -0700, Ronald Cosentino wrote: > def funA(x,y,z): > return (x+y) * z > def funB(x,y): > return(x-y) > print(funA(4,funB(2,3), funB(3,2))) > > the answer is 3. I don't know how it works. it's simple: - there is a "composition of functions",

how does not work nested comment in python?

2013-09-04 Thread vnkumbhani
example: print hello # print comment +world= single line comment print hello '''print comment''' +world = multiple line comment -- https://mail.python.org/mailman/listinfo/python-list

Re: how does not work nested comment in python?

2013-09-04 Thread Vlastimil Brom
2013/9/4 vnkumbh...@gmail.com: example: print hello # print comment +world= single line comment print hello '''print comment''' +world = multiple line comment -- https://mail.python.org/mailman/listinfo/python-list Hi, python only has single line comments, which apply from a # to the

Re: how does not work nested comment in python?

2013-09-04 Thread Dave Angel
On 4/9/2013 02:13, vnkumbh...@gmail.com wrote: example: print hello # print comment +world= single line comment print hello # print comment +world= single line comment hello print hello '''print comment''' +world = multiple line comment print hello '''print comment'''

Re: how does the % work?

2013-03-24 Thread Tim Roberts
leonardo tampucciol...@libero.it wrote: thank you all! So, what was the problem? -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: how does the % work?

2013-03-23 Thread Rick Johnson
On Friday, March 22, 2013 11:29:48 PM UTC-5, Tim Roberts wrote: You are using Python 3. In Python 3, print is a function that returns None. So, the error is exactly correct. Wait a second... if he is in-fact using Python 3, then why did the call to a non-existent function named raw_input

Re: how does the % work?

2013-03-23 Thread Steven D'Aprano
On Fri, 22 Mar 2013 21:29:48 -0700, Tim Roberts wrote: leonardo selmi l.se...@icloud.com wrote: i wrote this example : name = raw_input(What is your name?) quest = raw_input(What is your quest?) color = raw_input(What is your favorite color?) print Ah, so your name is %s, your quest is %s,

Re: how does the % work?

2013-03-23 Thread Rick Johnson
On Saturday, March 23, 2013 2:38:23 AM UTC-5, Steven D'Aprano wrote: On Fri, 22 Mar 2013 21:29:48 -0700, Tim Roberts wrote: print('''Ah, so your name is %s, your quest is %s, and your favorite color is %s.''') % (name, quest, color) The difference between those two statements may not

Re: how does the % work?

2013-03-23 Thread Michael Torrie
On 03/23/2013 01:38 AM, Steven D'Aprano wrote: Just to add confusion, the two lines are exactly the same in Python 2, where Print is not a function! Perhaps this is a good reason use the slightly more complicated but easier to get right format method. print ({0}, {1}, {2}.format(1,2,3)) And

Re: how does the % work?

2013-03-23 Thread leonardo
thank you all! Il 23/03/2013 8.38, Steven D'Aprano ha scritto: On Fri, 22 Mar 2013 21:29:48 -0700, Tim Roberts wrote: leonardo selmi l.se...@icloud.com wrote: i wrote this example : name = raw_input(What is your name?) quest = raw_input(What is your quest?) color = raw_input(What is your

Re: how does the % work?

2013-03-23 Thread Steven D'Aprano
On Sat, 23 Mar 2013 09:57:48 -0600, Michael Torrie wrote: On 03/23/2013 01:38 AM, Steven D'Aprano wrote: Just to add confusion, the two lines are exactly the same in Python 2, where Print is not a function! Perhaps this is a good reason use the slightly more complicated but easier to get

how does the % work?

2013-03-22 Thread leonardo selmi
hi guys i wrote this example : name = raw_input(What is your name?) quest = raw_input(What is your quest?) color = raw_input(What is your favorite color?) print Ah, so your name is %s, your quest is %s, and your favorite color is %s. % (name, quest, color) but i get this error: Traceback

Re: how does the % work?

2013-03-22 Thread John Gordon
In mailman.3612.1363971987.2939.python-l...@python.org leonardo selmi l.se...@icloud.com writes: hi guys i wrote this example : name = raw_input(What is your name?) quest = raw_input(What is your quest?) color = raw_input(What is your favorite color?) print Ah, so your name is %s, your

Re: [Python-Help] how does the % work?

2013-03-22 Thread bob gailer
It is better to post to just one list at a time. On 3/22/2013 1:06 PM, leonardo selmi wrote: name = raw_input(What is your name?) quest = raw_input(What is your quest?) color = raw_input(What is your favorite color?) print Ah, so your name is %s, your quest is %s, and your favorite color is

Re: how does the % work?

2013-03-22 Thread Rick Johnson
On Friday, March 22, 2013 12:06:18 PM UTC-5, leonardo selmi wrote: hi guys i wrote this example : name = raw_input(What is your name?) quest = raw_input(What is your quest?) color = raw_input(What is your favorite color?) print Ah, so your name is %s, your quest is %s, and your

Re: how does the % work?

2013-03-22 Thread Tim Roberts
leonardo selmi l.se...@icloud.com wrote: i wrote this example : name = raw_input(What is your name?) quest = raw_input(What is your quest?) color = raw_input(What is your favorite color?) print Ah, so your name is %s, your quest is %s, and your favorite color is %s. % (name, quest, color)

Re: How does .rjust() work and why it places characters relative to previous one, not to first character - placed most to left - or to left side of screen?

2012-08-20 Thread Peter Otten
crispy wrote: Thanks, i've finally came to solution. Here it is - http://codepad.org/Q70eGkO8 def pairwiseScore(seqA, seqB): score = 0 bars = [str(' ') for x in seqA] # ... length = len(seqA) similarity = [] for x in xrange(length): if seqA[x] ==

How does .rjust() work and why it places characters relative to previous one, not to first character - placed most to left - or to left side of screen?

2012-08-19 Thread crispy
I have an example: def pairwiseScore(seqA, seqB): prev = -1 score = 0 length = len(seqA) similarity = [] relative_similarity = [] for x in xrange(length): if seqA[x] == seqB[x]: if

Re: How does .rjust() work and why it places characters relative to previous one, not to first character - placed most to left - or to left side of screen?

2012-08-19 Thread crispy
Here's first code - http://codepad.org/RcKTTiYa And here's second - http://codepad.org/zwEQKKeV -- http://mail.python.org/mailman/listinfo/python-list

Re: How does .rjust() work and why it places characters relative to previous one, not to first character - placed most to left - or to left side of screen?

2012-08-19 Thread Dave Angel
On 08/19/2012 12:25 PM, crispy wrote: SNIP So I have guessed, that characters processed by .rjust() function, are placed in output, relative to previous ones - NOT to first, most to left placed, character. rjust() does not print to the console, it just produces a string. So if you want to

Re: How does .rjust() work and why it places characters relative to previous one, not to first character - placed most to left - or to left side of screen?

2012-08-19 Thread crispy
W dniu niedziela, 19 sierpnia 2012 19:31:30 UTC+2 użytkownik Dave Angel napisał: On 08/19/2012 12:25 PM, crispy wrote: SNIP So I have guessed, that characters processed by .rjust() function, are placed in output, relative to previous ones - NOT to first, most to left placed,

Re: How does this work?

2011-06-05 Thread Jon Clements
On Jun 5, 4:37 am, Ben Finney ben+pyt...@benfinney.id.au wrote: jyoun...@kc.rr.com writes: I was surfing around looking for a way to split a list into equal sections. I came upon this algorithm: f = lambda x, n, acc=[]: f(x[n:], n, acc+[(x[:n])]) if x else acc f(Hallo Welt, 3)

Re: How does this work?

2011-06-05 Thread Ben Finney
Jon Clements jon...@googlemail.com writes: On Jun 5, 4:37 am, Ben Finney ben+pyt...@benfinney.id.au wrote: jyoun...@kc.rr.com writes: (http://stackoverflow.com/questions/312443/how-do-you-split-a-list-int...) This is an excellent example of why “clever” code is to be shunned. Whoever

How does this work?

2011-06-04 Thread jyoung79
-into-evenly-sized-chunks-in-python/312644) It doesn't work with a huge list, but looks like it could be handy in certain circumstances. I'm trying to understand this code, but am totally lost. I know a little bit about lambda, as well as the ternary operator, but how does this part work: f('dude'[3

Re: How does this work?

2011-06-04 Thread Ben Finney
jyoun...@kc.rr.com writes: I was surfing around looking for a way to split a list into equal sections. I came upon this algorithm: f = lambda x, n, acc=[]: f(x[n:], n, acc+[(x[:n])]) if x else acc f(Hallo Welt, 3) ['Hal', 'lo ', 'Wel', 't']

Re: network programming: how does s.accept() work?

2008-02-27 Thread Grant Edwards
On 2008-02-27, Micah Cowan [EMAIL PROTECTED] wrote: Grant Edwards wrote: On 2008-02-26, Micah Cowan [EMAIL PROTECTED] wrote: 7stud, what you seem to be missing, and what I'm not sure if anyone has clarified for you (I have only skimmed the thread), is that in TCP, connections are uniquely

Re: network programming: how does s.accept() work?

2008-02-26 Thread 7stud
On Feb 25, 10:00 pm, Roy Smith [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED],  7stud [EMAIL PROTECTED] wrote: But your claim that the server doesn't change its port flies in the face of every description I've read about TCP connections and accept().  The articles and books I've

Re: network programming: how does s.accept() work?

2008-02-26 Thread 7stud
On Feb 25, 10:08 pm, Steve Holden [EMAIL PROTECTED] wrote: There can be many TCP connections to a server all using the same endpoint. Take a look at the traffic coming out of any busy web server: everything that comes out of the same server comes from port 80. That doesn't stop it listening

Re: network programming: how does s.accept() work?

2008-02-26 Thread Hrvoje Niksic
7stud [EMAIL PROTECTED] writes: When you surf the Web, say to http://www.google.com, your Web browser is a client. The program you contact at Google is a server. When a server is run, it sets up business at a certain port, say 80 in the Web case. It then waits for clients to contact it. When

Re: network programming: how does s.accept() work?

2008-02-26 Thread Frank Millman
7stud wrote: If two sockets are bound to the same host and port on the server, how does data sent by the client get routed? Can both sockets recv() the data? I have learned a lot of stuff I did not know before from this thread, so I think I can answer that. There must be a layer of

Re: network programming: how does s.accept() work?

2008-02-26 Thread Steve Holden
7stud wrote: On Feb 25, 10:00 pm, Roy Smith [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], 7stud [EMAIL PROTECTED] wrote: But your claim that the server doesn't change its port flies in the face of every description I've read about TCP connections and accept(). The articles and

Re: network programming: how does s.accept() work?

2008-02-26 Thread Micah Cowan
Hrvoje Niksic wrote: 7stud [EMAIL PROTECTED] writes: When you surf the Web, say to http://www.google.com, your Web browser is a client. The program you contact at Google is a server. When a server is run, it sets up business at a certain port, say 80 in the Web case. It then waits for

Re: network programming: how does s.accept() work?

2008-02-26 Thread Grant Edwards
On 2008-02-26, Micah Cowan [EMAIL PROTECTED] wrote: 7stud, what you seem to be missing, and what I'm not sure if anyone has clarified for you (I have only skimmed the thread), is that in TCP, connections are uniquely identified by a /pair/ of sockets (where socket here means an address/port

Re: network programming: how does s.accept() work?

2008-02-26 Thread Roy Smith
In article [EMAIL PROTECTED], 7stud [EMAIL PROTECTED] wrote: If two sockets are bound to the same host and port on the server, how does data sent by the client get routed? Can both sockets recv() the data? Undefined. You certainly won't find the answer in the RFCs which define the

Re: network programming: how does s.accept() work?

2008-02-26 Thread Gabriel Genellina
En Tue, 26 Feb 2008 07:53:24 -0200, 7stud [EMAIL PROTECTED] escribió: --- When you surf the Web, say to http://www.google.com, your Web browser is a client. The program you contact at Google is a server. When a server is run, it sets up business at a certain port, say 80 in the Web case.

Re: network programming: how does s.accept() work?

2008-02-26 Thread Micah Cowan
Grant Edwards wrote: On 2008-02-26, Micah Cowan [EMAIL PROTECTED] wrote: 7stud, what you seem to be missing, and what I'm not sure if anyone has clarified for you (I have only skimmed the thread), is that in TCP, connections are uniquely identified by a /pair/ of sockets (where socket here

Re: network programming: how does s.accept() work?

2008-02-26 Thread Micah Cowan
Gabriel Genellina wrote: En Tue, 26 Feb 2008 07:53:24 -0200, 7stud [EMAIL PROTECTED] escribió: --- When you surf the Web, say to http://www.google.com, your Web browser is a client. The program you contact at Google is a server. When a server is run, it sets up business at a certain port,

network programming: how does s.accept() work?

2008-02-25 Thread 7stud
I have the following two identical clients #test1.py:--- import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = 'localhost' port = 5052 #server port s.connect((host, port)) print s.getsockname() response = [] while 1: piece = s.recv(1024) if piece == '':

Re: network programming: how does s.accept() work?

2008-02-25 Thread bockman
On 25 Feb, 09:51, 7stud [EMAIL PROTECTED] wrote: I have the following two identical clients #test1.py:--- import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = 'localhost' port = 5052  #server port s.connect((host, port)) print s.getsockname() response =

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 2:43 am, [EMAIL PROTECTED] wrote: On 25 Feb, 09:51, 7stud [EMAIL PROTECTED] wrote: I have the following two identical clients #test1.py:--- import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = 'localhost' port = 5052  #server port

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 2:43 am, [EMAIL PROTECTED] wrote: by reusing the same variables without storing the previous values. This could make the Python garbage collector to attempt freeing the socket object created with the first connection, therefore closing the connection. If I'm right, your program

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 4:08 am, 7stud [EMAIL PROTECTED] wrote: The question I'm really trying to answer is: if a client connects to a host at a specific port, but the server changes the port when it creates a new socket with accept(), how does data sent by the client arrive at the correct port?  Won't

Re: network programming: how does s.accept() work?

2008-02-25 Thread bockman
The question I'm really trying to answer is: if a client connects to a host at a specific port, but the server changes the port when it creates a new socket with accept(), how does data sent by the client arrive at the correct port?  Won't the client be sending data to the original port

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 5:17 am, 7stud [EMAIL PROTECTED] wrote: On Feb 25, 4:08 am, 7stud [EMAIL PROTECTED] wrote: The question I'm really trying to answer is: if a client connects to a host at a specific port, but the server changes the port when it creates a new socket with accept(), how does data

Re: network programming: how does s.accept() work?

2008-02-25 Thread Thomas Bellman
7stud [EMAIL PROTECTED] wrote: The question I'm really trying to answer is: if a client connects to a host at a specific port, but the server changes the port when it creates a new socket with accept(), how does data sent by the client arrive at the correct port? Won't the client be sending

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 10:56 am, Thomas Bellman [EMAIL PROTECTED] wrote: 7stud [EMAIL PROTECTED] wrote: The question I'm really trying to answer is: if a client connects to a host at a specific port, but the server changes the port when it creates a new socket with accept(), how does data sent by the

Re: network programming: how does s.accept() work?

2008-02-25 Thread Grant Edwards
On 2008-02-25, 7stud [EMAIL PROTECTED] wrote: On Feb 25, 10:56 am, Thomas Bellman [EMAIL PROTECTED] wrote: 7stud [EMAIL PROTECTED] wrote: The question I'm really trying to answer is: if a client connects to a host at a specific port, but the server changes the port when it creates a new

Re: network programming: how does s.accept() work?

2008-02-25 Thread Gabriel Genellina
En Mon, 25 Feb 2008 20:03:02 -0200, 7stud [EMAIL PROTECTED] escribió: On Feb 25, 10:56 am, Thomas Bellman [EMAIL PROTECTED] wrote: 7stud [EMAIL PROTECTED] wrote: In either case, there are still some things about the output that don't make sense to me. Why does the server initially report

Re: network programming: how does s.accept() work?

2008-02-25 Thread Roy Smith
In article [EMAIL PROTECTED], 7stud [EMAIL PROTECTED] wrote: But your claim that the server doesn't change its port flies in the face of every description I've read about TCP connections and accept(). The articles and books I've read all claim that the server port 5053 is a 'listening'

Re: network programming: how does s.accept() work?

2008-02-25 Thread Roy Smith
In article [EMAIL PROTECTED], Gabriel Genellina [EMAIL PROTECTED] wrote: En Mon, 25 Feb 2008 20:03:02 -0200, 7stud [EMAIL PROTECTED] escribió: On Feb 25, 10:56 am, Thomas Bellman [EMAIL PROTECTED] wrote: 7stud [EMAIL PROTECTED] wrote: In either case, there are still some things about

Re: network programming: how does s.accept() work?

2008-02-25 Thread Steve Holden
7stud wrote: On Feb 25, 10:56 am, Thomas Bellman [EMAIL PROTECTED] wrote: 7stud [EMAIL PROTECTED] wrote: The question I'm really trying to answer is: if a client connects to a host at a specific port, but the server changes the port when it creates a new socket with accept(), how does data

Re: network programming: how does s.accept() work?

2008-02-25 Thread Roy Smith
In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: TCP guarantees that no two ephemeral port connections from the same client will use the same port. Where client is defined as IP Address. You could certainly have a remote machine that has multiple IP addresses using

Re: network programming: how does s.accept() work?

2008-02-25 Thread Steve Holden
Roy Smith wrote: In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: TCP guarantees that no two ephemeral port connections from the same client will use the same port. Where client is defined as IP Address. You could certainly have a remote machine that has

How does unicode() work?

2008-01-09 Thread Robert Latest
Here's a test snippet... import sys for k in sys.stdin: print '%s - %s' % (k, k.decode('iso-8859-1')) ...but it barfs when actually fed with iso8859-1 characters. How is this done right? robert -- http://mail.python.org/mailman/listinfo/python-list

Re: How does unicode() work?

2008-01-09 Thread Fredrik Lundh
Robert Latest wrote: Here's a test snippet... import sys for k in sys.stdin: print '%s - %s' % (k, k.decode('iso-8859-1')) ...but it barfs when actually fed with iso8859-1 characters. How is this done right? it's '%s - %s' % (byte string, unicode string) that barfs. try doing

Re: How does unicode() work?

2008-01-09 Thread Robert Latest
Robert Latest wrote: ...but it barfs when actually fed with iso8859-1 characters. Specifically, it says: UnicodeDecodeError: 'ascii' codec can't decode byte 0xf6 in position 0: ordinal not in range(128) which doesn't make sense to me, because I specifically asked for the iso8859-1 decoder,

Re: How does unicode() work?

2008-01-09 Thread Fredrik Lundh
Carsten Haese wrote: If that really is the line that barfs, wouldn't it make more sense to repr() the unicode object in the second position? import sys for k in sys.stdin: print '%s - %s' % (k, repr(k.decode('iso-8859-1'))) Also, I'm not sure if the OP has told us the truth about

Re: How does unicode() work?

2008-01-09 Thread Carsten Haese
On Wed, 2008-01-09 at 13:44 +0100, Fredrik Lundh wrote: Robert Latest wrote: Here's a test snippet... import sys for k in sys.stdin: print '%s - %s' % (k, k.decode('iso-8859-1')) ...but it barfs when actually fed with iso8859-1 characters. How is this done right? it's

Re: How does unicode() work?

2008-01-09 Thread Carsten Haese
On Wed, 2008-01-09 at 15:33 +0100, Fredrik Lundh wrote: When mixing Unicode with byte strings, Python attempts to decode the byte string, not encode the Unicode string. Ah, I did not realize that. I never mix Unicode and byte strings in the first place, and now I know why. Thanks for clearing

Re: How does unicode() work?

2008-01-09 Thread John Machin
On Jan 10, 1:55 am, Carsten Haese [EMAIL PROTECTED] wrote: On Wed, 2008-01-09 at 15:33 +0100, Fredrik Lundh wrote: When mixing Unicode with byte strings, Python attempts to decode the byte string, not encode the Unicode string. Ah, I did not realize that. I never mix Unicode and byte

Re: How does unicode() work?

2008-01-09 Thread Robert Latest
John Machin wrote: When mixing unicode strings with byte strings, Python attempts to decode the str object to unicode, not encode the unicode object to str. Thanks for the explanation. Of course I didn't want to mix Unicode and Latin in one string, my snippet just tried to illustrate the

How does setup.py work?

2007-12-19 Thread dxm
I am a new comer to python. I am wondering how setup.py works. For example, I have a directory like this: / setup.py mymodule.c where setup.py is: from distutils.core import setup, Extension mod = Extension('mymodule', sources = ['mymodule.c']) setup (name = 'Package', version =

Re: How does setup.py work?

2007-12-19 Thread Matias Surdi
dxm escribió: I am a new comer to python. I am wondering how setup.py works. For example, I have a directory like this: / setup.py mymodule.c where setup.py is: from distutils.core import setup, Extension mod = Extension('mymodule', sources = ['mymodule.c']) setup (name =

Re: How does setup.py work?

2007-12-19 Thread Robert Kern
dxm wrote: I am a new comer to python. I am wondering how setup.py works. For example, I have a directory like this: / setup.py mymodule.c where setup.py is: from distutils.core import setup, Extension mod = Extension('mymodule', sources = ['mymodule.c']) setup (name =

Re: How does setup.py work?

2007-12-19 Thread Robert Kern
Matias Surdi wrote: Here you can read the documentation of setuptools , the package from where setup.py comes. http://peak.telecommunity.com/DevCenter/setuptools No, setup.py files are standard distutils. setuptools is a 3rd-party package that extends distutils.

Re: How does super() work?

2007-09-03 Thread Gabriel Genellina
En Fri, 31 Aug 2007 17:58:24 -0300, Lamonte Harris [EMAIL PROTECTED] escribi�: I've searched Google, and other search engines to try to find out how super() works. Can someone explain in short detail how super() works? I may and may not need to know this information, but it is good to

Re: How does super() work?

2007-09-03 Thread Michele Simionato
En Fri, 31 Aug 2007 17:58:24 -0300, Lamonte Harris [EMAIL PROTECTED] escribi?: I've searched Google, and other search engines to try to find out how super() works. Can someone explain in short detail how super() works? I may and may not need to know this information, but it is good to

Re: How does super() work?

2007-09-03 Thread Gerardo Herzig
Lamonte Harris wrote: I've searched Google, and other search engines to try to find out how super() works. Can someone explain in short detail how super() works? I may and may not need to know this information, but it is good to know. There is at least one explanation in the python.org

How does super() work?

2007-09-01 Thread Lamonte Harris
I've searched Google, and other search engines to try to find out how super() works. Can someone explain in short detail how super() works? I may and may not need to know this information, but it is good to know. -- http://mail.python.org/mailman/listinfo/python-list

Re: How does xmlrpc work ?

2007-08-01 Thread Marc 'BlackJack' Rintsch
On Wed, 01 Aug 2007 05:32:14 +, [EMAIL PROTECTED] wrote: I am working on a system which used XMLRPC to communicate between hundreds of computer. One administrative computer keeps hundreds of xmlrpc instance of other computers. I want to know if evey instance use a single connection and

How does xmlrpc work ?

2007-07-31 Thread [EMAIL PROTECTED]
Hi everyone I am working on a system which used XMLRPC to communicate between hundreds of computer. One administrative computer keeps hundreds of xmlrpc instance of other computers. I want to know if evey instance use a single connection and keep it alive forever OR create a new connection when a

How does py2exe work?

2007-07-01 Thread vasudevram
Hi, I recently checked out py2exe (on Windows). Looks good. Was able to build an EXE out of one of my Python apps. Wondering how it works? Does it actually compile the Python source of your script into machine language, or does it do something more like bundling the Python interpreter, the

Re: How does py2exe work?

2007-07-01 Thread Thomas Jollans
On Sunday 01 July 2007, vasudevram wrote: Wondering how it works? Does it actually compile the Python source of your script into machine language, or does it do something more like bundling the Python interpreter, the Python libraries and the script itself, into a file? essentially, that's

Re: How does py2exe work?

2007-07-01 Thread Wildemar Wildenburger
Thomas Jollans wrote: On Sunday 01 July 2007, vasudevram wrote: Wondering how it works? Does it actually compile the Python source of your script into machine language, or does it do something more like bundling the Python interpreter, the Python libraries and the script itself, into a

Re: How does py2exe work?

2007-07-01 Thread vasudevram
On Jul 2, 12:43 am, Wildemar Wildenburger [EMAIL PROTECTED] wrote: Thomas Jollans wrote: On Sunday 01 July 2007, vasudevram wrote: Wondering how it works? Does it actually compile the Python source of your script into machine language, or does it do something more like bundling the

How does os.walk work?

2007-06-07 Thread [EMAIL PROTECTED]
In the example from help(os.walk) it lists this: from os.path import join, getsize for root, dirs, files in walk('python/Lib/email'): print root, consumes, print sum([getsize(join(root, name)) for name in files]), print bytes in, len(files), non-directory files

Re: How does os.walk work?

2007-06-07 Thread Gary Herron
[EMAIL PROTECTED] wrote: In the example from help(os.walk) it lists this: from os.path import join, getsize for root, dirs, files in walk('python/Lib/email'): print root, consumes, print sum([getsize(join(root, name)) for name in files]), print bytes in,

Re: How does os.walk work?

2007-06-07 Thread [EMAIL PROTECTED]
On Jun 7, 5:13 pm, Gary Herron [EMAIL PROTECTED] wrote: Simple: os.walk builds the list to contain all the subdirectories. After giving you a chance to modify that list, ow.walk then goes through the list (whatever contents it has at that point) and visits any subdirectory. I'd guess your

retrbinary ! how does it work ?

2007-02-01 Thread [EMAIL PROTECTED]
Hello dear community ! I'm a bit ashamed to ask such an easy question, but I didn't find my answer on previous posts. I'd like to copy files with FTP protocol in a subdirectory. So far, my code look like that : import ftplib session = ftplib.FTP('222.33.44.55','usr','pwd') session.cwd('/')

Re: retrbinary ! how does it work ?

2007-02-01 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: Hello dear community ! I'm a bit ashamed to ask such an easy question, but I didn't find my answer on previous posts. I'd like to copy files with FTP protocol in a subdirectory. So far, my code look like that : import ftplib session =

Re: retrbinary ! how does it work ?

2007-02-01 Thread Gabriel Genellina
En Thu, 01 Feb 2007 06:17:34 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] escribió: I'd like to copy files with FTP protocol in a subdirectory. So far, my code look like that : import ftplib session = ftplib.FTP('222.33.44.55','usr','pwd') session.cwd('/') files = session.nlst()

Re: retrbinary ! how does it work ?

2007-02-01 Thread [EMAIL PROTECTED]
Thanks a lot Diez and Gabriel. It works perfectly ! Have a nice day Yvan -- http://mail.python.org/mailman/listinfo/python-list

wxpython: how does EVT_IDLE work?

2006-07-10 Thread John Salerno
Quick question about the code below: I understand why the progress bar fills up at a steady pace when the mouse is idle over the frame; but why, when you move the mouse, does the progress bar speed up? Shouldn't it stop completely until the mouse is idle again? Also, on a side note, I'm

Re: wxpython: how does EVT_IDLE work?

2006-07-10 Thread John Salerno
John Salerno wrote: Quick question about the code below: I understand why the progress bar fills up at a steady pace when the mouse is idle over the frame; but why, when you move the mouse, does the progress bar speed up? Shouldn't it stop completely until the mouse is idle again? Ok, now

  1   2   >