Re: List Moderator

2007-05-20 Thread Klaus Alexander Seistrup
Grant Edwards wrote: > Maybe I've got a beter news server, but I don't see much > spam at all in c.l.p. Neither do I. Cheers, -- Klaus Alexander Seistrup http://klaus.seistrup.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: number generator

2007-03-10 Thread Klaus Alexander Seistrup
-- Klaus Alexander Seistrup Tv-fri medielicensbetaler http://klaus.seistrup.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
e, urllib; print re.findall("Your IP: (.+?)", urllib.urlopen("http://myip.dk/";).read())[0]' #v- Cheers, -- Klaus Alexander Seistrup http://klaus.seistrup.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
urlopen("http://myip.dk/";).read())[0]' 217.157.1.202 [EMAIL PROTECTED]:~ $ #v- Cheers, -- Klaus Alexander Seistrup http://klaus.seistrup.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
EMAIL PROTECTED]:~ $ python -c 'import socket; print socket.gethostbyaddr(socket.gethostname())' ('zdani.szn.dk', [], ['2001:1448:89::1']) [EMAIL PROTECTED]:~ $ #v- Cheers, -- Klaus Alexander Seistrup http://klaus.seistrup.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: IP address

2007-01-28 Thread Klaus Alexander Seistrup
Colin J. Williams wrote: > Your one-liner doesn't work for me, with Windows XP, but the > following does, within Python. Could it be due to shell-escaping issues? I don't know anything about Windows... Cheers, -- Klaus Alexander Seistrup http://klaus.seistr

Re: How to find out a date/time difference

2006-05-24 Thread Klaus Alexander Seistrup
Lad skrev: > How can I find out the date/time difference ( in days) of such > two fields? Did you try to subtract one value from the other? Mvh, -- Klaus Alexander Seistrup SubZeroNet, Copenhagen, Denmark http://magnetic-ink.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find out a date/time difference

2006-05-24 Thread Klaus Alexander Seistrup
Nico Grubert skrev: > you could do this: > > >>> a = datetime.datetime(2006, 5, 24, 16, 1, 26) > >>> b = datetime.datetime(2006, 5, 20, 12, 1, 26) > >>> a-b > datetime.timedelta(4) > # 4 days Or #v+ >>> print (a-b).days 4 >>>

Re: Generating random passwords ... for a csv file with user details

2006-05-28 Thread Klaus Alexander Seistrup
A simple algorithm is sufficient > for passwords #v+ >>> import sha >>> sha.sha('userid,fullname,passwword,dateofbith').digest().encode('base64')[:10] 'q0nCDQ1YdL' >>> #v- Mvh, -- Klaus Alexander Seistrup SubZeroNet, Copenhagen, Denmark http://magnetic-ink.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: filter list fast

2006-03-18 Thread Klaus Alexander Seistrup
15)) >>> b set([5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) >>> a.difference(b) set([0, 1, 2, 3, 4]) >>> a-b set([0, 1, 2, 3, 4]) >>> list(a-b) [0, 1, 2, 3, 4] >>> #v- Cheers, -- Klaus Alexander Seistrup SubZeroNet, Copenhagen, Denmark http://magnetic-ink.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic list name from a string

2010-12-20 Thread Andre Alexander Bell
Hello, On 12/20/2010 11:08 AM, MarcoS wrote: > Hi, I need to create a list with a dynamic name, something like this: > > '%s_list' %my_dynamic list = [] > > It's this possible? I would suggest you use a dictionary to store your lists like this: lists = {} lists[my_dynamic_list] = [] Maybe yo

Re: simple games w/o pygame

2010-12-22 Thread Andre Alexander Bell
On 22.12.2010 17:40, William Gill wrote: > I am teaching an 11 year old who wants to learn programming. I chose > Python, and it is working well. I seem to remember lots of simple > script games, like quizzes, number games etc. that would be good for his > tutorial. However, now all I can find i

Re: pythonize this!

2010-06-15 Thread Andre Alexander Bell
On 06/15/2010 01:49 PM, superpollo wrote: > my solution: > > [...] > >>> print s > 536926141 Or, if you would like to use numpy: >>> import numpy >>> squares = numpy.arange(1, 2011, dtype=numpy.int)**2 >>> signs = numpy.ones(len(squares), dtype=numpy.int) >>> signs[3::5] = -1 >>> signs[4::5] = -1

Re: pythonize this!

2010-06-18 Thread Andre Alexander Bell
On 06/16/2010 12:47 PM, Lie Ryan wrote: > Probably bending the rules a little bit: > sum(x**2 - 8*x - 20 for x in range(1, 2010, 5)) > 536926141 Bending them even further, the sum of the squares from 1 to N is given by (1) N*(N+1)*(2*N+1)/6. The given problem can be divided into five sums

Re: pythonize this!

2010-06-18 Thread Andre Alexander Bell
On 06/18/2010 03:32 PM, Mark Lawrence wrote: > The good news is that this is easily the fastest piece of code that I've > seen yet. The bad news is that first prize in the speed competition is > a night out with me. :) Well, that actually means that Stefan Behnel will run my solution through cyth

Re: pythonize this!

2010-06-19 Thread Andre Alexander Bell
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/18/2010 05:53 PM, Mark Lawrence wrote: > Andre, looks like a really bad day for you then, *TWO* nights out with > me *AND* (looking at your email address) Germany loosing in the world > cup. :( There are days one looses and there are days the ot

Re: plac 0.5 is out!

2010-06-20 Thread Andre Alexander Bell
On 06/20/2010 11:22 AM, Michele Simionato wrote: > A few weeks ago I presented on this list my most recent effort, plac. > Now there is a *huge* new release: > the size of plac and of its documentation doubled. How about adding some support for internationalization of the generated usage output?

Re: plac 0.5 is out!

2010-06-20 Thread Andre Alexander Bell
On 06/20/2010 11:22 AM, Michele Simionato wrote: > A few weeks ago I presented on this list my most recent effort, plac. > Now there is a *huge* new release: > the size of plac and of its documentation doubled. > [...] > > http://micheles.googlecode.com/hg/plac/doc/plac.html I've read this one..

Re: plac 0.5 is out!

2010-06-21 Thread Andre Alexander Bell
On 06/21/2010 05:38 AM, Michele Simionato wrote: >>> A few weeks ago I presented on this list my most recent effort, plac. >>> http://micheles.googlecode.com/hg/plac/doc/plac_ext.html >> >> But this one is broken. :( > > Aagh! The good one is > http://micheles.googlecode.com/hg/plac/doc/plac_adv

Re: From Dict to Classes yes or no and how

2010-06-22 Thread Andre Alexander Bell
On 06/22/2010 12:05 PM, Jerry Rocteur wrote: > Sorry for the long mail but I've been searching the web for days for how to > do this.. I see that possibilities using > shelve or pickle but I don't want to do this (The source of the data changes > constantly) You might be interested in the csv mo

Re: From Dict to Classes yes or no and how

2010-06-22 Thread Andre Alexander Bell
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/22/2010 01:32 PM, Jerry Rocteur wrote: > My input is NOT CSV, I used this format to try and make the question shorter. > Although I could create a CSV file, I'd > like to learn how to code a class to work the way I described in the question. So

Re: Second attempt WAS: From Dict to Classes yes or no and how

2010-06-22 Thread Andre Alexander Bell
On 06/22/2010 02:03 PM, Jerry Rocteur wrote: >> On Tue, Jun 22, 2010 at 9:32 PM, Jerry Rocteur wrote: >> If you were able to ask us perhaps a more specific question >> and describe your problem a little more concisely perhaps >> I (and we) might have a bit more to offer you. > > I have a dictiona

Re: Python dynamic attribute creation

2010-06-29 Thread Andre Alexander Bell
On 06/25/2010 03:15 PM, WANG Cong wrote: > 1) Modifying a class attribute is metaprogramming, and this is modifying > a class, i.e. adding a new attribute to it, thus this should belong > to metaprogramming. (I know, strictly speaking, maybe my definition of > "metaprogramming" here is incorrect, I

Re: Python dynamic attribute creation

2010-06-30 Thread Andre Alexander Bell
On 06/29/2010 06:46 PM, WANG Cong wrote: > On 06/29/10 17:48, Andre Alexander Bell wrote: >>>>> var a >>>>> a >> -> should raise an variable 'unset' exception >> >> Keep in mind that the module you are writing in is just an object a

Re: python app development

2010-07-03 Thread Andre Alexander Bell
On 07/03/2010 07:48 PM, mo reina wrote: > an anyone recommend a resource (book,tutorial,etc.) that focuses on > application development in python? something similar to Practical > Django Projects, but for stand alone applications instead of web apps > (for now). I think you are referring to GUI ap

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Andre Alexander Bell
On 07/11/2010 10:30 AM, rantingrick wrote: > On Jul 11, 3:03 am, "Günther Dietrich" > wrote: > >> So, it is not a disadvantage that the functions you listed above are >> named in this way. In the contrary, it is an advantage, as it keeps >> newcomers from using stupid variable names. > > "int" f

Re: create dynamic instance

2010-07-16 Thread Andre Alexander Bell
On 07/16/2010 06:01 PM, Ray wrote: > if __name__=='__main__': > for x in range(10): > x=Test() > """ > the question is how do i call x.value outside of that for loop? > something like > print x.value ? > """ You would have to keep references to your Test objects (untested code):

Re: Accumulate function in python

2010-07-19 Thread Andre Alexander Bell
On 07/19/2010 01:18 PM, dhruvbird wrote: > Hello, > I have a list of integers: x = [ 0, 1, 2, 1, 1, 0, 0, 2, 3 ] > And would like to compute the cumulative sum of all the integers > from index zero into another array. So for the array above, I should > get: [ 0, 1, 3, 4, 5, 5, 5, 7, 10 ] > Wh

String formatting with the format string syntax

2010-09-14 Thread Andre Alexander Bell
Hello, I'm used to write in Python something like >>> s = 'some text that says: %(hello)s' and then have a dictionary like >>> english = { 'hello': 'hello' } and get the formatted output like this: >>> s % english Occasionally I want to extract the field names from the template string. I w

Re: String formatting with the format string syntax

2010-09-14 Thread Andre Alexander Bell
On 09/14/2010 08:20 PM, Miki wrote: You can use ** syntax: english = {'hello':'hello'} s.format(**english) Thanks for your answer. Actually your answer tells me that my example was misleading. Consider the template s = 'A template with {variable1} and {variable2} placeholders.' I'm seeking

Re: String formatting with the format string syntax

2010-09-15 Thread Andre Alexander Bell
On 09/15/2010 10:00 AM, Peter Otten wrote: def extract_names(t, recurse=1): for _, name, fmt, _ in t._formatter_parser(): if name is not None: yield name if recurse and fmt is not None: for name in extract_names(fmt, recurse-1): yi

Re: String formatting with the format string syntax

2010-09-15 Thread Andre Alexander Bell
On 09/15/2010 10:48 AM, Peter Otten wrote: I personally would not be too concerned about the leading underscore, but you can use string.Formatter().parse(template) instead. Thanks for this pointer. I like it this way. So if I now combine your generator with your suggestion, I end up with som

Re: Numpy: Multiplying arrays of matrices

2010-09-15 Thread Andre Alexander Bell
Hi, I assume you have arrays like these: >>> import numpy as np >>> m1 = np.random.rand(size=(4,3,3)) >>> m2 = np.random.rand(size=(4,3,3)) So that m1[0] is a 3x3 Matrix and m1[1] is another one, i.e. you have four matrices. On 09/15/2010 01:54 AM, Gregory Ewing wrote: I had thought that do

Re: Numpy: Multiplying arrays of matrices

2010-09-15 Thread Andre Alexander Bell
On 09/16/2010 08:24 AM, Andre Alexander Bell wrote: or you could write the loop >>> m1m2 = np.empty_like(m1) >>> for i in range(m1m2.shape[0]): ... m1m2[i] = np.dot(m1, m2) This should have been ... m1m2[i] = np.dot(m1[i], m2[i]) Sorry for the typo. Andre -- http

Re: isnan

2010-10-11 Thread Andre Alexander Bell
Hi Kenny, On 10/12/2010 05:58 AM, Kenny wrote: > I have an array A, and another one B with same dimention and size. Now I > want to change the delete the elements in A where the same position in B > is nan. How can I do. > > Similar to the matlab code A(find(isnan(B)) = [] How about this: >>> f

Re: isnan

2010-10-12 Thread Andre Alexander Bell
On 10/12/2010 06:22 PM, Ian Kelly wrote: > That's the inverse of what the OP wanted. The full solution: > A[~isnan(B)] > array([2, 3]) Indeed, you are right Ian. Thanks for pointing that out. :) Sorry for the mistake. Regards Andre -- http://mail.python.org/mailman/listinfo/python-list

Re: is list comprehension necessary?

2010-10-26 Thread Andre Alexander Bell
Hello, I occasionally use LCs, if they seem useful. However, what I don't like about LCs is that they 'look-like' being a closed scope, while actually they are in the scope of there call. Example: >>> i = 5 >>> l = [i**2 for i in range(3)] >>> i 2 Regards Andre -- http://mail.python.org/mailm

Re: is list comprehension necessary?

2010-10-26 Thread Andre Alexander Bell
On 10/26/2010 07:22 PM, Ian Kelly wrote: > >>> i = 5 > >>> l = [i**2 for i in range(3)] > >>> i > 2 > > > This has been corrected in Python 3. Sorry. You're right. I forgot to mention that... Andre -- http://mail.python.org/mailman/listinfo/python-list

EuroPython 2018: First list of accepted sessions available

2018-05-31 Thread Alexander C. S. Hendorf
Team https://ep2018.europython.eu/ https://www.europython-society.org/ Alexander Hendorf as EuroPython vice chair & chair of the program work group Twitter: @hendorf LinkedIn: https://www.linkedin.com/in/hendorf EuroPython: https://www.europython.eu/ https://twitter.com/europython h

How to import C++ static library?

2008-04-15 Thread Alexander Dong Back Kim
Hi all, I'm very very beginner of python but I'm dare to ask this question straight away. =P Is it possible to import C++ static library compiled by GCC? The target is definitely Linux machine. I found some examples from Google showing the way C++ can import Python so called embedded python. But

Generating list of rsquared_adj regression values for variating i with loop

2018-04-18 Thread Alexander Hempfing via Python-list
Dear all, I am wondering if someone could please help me with an issue I am currently trying to solve: I have a "static" code which looks as follows: tsd_res_fra_08 =res_fra_08['D_Cummulative'][100] tsd_res_fra_09 =res_fra_09['D_Cummulative'][100] tsd_res_fra_10 =res_fra_10['D_Cummulative'][10

PyConDE 2018 (Germany) & PyData Karlsruhe CfP extended.

2018-05-28 Thread Alexander CS Hendorf [PyConDE 2018]
on.org/blog/fin-aid/ <https://de.pycon.org/blog/fin-aid/> Please familiarise yourself with the conference code of conduct https://de.pycon.org/code-of-conduct/ <https://de.pycon.org/code-of-conduct/> Alexander Hendorf @hendorf as PyConDE & PyData Karlsruhe 2018 program chair & or

EuroSciPy 2019 - CfP is open

2019-04-02 Thread Alexander CS Hendorf [EuroSciPy 2019]
= *** Apologise for multiple posting *** Dear Colleagues, We are delighted to invite you to join us for the 12th European Conference on Python in Science. The EuroSciPy 2019 Conference will take place from September 2 to September 6 in Bilba

UNABLE TO GET IDLE TO RUN

2015-10-22 Thread Terry Alexander via Python-list
Hello... I have tried installing both Python 2.7 and 3.5, and in both cases I cannot get IDLE to work. I received the following message both times: IDLE’s subprocess didn’t make connection.  Either IDLE can’t start a subprocess or personalfirewall software is blocking the connection. I am running

Re: Python 3.8 or later on Debian?

2024-09-18 Thread Alexander Neilson via Python-list
the past I did build newer Python versions (mostly on raspberry pi’s) Regards Alexander Alexander Neilson Neilson Productions Limited 021 329 681 alexan...@neilson.net.nz > On 19 Sep 2024, at 10:42, Ulrich Goebel via Python-list > wrote: > > Hi, > > Debian Linux seems

Possible re bug when using ".*"

2022-12-28 Thread Alexander Richert - NOAA Affiliate via Python-list
? Perhaps relatedly, I noticed that even in 3.6, the code print(re.findall(".*","pattern")) yields ['pattern',''] which is not what I was expecting. Thanks, Alex Richert -- Alexander Richert, PhD *RedLine Performance Systems* -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6