Hi, All
I'm working with a small program to realize P2P file transfer.
Therefore, I have to accomplish the function of NAT traversal. From
the searching result, I know that it always requires a public server
to initialize the transfer, but I don't have one. Now, my idea is
that, we already have ma
On 26.03.2012, Steven D'Aprano wroted:
>>> How can we generate a 6 digit random number from a given number ?
>> what about this?
>>
> given_number=123456
> def rand_given_number(x):
>> ... s = list(str(x))
>> ... random.shuffle(s)
>> ... return int(''.join(s))
>> ...
> pr
Nikhil Verma wrote:
> I want something to achieve like this :-
>
> def random_number(id): # I am passing it from request
> # do something
> return random_number
>
> Output
>
> random_number(5)
> AXR670
That's normally not called a number (though it could be base 36 or similar).
> One
From: MRAB
To: python-list@python.org
Cc:
Date: Sun, 25 Mar 2012 22:14:28 +0100
Subject: Re: bdb.Bdb (Debugger Base Class) / unittest Interaction
On 25/03/2012 21:42, Ami Tavory wrote:
> Hello,
>
> I'm having some difficulties with the interaction between bdb.Bdb and
> scripts which contain u
On Sun, Mar 25, 2012 at 11:16 AM, Kiuhnm
wrote:
> On 3/25/2012 15:48, Tim Chase wrote:
>>
>> The old curmudgeon in me likes the Pascal method of using "=" for
>> equality-testing, and ":=" for assignment which feels a little closer to
>> mathematical use of "=".
>
>
> Unfortunately, ":=" means "is
* Nikhil Verma [2012-03-26 08:49]:
> Hi
>
> I want something to achieve like this :-
>
> def random_number(id): # I am passing it from request
> # do something
> return random_number
>
> Output
>
> random_number(5)
> AXR670
>
> One input that is a number in return you are getting 6 di
Kiuhnm wrote:
[snip]
numbers - push - avrg - 'med' - pop - filter(lt('med'), ge('med'))\
- ['same', 'same'] - streams(cat) - 'same'
It reads as
"take a list of numbers - save it - compute the average and named it
'med' - restore the flow - create two streams which have, respect.,
the num
On 3/26/12 8:50 AM, Grzegorz Staniak wrote:
On 26.03.2012, Steven D'Aprano wroted:
How can we generate a 6 digit random number from a given number ?
what about this?
given_number=123456
def rand_given_number(x):
... s = list(str(x))
... random.shuffle(s)
... return int(''.join(
Jon Clements wrote:
On Wednesday, 14 March 2012 13:28:58 UTC, Cosmia Luna wrote:
class Foo(object):
def bar(self):
return 'Something'
func = Foo().bar
if type(func) == : # This should be always true
pass # do something here
What should type at ?
Thanks
Cosmia
impor
Hi
Thanks Michael I want exactly wanted this. Great
def random_number(id)
...characters = list(string.ascii_lowercase +string.ascii_uppercase
+string.digits)
I used this this earlier and tried then by using choice .
This is great.
On Mon, Mar 26, 2012 at 2:54 PM, Michael Poeltl wrote:
On 3/26/12 10:45 AM, Nikhil Verma wrote:
Hi
Thanks Michael I want exactly wanted this. Great
def random_number(id)
...characters = list(string.ascii_lowercase +string.ascii_uppercase
+string.digits)
I used this this earlier and tried then by using choice .
This is great.
Note that th
On 03/25/12 17:59, Dennis Lee Bieber wrote:
On Sun, 25 Mar 2012 08:48:31 -0500, Tim Chase
Yeah, it has the same structure internally, but I'm somewhat
surprised that the DB connection object doesn't have an
__iter__() that does something like this automatically under the
covers.
I beli
On 3/26/2012 10:52, Devin Jeanpierre wrote:
On Sun, Mar 25, 2012 at 11:16 AM, Kiuhnm
wrote:
On 3/25/2012 15:48, Tim Chase wrote:
The old curmudgeon in me likes the Pascal method of using "=" for
equality-testing, and ":=" for assignment which feels a little closer to
mathematical use of "=".
Kiuhnm writes:
> On 3/26/2012 10:52, Devin Jeanpierre wrote:
> > On Sun, Mar 25, 2012 at 11:16 AM, Kiuhnm
> > wrote:
> >> On 3/25/2012 15:48, Tim Chase wrote:
> >>>
> >>> The old curmudgeon in me likes the Pascal method of using "=" for
> >>> equality-testing, and ":=" for assignment which feels
Dennis Lee Bieber wrote:
> On Sun, 25 Mar 2012 19:09:12 -0400, mwil...@the-wire.com declaimed the
> following in gmane.comp.python.general:
>
>
>> Most of my database programs wind up having the boilerplate (not tested):
>>
>> def rowsof (cursor):
>> names = [x[0] for x in cursor.descriptio
I know the print statement produces the same result when both of these two
instructions are executed ,I just want to know Is there any difference between
print 3 and print '3' in Python ?
--
http://mail.python.org/mailman/listinfo/python-list
On 3/26/2012 11:27, Jean-Michel Pichavant wrote:
Kiuhnm wrote:
[snip]
numbers - push - avrg - 'med' - pop - filter(lt('med'), ge('med'))\
- ['same', 'same'] - streams(cat) - 'same'
It reads as
"take a list of numbers - save it - compute the average and named it
'med' - restore the flow - crea
On 3/26/2012 13:13, Jussi Piitulainen wrote:
Kiuhnm writes:
On 3/26/2012 10:52, Devin Jeanpierre wrote:
On Sun, Mar 25, 2012 at 11:16 AM, Kiuhnm
wrote:
On 3/25/2012 15:48, Tim Chase wrote:
The old curmudgeon in me likes the Pascal method of using "=" for
equality-testing, and ":=" for ass
On Mon, Mar 26, 2012 at 10:45 PM, wrote:
> I know the print statement produces the same result when both of these two
> instructions are executed ,I just want to know Is there any difference
> between print 3 and print '3' in Python ?
One of them takes the integer 3, converts it into a string,
In FiPy (a finite volume PDE solver), equations are "magically" set up as
eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D)
and solved via
eqX.solve(...)
How can eqX be anything than True or False?... This must be via a redefinition
of "==" but I can't see how that is done. I did look
On 3/26/2012 13:45, redstone-c...@163.com wrote:
I know the print statement produces the same result when both of
these two instructions are executed ,I just want to know Is there any
difference between print 3 and print '3' in Python ?
The former prints a number while the latter a string.
Kiu
On 03/26/2012 07:45 AM, redstone-c...@163.com wrote:
I know the print statement produces the same result when both of these two
instructions are executed ,I just want to know Is there any difference between
print 3 and print '3' in Python ?
This is a non-question. The input is the same, the
On 3/26/12 12:45 PM, redstone-c...@163.com wrote:
I know the print statement produces the same result when both of these two
instructions are executed ,I just want to know Is there any difference between
print 3 and print '3' in Python ?
Yes, there is a difference, but not much.
[~]
|6> impo
On 3/26/12 12:47 PM, André Roberge wrote:
In FiPy (a finite volume PDE solver), equations are "magically" set up as
eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D)
and solved via
eqX.solve(...)
How can eqX be anything than True or False?... This must be via a redefinition of "=="
bu
On Monday, 26 March 2012 09:16:07 UTC-3, Robert Kern wrote:
> On 3/26/12 12:47 PM, André Roberge wrote:
> > In FiPy (a finite volume PDE solver), equations are "magically" set up as
> >
> > eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D)
> >
> > and solved via
> >
> > eqX.solve(...)
> >
>
Kiuhnm wrote:
Why do you write
// Print the number of words...
def printNumWords(): ...
and not
// Prints the number of words...
def printNumWords(): ...
where "it" is understood?
Is that an imperative or a base form or something else?
Kiuhnm
http://www.python.org/dev/peps/pep-0257/
"
Hi,
I am learning Python and do not have programming experience.
I was following an exercise from
http://learnpythonthehardway.org/book/ex2.html
and made a mistake in entry :
*Print"I like typing this."*
and got the following error message:
*In [2]: Print"I like typing this."*
*-
Aloke Ghosh wrote:
Hi,
I am learning Python and do not have programming experience.
I was following
an exercise from http://learnpythonthehardway.org/book/ex2.html
and made a mistake in entry :
*Print"I like typing this."*
and got the following error message:
*In [2]: Print"I like typing t
I created a new class called CaseInsensitiveDict (by stealing from code I
found on the web, thank you very much). The new class inherits from dict. It
makes it so that if the key has a 'lower' method, it will always access the
key using lower
I'd like to change the place where I previously dec
On 3/26/12 2:33 PM, Steven W. Orr wrote:
I created a new class called CaseInsensitiveDict (by stealing from code I found
on the web, thank you very much). The new class inherits from dict. It makes it
so that if the key has a 'lower' method, it will always access the key using
lower
I'd like to
On Mar 26, 2012 12:28 AM, "Steven D'Aprano" <
steve+comp.lang.pyt...@pearwood.info> wrote:
>
> On Mon, 26 Mar 2012 08:40:00 +0200, Michael Poeltl wrote:
>
> > * Nikhil Verma [2012-03-26 08:09]:
> A truly random six digit number will include any number between 10
> through 99. There are exa
Am 25.03.2012 15:03 schrieb Tim Chase:
Perhaps a DB example
works better. With assignment allowed in an evaluation, you'd be able to
write
while data = conn.fetchmany():
for row in data:
process(row)
whereas you have to write
while True:
data = conn.fetchmany()
if not data:
Am 26.03.2012 00:59 schrieb Dennis Lee Bieber:
If you use the longer form
con = db.connect()
cur = con.cursor()
the cursor object, in all that I've worked with, does function for
iteration
I use this form regularly with MySQLdb and am now surprised to see that
this is optional according to
在 2012年3月26日星期一UTC+8下午8时11分03秒,Dave Angel写道:
> On 03/26/2012 07:45 AM, redstone-c...@163.com wrote:
> > I know the print statement produces the same result when both of these two
> > instructions are executed ,I just want to know Is there any difference
> > between print 3 and print '3' in Python
> I know the print statement produces the same result when both of these two
> instructions are executed ,I just want to know Is there any difference
> between print 3 and print '3' in Python ?
Sure there is. The first converts the integer 3 to a string ("3"), the second
just prints the given s
On Sunday, March 25, 2012 6:22:10 PM UTC-6, Ben Finney wrote:
> jeff writes:
>
> > On Sunday, March 25, 2012 4:04:55 PM UTC-6, Heiko Wundram wrote:
> > > Am 25.03.2012 23:32, schrieb jeff:
> > > > but I have to be able to get back to root privilege so I can't use
> > > > setgid and setuid.
> > >
redstone-c...@163.com, 26.03.2012 16:28:
> 在 2012年3月26日星期一UTC+8下午8时11分03秒,Dave Angel写道:
>> On 03/26/2012 07:45 AM, redstone-c...@163.com wrote:
>>> I know the print statement produces the same result when both of these two
>>> instructions are executed ,I just want to know Is there any difference
On 3/26/2012 9:44 AM, Robert Kern wrote:
On 3/26/12 2:33 PM, Steven W. Orr wrote:
I created a new class called CaseInsensitiveDict (by stealing from code I found
on the web, thank you very much). The new class inherits from dict. It makes it
so that if the key has a 'lower' method, it will alway
On 3/26/2012 12:59 AM, Mensanator wrote:
OK, GMPY is now called GMPY2. No big deal, I can import as GMPY.
But why were scan0 and scan1 changed to bit_scan0 and bit_scan1?
Guess: Either the functions changed or they want to regularize their names.
What's the justification for that? I use thos
On 3/26/2012 7:45 AM, redstone-c...@163.com wrote:
I know the print statement produces the same result when both of
these two instructions are executed ,I just want to know Is there any
difference between print 3 and print '3' in Python ?
If you want to see the difference between the number and
On 3/26/12 4:33 PM, Steven W. Orr wrote:
On 3/26/2012 9:44 AM, Robert Kern wrote:
On 3/26/12 2:33 PM, Steven W. Orr wrote:
I created a new class called CaseInsensitiveDict (by stealing from code I found
on the web, thank you very much). The new class inherits from dict. It makes it
so that if t
On 3/26/2012 1:36 AM, Steven D'Aprano wrote:
(I seem to recall a language that used a single = for both assignment and
equality testing, guessing which one you meant from context. BASIC
perhaps?
Right. In some Basics, such as MS GW-Basic (I still have their book), a
= b = c meant a = (b = c),
My name is Sathyaish. I am a software engineer.
Last year, i.e. in 2011, I wanted to do some theater. No one took me,
so I announced that I would start my own group. I wrote a script.
Then, I wrote a screen play from that. Now, I am almost ready to begin
the auditions.
The play will be a comedy w
On Mon, Mar 26, 2012 at 3:24 AM, Michael Poeltl
wrote:
import random, string
def random_number(id):
> ... characters = list(string.ascii_lowercase +
> ... string.ascii_uppercase +
> ... string.digits)
> ... coll_rand = []
> ... for
As others have pointed out, the output is the same, because the result
of converting an integer to a string is the string of that integer.
However, other numeric literals might not do what you want, due to the
fact that they are converted to an internal numeric representation, then
converted back t
redstone-c...@163.com wrote:
> I know the print statement produces the same result when both of these two
> instructions are executed ,I just want to know Is there any difference
> between print 3 and print '3' in Python ?
The question you really wanted to ask is: under what circumstances will th
On 03/26/12 08:59, Thomas Rachel wrote:
Am 25.03.2012 15:03 schrieb Tim Chase:
while True:
data = conn.fetchmany()
if not data: break
for row in data:
process(row)
Or simpler
for data in iter(conn.fetchmany, []):
for row in data:
process(row)
Nice! T
On Mar 26, 10:39 am, Terry Reedy wrote:
> On 3/26/2012 12:59 AM, Mensanator wrote:
>
> > OK, GMPY is now called GMPY2. No big deal, I can import as GMPY.
>
> > But why were scan0 and scan1 changed to bit_scan0 and bit_scan1?
>
> Guess: Either the functions changed or they want to regularize their
On Sunday, March 25, 2012 9:59:56 PM UTC-7, Mensanator wrote:
> OK, GMPY is now called GMPY2. No big deal, I can import as GMPY.
>
> But why were scan0 and scan1 changed to bit_scan0 and bit_scan1?
>
> What's the justification for that? I use those functions extensively
> in my library of Collatz
>> I feel the error is in Capital P in print .
>> However the error indicated with "*^*"
>> hints at quote at the end of the line.
>
> Anyway, the hint indicates the last quote because this is the location
> where the python interpreter realizes it won't be able to execute the
> code. You should
〈Perl Documentation: The Key to Perl〉
http://xahlee.org/perl-python/key_to_perl.html
plain text follows
-
So, i wanted to know what the option perl -C does. So, here's perldoc
perlrun. Excerpt:
-C [*number/list*]
The -C flag controls some
Hi,
I'm working on a module, which needs rather heavy renaming of functions
and methods
(naming style, change of functionality, understandability, orthography)
As these modules are used by quite some projects and as I do not want to
force everybody to rename immediately I just want to warn users,
On Mon, 26 Mar 2012 22:26:11 +0200
Gelonida N wrote:
> As these modules are used by quite some projects and as I do not want
> to force everybody to rename immediately I just want to warn users,
> that they call functions, that have been renamed and that will be
> obsoleted.
You want a Deprecat
On Tue, Mar 27, 2012 at 7:26 AM, Gelonida N wrote:
> One option I though of would be:
>
> def obsolete_func(func):
> def call_old(*args, **kwargs):
> print "func is old psl use new one"
> return func(*args, **kwargs)
> return call_old
>
> and
>
> def get_time(a='high'):
> ret
Hi guys just wanted to share one of my first programs. Could you please
tell me, do I use a right logic ?
It works fine what I wanted to do, but is it writen in the right way? My
next step is to make it write the changes of the dictionary on the file :)
## DB
tbook = {'goodie':['Christian','Van E
> Hi guys just wanted to share one of my first programs. Could you please
> tell me, do I use a right logic ?
> It works fine what I wanted to do, but is it writen in the right way? My
> next step is to make it write the changes of the dictionary on the file :)
>
When you do get that far, you sh
Hi Guys
I am fwding this question from the python tutor list in the hope of
reaching more people experienced in concurrent disk access in python.
I am trying to see if there are ways in which I can read a big file
concurrently on a multi core server and process data and write the
output to a sing
>
> 〈Perl Documentation: The Key to Perl〉
> http://xahlee.org/perl-python/key_to_perl.html
>
> plain text follows
> -
>
> So, i wanted to know what the option perl -C does. So, here's perldoc
> perlrun. Excerpt:
[snip]
Maybe I missed something, but what does
Hi,
I've just uploaded pypiserver 0.5.2 to the python package index.
pypiserver is a minimal PyPI compatible server. It can be used to serve
a set of packages and eggs to easy_install or pip.
pypiserver is easy to install (i.e. just easy_install pypiserver). It
doesn't have any external dependen
On Sat, 24 Mar 2012 16:30:28 -0700 (PDT), Xah Lee wrote:
>?Your Regex Brain?
>http://xahlee.org/comp/your_regex_brain.html
>
That's more like a brain cell.
This is more like a regex brain.
'
"\']|"[^"]*"|\'[^\']*\')*? (?<=\s) width \s*=
(?: (?> \s* ([\'"]) \s* (?.*?) \s* \g{-2} )
> ./plot_stuff2.py --plot stuff1 stuff2
> [...]
> plot_stuff2.py: error: argument --plot/--with-plot/--enable-plot/--no-plot/--
> without-plot/--disable-plot: invalid boolean value: 'stuff1'
>
> Problem is --plot takes an optional argument, and so the positional arg is
> assumed to be the arg to --
On Mar 26, 3:56 pm, Abhishek Pratap wrote:
> Hi Guys
>
> I am fwding this question from the python tutor list in the hope of
> reaching more people experienced in concurrent disk access in python.
>
> I am trying to see if there are ways in which I can read a big file
> concurrently on a multi cor
Hi,
(sorry for replying to the old topic)
On Tue, Mar 6, 2012 at 10:29 PM, Javier wrote:
> I am looking for an automated tool for refactoring/obfuscation.
> Something that changes names of functions, variables, or which would
> merge all the functions of various modules in a single module.
> The
Hi all,
I'm getting close to an alpha release of an OAuth 2.0 implementation
(https://github.com/demianbrecht/py-sanction). High level features include:
* Support for multiple providers (protocol deviations). This didn't seem to be
supported by any library.
* Actually an OAuth 2.0 implementatio
Demian Brecht writes:
> I'm getting close to an alpha release of an OAuth 2.0 implementation
> (https://github.com/demianbrecht/py-sanction).
Thank you for doing this work.
As someone who uses OpenID, what can I read about why OAuth is better?
Everything I read is targeted toward either people
In article <87haxahh51@benfinney.id.au>,
Ben Finney wrote:
> Demian Brecht writes:
>
> > I'm getting close to an alpha release of an OAuth 2.0 implementation
> > (https://github.com/demianbrecht/py-sanction).
>
> Thank you for doing this work.
>
> As someone who uses OpenID, what can I r
On Mon, 26 Mar 2012 08:11:03 -0400, Dave Angel wrote:
> On 03/26/2012 07:45 AM, redstone-c...@163.com wrote:
>> I know the print statement produces the same result when both of these
>> two instructions are executed ,I just want to know Is there any
>> difference between print 3 and print '3' in P
Roy Smith writes:
> In article <87haxahh51@benfinney.id.au>,
> Ben Finney wrote:
> > As someone who uses OpenID, what can I read about why OAuth is better?
>
> OpenID is for people who worry about things like how OpenID is different
> from OAuth. Oauth is for people who have no idea what
In article <878vimhfdp@benfinney.id.au>,
Ben Finney wrote:
> Roy Smith writes:
>
> > In article <87haxahh51@benfinney.id.au>,
> > Ben Finney wrote:
> > > As someone who uses OpenID, what can I read about why OAuth is better?
> >
> > OpenID is for people who worry about things like ho
Roy Smith writes:
> In article <878vimhfdp@benfinney.id.au>,
> Ben Finney wrote:
> > So, if I want to be free to choose an identity provider I trust, and
> > it's not Facebook or Google or Twitter or other privacy-hostile
> > services, how does OAuth help me do that?
>
> It doesn't. Well,
On Mar 27, 8:43 am, Steven D'Aprano wrote:
> On Mon, 26 Mar 2012 08:11:03 -0400, Dave Angel wrote:
> > On 03/26/2012 07:45 AM, redstone-c...@163.com wrote:
> >> I know the print statement produces the same result when both of these
> >> two instructions are executed ,I just want to know Is there a
On Tue, Mar 27, 2012 at 12:24 AM, Ben Finney wrote:
> Roy Smith writes:
>
>> In article <878vimhfdp@benfinney.id.au>,
>> Ben Finney wrote:
>> > So, if I want to be free to choose an identity provider I trust, and
>> > it's not Facebook or Google or Twitter or other privacy-hostile
>> > serv
On Monday, 26 March 2012 21:24:35 UTC-7, Ben Finney wrote:
> Roy Smith writes:
>
> > In article <878vimhfdp@benfinney.id.au>,
> > Ben Finney wrote:
> > > So, if I want to be free to choose an identity provider I trust, and
> > > it's not Facebook or Google or Twitter or other privacy-hosti
On Mar 26, 1:33 pm, cas...@gmail.com wrote:
> On Sunday, March 25, 2012 9:59:56 PM UTC-7, Mensanator wrote:
> > OK, GMPY is now called GMPY2. No big deal, I can import as GMPY.
>
> > But why were scan0 and scan1 changed to bit_scan0 and bit_scan1?
>
> > What's the justification for that? I use thos
Thanks for the advice Dennis.
@Steve : I haven't actually written the code. I was thinking more on
the generic side and wanted to check if what I thought made sense and
I now realize it can depend on then the I/O. For starters I was just
thinking about counting lines in a line without doing any c
75 matches
Mail list logo