Re: Q's on my first python script

2009-05-10 Thread Andre Engels
On Sun, May 10, 2009 at 5:56 PM, Steven D'Aprano wrote: >> 5. The variable wd is meant to be "global" to the script.  In other >>    languages I've programmed in I've seen some typographic convention >>    used for the name of such variables (e.g. all caps) to signal this >>    widened scope.  Do

Re: Sorting a dictionary

2009-05-12 Thread Andre Engels
On Tue, May 12, 2009 at 1:54 PM, Ronn Ross wrote: > I'm attempting to sort for the results of a dictionary. I would like to > short by the 'key' in ascending order. I have already made several attempts > using: sorted() and .sort(). > Here is my loop: >     for key,value in word_count.items(): >  

Re: What's the use of the else in try/except/else?

2009-05-14 Thread Andre Engels
On Thu, May 14, 2009 at 6:39 AM, ma wrote: > A really great use for try/except/else would be if an object is > implementing its own __getitem__ method, so you would have something > like this: > > class SomeObj(object): >    def __getitem__(self, key): >                try: >                      

Re: python

2009-05-15 Thread Andre Engels
We may be willing to help you with your homework, but we will not be doing it for you. Please tell us what you have got (whether it be a non-working a program, a partial program or just some ideas about what you might need to do) and what you think is stopping you from getting further. 2009/5/15

Re: 4 hundred quadrillonth?

2009-05-21 Thread Andre Engels
On Thu, May 21, 2009 at 11:05 PM, wrote: > The explaination in my introductory Python book is not very > satisfying, and I am hoping someone can explain the following to me: > 4 / 5.0 > 0.80004 > > 4 / 5.0 is 0.8. No more, no less. So what's up with that 4 at the end. > It bother

Re: While Statement

2009-05-22 Thread Andre Engels
On Fri, May 22, 2009 at 11:17 AM, Joel Ross wrote: > Hi all, > > I have this piece of code > > class progess(): > >    def __init__(self, number,  char): > >        total = number >        percentage = number >        while percentage > 0 : >            percentage = int(number/total*100) >        

Re: While Statement

2009-05-22 Thread Andre Engels
On Fri, May 22, 2009 at 12:35 PM, Joel Ross wrote: > Im using 2.6 python and when running this > > class progess(): > >    def __init__(self, number, total,  char): > >        percentage = float(number/total*100) >        percentage = int(round(percentage)) >        char = char * percentage >    

Re: Inheritance and Design Question

2009-05-27 Thread Andre Engels
On Wed, May 27, 2009 at 9:58 PM, imageguy wrote: > I have an object the I would like to use as a base class.  Some of the > methods I would like to override completely, but others I would simply > like to call the base class method and use the return value in the > child method.  The purpose here

Re: "TypeError: 'int' object is not callable"

2009-06-01 Thread Andre Engels
On Mon, Jun 1, 2009 at 12:40 PM, Visco Shaun wrote: > when I was executing the below code I got "TypeError: 'int' object is > not callable" exception. Why is it so? > > if type(c) == type(ERROR): > > c can be a string or an integer representing an error Could you please give a larger piece of cod

Re: extended setattr()

2008-07-08 Thread Andre Adrian
Diez B. Roggisch nospam.web.de> writes: > > def ext_setattr(obj, attr, val): > > for subattr in attr.split("."): > > obj = getattr(obj, subattr) > > obj = val > > > import test > a = A() > > Traceback (most recent call last): > > File "", line 1, in > > NameError: na

collaborative web navigation tool in python (z9)

2006-03-15 Thread Andre Rodrigues
Hi all, I'm working on an experimental collaborative web navigation tool in python and zope. The basic idea is to map users interests in web pages and use this to provide persolaniled services, like recommended pages, filtered searches, etc. The address is http://andrers52.dyndns.org:8080/z9 I'

Re: Question about file objects...

2009-12-02 Thread Andre Engels
On Wed, Dec 2, 2009 at 3:14 PM, J wrote: > Something that came up in class... > > when you are pulling data from a file using f.next(), the file is read > one line at a time. > > What was explained to us is that Python iterates the file based on a > carriage return as the delimiter. > But what if

Re: Why the expression "(1)" is not an one-arity tuple, but int ?

2009-12-04 Thread Andre Engels
2009/12/4 Петров Александр : > Hello All ! > > In my code I try to use a generic approach to work with tuples. Let > "X" be a tuple. > When I want to access a first element of a tuple, I can write: "X[0]". > And that is really working when X is a n-arity tuple, with n>1 (for > example "foo( (1,2,3)

Re: a list/re problem

2009-12-11 Thread Andre Engels
On Fri, Dec 11, 2009 at 9:49 PM, Ed Keith wrote: > I have a problem and I am trying to find a solution to it that is both > efficient and elegant. > > I have a list call it 'l': > > l = ['asc', '*nbh*', 'jlsdjfdk', 'ikjh', '*jkjsdfjasd*', 'rewr'] > > Notice that some of the items in the list start

Re: Symbols as parameters?

2010-01-21 Thread Andre Engels
On Thu, Jan 21, 2010 at 8:43 AM, Martin Drautzburg wrote: > Hello all, > > When passing parameters to a function, you sometimes need a paramter > which can only assume certain values, e.g. > >        def move (direction): >                ... > If direction can only be "up", "down", "left" or "rig

Re: scraping with urllib2

2010-01-26 Thread Andre Engels
On Wed, Jan 27, 2010 at 6:26 AM, Patrick wrote: > I'm trying to scrape the attached link for the price listed $99.99: > http://bananarepublic.gap.com/browse/product.do?cid=41559&vid=1&pid=692392 > > I can see the price if I view the source(I even turned off java and > javascript), but when I use u

Re: myths about python 3

2010-01-27 Thread Andre Engels
On Wed, Jan 27, 2010 at 11:32 AM, Daniel Fetchinson wrote: > Hi folks, > > I was going to write this post for a while because all sorts of myths > periodically come up on this list about python 3. I don't think the > posters mean to spread false information on purpose, they simply are > not aware

Re: list.extend([]) Question

2010-01-30 Thread Andre Engels
On Sat, Jan 30, 2010 at 4:32 PM, Dan Brown wrote: > Why does extending a list with the empty list result in None?  It > seems very counterintuitive to me, at least --- I expected ['a'].extend > ([]) to result in ['a'], not None. Extend is a method of the list. The list itself is changed, it does

Re: How to use variable in a file name

2009-09-29 Thread Andre Engels
On Tue, Sep 29, 2009 at 3:35 PM, kks wrote: > if myFile variable contains the actual filename then how can i open a > file for wirte so that complete filename appears as > "actualname_kks.txt" open(myFile + "_kks.txt", "w") -- André Engels, andreeng...@gmail.com -- http://mail.python.org/mailm

Re: unicode issue

2009-09-30 Thread Andre Engels
On Wed, Sep 30, 2009 at 9:34 AM, gentlestone wrote: > Why don't work this code on Python 2.6? Or how can I do this job? Please be more specific than "it doesn't work": * What exactly are you doing * What were you expecting the result of that to be * What is the actual result? -- André Engels, a

Re: unicode issue

2009-09-30 Thread Andre Engels
I get the feeling that the problem is with the Python interactive mode. It does not have full unicode support, so u"Žabovitá zmiešaná kaša" is changed to u'\x8eabovit\xe1 zmie\x9aan\xe1 ka\x9aa'. If you call your code from another program, it might work correctly. -- André Engels, andreeng...@gm

Re: a=[1,2,3,4].reverse() - why "a" is None?

2009-10-12 Thread Andre Engels
The reverse function is a function to reverse the list in place, not a function to get the reverse of the list: x = [1,2,3,4] y = x z = x.reverse() will result in: x = y = [4,3,2,1] z = None -- André Engels, andreeng...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: a=[1,2,3,4].reverse() - why "a" is None?

2009-10-12 Thread Andre Engels
On Mon, Oct 12, 2009 at 10:44 AM, Nadav Chernin wrote: > >        Chris Withers wrote: > >        ...becauase you were looking for: > >        reversed([1,2,3,4]) > > OK, but my question is generic. Why when I use object's function that > changed values of the object, I can't to get value of it on

Re: for loop: range() result has too many items

2009-10-13 Thread Andre Engels
On Tue, Oct 13, 2009 at 11:17 PM, Peng Yu wrote: > Hi, > > The following code does not run because range() does not accept a big > number. Is there a way to make the code work. I'm wondering if there > is a way to write a for-loop in python similar to that of C style. > > for(int i = 0; i < a_big_

Re: for loop: range() result has too many items

2009-10-13 Thread Andre Engels
On Tue, Oct 13, 2009 at 11:55 PM, Andre Engels wrote: > for i in range(sys.maxint): >    if i % 100 == 0: >       print i Grmbl cut-and-paste error... I meant of course: for i in xrange(sys.maxint): if i % 100 == 0: print i -- André Engels, andreeng...@gmail.com

Re: id( ) function question

2009-10-14 Thread Andre Engels
What is going on is that a few objects that are often used, in particular the small (how small is small depends on the implementation) integers, are 'preloaded'. When one of these is then referred to, a new object is not created, but the pre-defined object is used. 10 is apparently a preloaded cons

Re: Are there any modules for IRC, that work with Python 3.1?

2009-10-15 Thread Andre Pereira
Try IRC IT (II) from suckless (http://tools.suckless.org/ii). Quoting: ii is a minimalist FIFO and filesystem-based IRC client. It creates an irc directory tree with server, channel and nick name directories. In every directory a FIFO in file and a normal out file is created. The in file is

Re: [OT] Supporting "homework" (was: Re: Checking a Number for Palindromic Behavior)

2009-10-22 Thread Andre Engels
On Thu, Oct 22, 2009 at 7:04 AM, Dieter Maurer wrote: > Steven D'Aprano writes on 20 Oct 2009 > 05:35:18 GMT: >> As far as I'm concerned, asking for help on homework without being honest >> up-front about it and making an effort first, is cheating by breaking the >> social contract. Anyone who r

Re: Parsing a large number of parms to a print statement.

2009-10-22 Thread Andre Engels
On Thu, Oct 22, 2009 at 11:16 PM, KB wrote: > Hi, > > I have to pass over 150 parameters to a print statement ala: > > print "%s %s %s <150'th unique text> %s" % (v > [0], v[1], ... v[150]) > > I can't use a for loop like I normally would over the list "v" due to > the different text fragmen

Re: how to remove the same words in the paragraph

2009-11-03 Thread Andre Engels
On Tue, Nov 3, 2009 at 11:13 PM, kylin wrote: > I need to remove the word if it appears in the paragraph twice. could > some give me some clue or some useful function in the python. Well, it depends a bit on what you call 'the same word' (In the paragraph "Fly fly, fly!" does the word fly occur 0

Re: Program to compute and print 1000th prime number

2009-11-07 Thread Andre Engels
On Sat, Nov 7, 2009 at 6:40 PM, Mensanator wrote: >> Tongue in cheek solution: >> >> import urllib2 >> >> url = 'http://primes.utm.edu/lists/small/1.txt' >> primes = [] >> for line in urllib2.urlopen(url).read().splitlines(): >>     values = line.split() >>     if len(values) == 10: >>      

Re: Most efficient way to "pre-grow" a list?

2009-11-07 Thread Andre Engels
On Sat, Nov 7, 2009 at 8:25 PM, Luis Alberto Zarrabeitia Gomez wrote: > > Quoting Bruno Desthuilliers : > >> > Another situation where one may want to do this is if one needs to >> > initialize a non-sparse array in a non-sequential order, >> >> Then use a dict. > > Ok, he has a dict. > > Now what

Re: Is there something similar to list comprehension in dict?

2009-11-20 Thread Andre Engels
On Fri, Nov 20, 2009 at 4:18 AM, Peng Yu wrote: > I'm wondering if there is something similar to list comprehension for > dict (please see the example code below). > > > d = dict(one=1, two=2) > print d > > def fun(d):#Is there a way similar to list comprehension to change the > argument d so that

Re: Bizarre arithmetic results

2010-02-11 Thread Andre Engels
On Thu, Feb 11, 2010 at 1:44 AM, Terrence Cole wrote: > Can someone explain to me what python is doing here? > > Python 3.1.1 (r311:74480, Feb  3 2010, 13:36:47) > [GCC 4.3.4] on linux2 > Type "help", "copyright", "credits" or "license" for more information. -0.1 ** 0.1 > -0.7943282347242815

Re: The Disappearing Program?

2010-02-19 Thread Andre Engels
On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson wrote: > I've successfully compiled several small python programs on Win XP into > executables using py2exe. A program goes from a name like snowball.py to > snowball. A dir in the command prompt window finds snowball.py but not > snowball. If I type in

Re: The Disappearing Program?

2010-02-19 Thread Andre Engels
On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence wrote: > Andre Engels wrote: >> >> On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson >> wrote: >>> >>> I've successfully compiled several small python programs on Win XP into >>> executables using p

Re: case do problem

2010-03-03 Thread Andre Engels
On Tue, Mar 2, 2010 at 6:46 PM, Tracubik wrote: > and, generally > speaking, the try..except block slow down the execution of the program or > not? Try...except tends to be slow when the exception does occur, fast when it does not. Apart from that, if these fraction-of-a-fraction-of-a-second ga

Re: Interest check in some delicious syntactic sugar for "except:pass"

2010-03-03 Thread Andre Engels
On Wed, Mar 3, 2010 at 10:27 AM, Oren Elrad wrote: > Howdy all, longtime appreciative user, first time mailer-inner. > > I'm wondering if there is any support (tepid better than none) for the > following syntactic sugar: > > silence: > block > > -> > > try: > .

Re: Can't define __call__ within __init__?

2010-03-11 Thread Andre Engels
On Thu, Mar 11, 2010 at 2:30 PM, Steve Holden wrote: >> The example I showed was just a toy problem.  The real problem is >> I expect to call a function many times, and I want to avoid the overhead of >> the 'if blah' everytime. >> > This is a premature optimization. First, make it work. Then (if

Re: Where can i reference the "regular expressions"

2010-03-24 Thread Andre Engels
On Wed, Mar 24, 2010 at 10:07 AM, John Smithury wrote: > Dear pythoners, > > I'm a new member to studay the python, i wan't to studay the "regular > expressions" handle like below: > > ==source > the > is > name > ==source end= > > > after convert, the r

Re: Where can i reference the "regular expressions"

2010-03-24 Thread Andre Engels
On Wed, Mar 24, 2010 at 10:34 AM, John Smithury wrote: > ==source > the > is > name > ==source end= > > First, get the word only(discard the "" and ""), it can use > regular expression, right? > > the > is > name > Second, get a charactor in each word an

Re: Teaching Programming

2010-05-04 Thread Andre Engels
On Tue, May 4, 2010 at 4:35 PM, James Mills wrote: > On Wed, May 5, 2010 at 12:21 AM, Ed Keith wrote: >> To deal with indentation I had to >> >>   1) keep track of indentation of all chunks of code embedded in the >>      document and indent inserted chunks to the sum of all the >>      indentati

Re: solve a newspaper quiz

2010-05-09 Thread Andre Engels
On Sun, May 9, 2010 at 11:31 AM, Xavier Ho wrote: > On Sun, May 9, 2010 at 7:20 PM, superpollo wrote: >> >> "if a b c are digits, solve ab:c=a*c+b" > > Sorry, what does the notation ab:c mean? The number ab divided by c. -- André Engels, andreeng...@gmail.com -- http://mail.python.org/mailma

Re: random number including 1 - i.e. [0,1]

2009-06-10 Thread Andre Engels
On Wed, Jun 10, 2009 at 8:25 AM, John Yeung wrote: > That uniform(a, b) will return a random float in the semi-open > interval [a, b) for certain values of a and b; and in the closed > interval [a, b] for other values of a and b.  (Swap a and b if a > b.) > > To me, the fact that you sometimes get

Re: Question about None

2009-06-14 Thread Andre Engels
On Sat, Jun 13, 2009 at 7:23 PM, John Yeung wrote: > Paul LaFollette is probably thinking along the lines of formal logic > or set theory.  It's a little bit confused because programming isn't > quite the same as math, and so it's a common question when designing > and implementing programming lan

Re: Question about None

2009-06-14 Thread Andre Engels
On Sun, Jun 14, 2009 at 6:49 PM, Paul LaFollette wrote: > Now, suppose that I want to generate, say, the set of all ordered > trees with N nodes.   I need to be able to represent the empty ordered > tree, i.e. the tree with with zero nodes.  There are a lot of ways I > could do this.  The problem i

Re: Question about None

2009-06-14 Thread Andre Engels
On Sun, Jun 14, 2009 at 9:37 PM, Paul Rubin<http://phr...@nospam.invalid> wrote: > Andre Engels writes: >> I don't see why that would be the case. Something of the type "thingy" >> is ONE thingy. Nothing is ZERO thingies, so it is not something of the >

Re: Question about None

2009-06-14 Thread Andre Engels
On Sun, Jun 14, 2009 at 10:21 PM, Paul Rubin<http://phr...@nospam.invalid> wrote: > Andre Engels writes: >> > That seems to confuse values with collections of them.  A car is not >> > the same as a one-element list of cars.  Nothing is not the same as a >> >

Re: waling a directory with very many files

2009-06-14 Thread Andre Engels
On Sun, Jun 14, 2009 at 6:35 PM, tom wrote: > i can traverse a directory using os.listdir() or os.walk(). but if a > directory has a very large number of files, these methods produce very > large objects talking a lot of memory. > > in other languages one can avoid generating such an object by walk

Re: wikipedia with python

2009-06-22 Thread Andre Engels
On Mon, Jun 22, 2009 at 6:58 PM, zelegolas wrote: > Let me know if it's the right place to ask. > > I'm looking for wiki writen with python where I can import all > wikipedia site. > If you have any links please let me know. I don't think that's possible. If you wnat to import Wikipedia in a wiki,

Re: wikipedia with python

2009-06-22 Thread Andre Engels
On Mon, Jun 22, 2009 at 8:24 PM, ZeLegolas wrote: > Well sorry I was not clear. I have a wiki running with mediawiki and I want > to import in a wiki written with python. I don't think it will work, but you could try using the Special:Export page. -- André Engels, andreeng...@gmail.com -- ht

Re: wikipedia with python

2009-06-24 Thread Andre Engels
On Wed, Jun 24, 2009 at 9:17 AM, Tim Harig wrote: > [ ] D. You already have mediawiki running on a webserver; but, you would >        like to get data from another mediawiki server that you don't have >        direct database access to; so, you would like to write a script in >        Python to sc

Re: 3.2*2 is 9.6 ... or maybe it isn't?

2009-06-26 Thread Andre Engels
On Fri, Jun 26, 2009 at 5:07 PM, Scott David Daniels wrote: > pdpi wrote: >> >> ... But since 10 = 2 * 5, all numbers that can be finitely represented in >> binary can be represented finitely in decimal as well, with the exact >> same number of  places for the fractional part (and no more digits >>

Re: finding most common elements between thousands of multiple arrays.

2009-07-04 Thread Andre Engels
On Sat, Jul 4, 2009 at 9:33 AM, mclovin wrote: > Currently I need to find the most common elements in thousands of > arrays within one large array (arround 2 million instances with ~70k > unique elements) > > so I set up a dictionary to handle the counting so when I am > iterating  I up the count o

Re: Creating alot of class instances?

2009-07-05 Thread Andre Engels
On 7/5/09, kk wrote: > I am new to Python classes and trying to figure out this particular > issue here. I will need to create instances of a class. But at the > moment I do not know how many instances I will end up having, in every > case it might be different. Most of the documents I read m

Re: Clarity vs. code reuse/generality

2009-07-06 Thread Andre Engels
On Mon, Jul 6, 2009 at 9:44 AM, Martin Vilcans wrote: > On Fri, Jul 3, 2009 at 4:05 PM, kj wrote: >> I'm will be teaching a programming class to novices, and I've run >> into a clear conflict between two of the principles I'd like to >> teach: code clarity vs. code reuse.  I'd love your opinion abo

Re: Clarity vs. code reuse/generality

2009-07-07 Thread Andre Engels
On Tue, Jul 7, 2009 at 8:01 PM, pdpi wrote: > He asserts: >    assert lo < hi > but then compares: >    sense = cmp(func(hi), func(lo)) > > sense can't ever be anything other than 1. It can - there is no necessity that func is monotonically increasing. -- André Engels, andreeng...@gmail.com --

Re: Try... except....Try again?

2009-07-17 Thread Andre Engels
On Fri, Jul 17, 2009 at 7:31 AM, Xavier Ho wrote: > I have a simple class that generates prime numbers, using memorisation and > iteration to generate the next prime number. > > In the class, I have defined a function that gives, say, the 5th prime > number. Or the 1000th, it's still very fast. But

Re: time in milliseconds by calling time.time()

2009-07-24 Thread Andre Engels
On Sat, Jul 25, 2009 at 3:27 AM, Roy Smith wrote: > Keep in mind that while a float may have a large apparent precision, > there's no promise that the actual value returned by the OS has that much > precision.  You should be fine if all you're looking for is ms, but I > wouldn't count on much more

Re: len() should always return something

2009-07-24 Thread Andre Engels
On Sat, Jul 25, 2009 at 4:50 AM, Dr. Phillip M. Feldman wrote: > > Here's a simple-minded example: > > def dumbfunc(xs): >   for x in xs: >      print x > > This function works fine if xs is a list of floats, but not if it is single > float.  It can be made to work as follows: > > def dumbfunc(xs):

Re: looping through values in a dictionary and appending to a list

2009-08-12 Thread Andre Engels
On Tue, Aug 11, 2009 at 8:17 PM, Krishna Pacifici wrote: > Nevermind, > got it. > > Sorry. > Krishna Pacifici 08/11/09 2:12 PM >>> > Hi, > I want to append the values of a dictionary to a list.  I have a dictionary > sec_dict_clean and I want to append the values to a list, but am having a > h

Re: Scraping Wikipedia with Python

2009-08-13 Thread Andre Engels
On Tue, Aug 11, 2009 at 8:53 PM, David C Ullrich wrote: > Try reading a little there! Starting there I went to > > http://en.wikipedia.org/wiki/Wikipedia:Creating_a_bot > > where I found a section on existing bots, comments on how the "scraping" > is not what you want, and even a Python section wi

Re: variables of the class are not available as default values?

2009-08-27 Thread Andre Engels
On Thu, Aug 27, 2009 at 11:37 PM, seanacais wrote: > I'm working on a program where I wish to define the default value of a > method as a value that was set in __init__.  I get a compilation error > saying that self is undefined. > > As always a code snippet helps :-) > > class foo: >    def __init

Re: Why does this group have so much spam?

2009-09-01 Thread Andre Engels
On Sun, Aug 30, 2009 at 11:18 AM, David<71da...@libero.it> wrote: > Il Sat, 29 Aug 2009 17:18:46 -0700 (PDT), casebash ha scritto: > >> So much of it could be removed even by simple keyword filtering. > > I think there is only one final solution to the spam pestilence: a tiny tax > on email and pos

Re: NameError: name '__main__' is not defined

2009-09-14 Thread Andre Engels
On Mon, Sep 14, 2009 at 4:29 AM, Sean DiZazzo wrote: > Is this a production program that you are using?? > > Please show us the point you are trying to make in something more > valuable. I find this a very bad comment. Not only is it rude, it is condemning a behaviour I would see as beneficial.

Re: unpacking vars from list of tuples

2009-09-15 Thread Andre Engels
On Tue, Sep 15, 2009 at 11:51 PM, Ross wrote: > I'm inexperienced with some of the fancy list slicing syntaxes where > python shines. > > If I have a list of tuples: > >   k=[("a", "bob", "c"), ("p", "joe", "d"), ("x", "mary", "z")] > > and I want to pull the middle element out of each tuple to ma

Re: How to write pbm file in Python 3?

2010-10-30 Thread Andre Roberge
On Sun, Oct 31, 2010 at 1:32 AM, Chris Rebert wrote: > On Sat, Oct 30, 2010 at 9:21 PM, André wrote: > > On Oct 31, 1:11 am, Chris Rebert wrote: > >> On Sat, Oct 30, 2010 at 8:32 PM, André wrote: > >> > I'm trying to create pbm (portable bitmap) files using Python 3 and > >> > have run into a

Re: Merging multiple sorted sequences.

2017-04-17 Thread Andre Müller
Hi, when you have lists with different lengths and want to zip them, you should look at itertools.zip_longest Greetings Andre -- https://mail.python.org/mailman/listinfo/python-list

Re: write arrays to disk

2017-04-17 Thread Andre Müller
mpy.fromfile(fd, dtype=numpy.int) What you should not do: arr = [1, 2, 3, 4] with open('plain.txt', 'wt') as fd: fd.write(repr(arr)) with open('plain.txt') as fd: arr = eval(fd.read()) If you need to store more data, you should think about a database.

Re: Bigotry and hate speech on the python mailing list

2017-04-18 Thread Andre Müller
ed up about politics, war and hate? Then just make a new constitution. Greetings Andre Müller signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mailman/listinfo/python-list

Re: Practice Python

2017-05-10 Thread Andre Müller
hon 3 is ;-) Python 2.7 feels old... it is old. Please learn Python 3. Greetings Andre Am 08.05.2017 um 08:52 schrieb gyrhgyrh...@gmail.com: > Python - Exercise 5 > 1. Write a function that gets a list (list) of numbers. The function returns > a new list of ordered square numbers from t

Re: Practice Python

2017-05-10 Thread Andre Müller
Am 10.05.2017 um 14:18 schrieb Chris Angelico: > On Wed, May 10, 2017 at 10:11 PM, Andre Müller wrote: >> 1.) a short example for Python 3, but not exactly what they want. >> >> def square(numbers): >> yield from sorted(n**2 for n in numbers) >> >

Re: Referring to a module by a string without using eval()

2017-05-17 Thread Andre Müller
at(key, self._name)) return Module(ret) else: print('Attribute {} is not a module. It\'s a {}'.format(key, type(ret))) return ret def __getitem__(self, key): return self.__getattr__(key) os_wrapped = Module(os) sub1 =

Re: Hello from a super noob!

2017-06-08 Thread Andre Müller
Hello, you can refactor your code a little bit and learn more about exceptions: def get_numbers(): first = None second = None while True: try: if first is None: first = int(input('Enter your first number: ')) if second is None:

Re: Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-14 Thread Andre Müller
lazy evaluated object # using this just as a dummy # if you're using legacy Python (2.x), then use the xrange function for it # or you'll get a memory error max_count = 10 step = 1 for i, element in enumerate(islice(iterable, 0, max_count, step), start=1): print(i, element)

Re: API Help

2017-06-14 Thread Andre Müller
e': 0.0, 'warehouseCode': 'WA-1-US'}, #{'quantityAvailable': 0.0, 'warehouseCode': 'PO-1-CA'}], #'itemNumber': '75-5044'}] # the interesting part for items in inventory: # get the elements in from the list #

Re: Converting epoch to string in format yyyy-mm-dd, or maybe it is not necessary

2017-06-14 Thread Andre Müller
;s a datetime object. Greetings Andre -- https://mail.python.org/mailman/listinfo/python-list

Re: How do you use Python 3.5 and Python 3.6 in production

2017-06-14 Thread Andre Müller
Hi, I'm using Arch Linux. There is currently Python 3.6 the standard interpreter. But I think it's not good to use this in production. Hm, maybe pyenv can be an distribution independent solution: https://github.com/pyenv/pyenv If you're using pyenv, then you'll have some build dependencies. One t

Re: Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-16 Thread Andre Müller
Am 15.06.2017 um 07:09 schrieb Jussi Piitulainen: > Andre Müller writes: > >> I'm a fan of infinite sequences. Try out itertools.islice. >> You should not underestimate this very important module. >> >> Please read also the documentation: >> https://d

Re: os.walk the apostrophe and unicode

2017-06-24 Thread Andre Müller
Can os.fsencode and os.fsdecode help? I've seen it somewhere. I've never used it. To fix encodings, sometimes I use the module ftfy Greetings Andre -- https://mail.python.org/mailman/listinfo/python-list

Re: "Python launcher" required to run *.py scripts on Windows?

2017-06-27 Thread Andre Müller
Double Post: https://python-forum.io/Thread-Python-launcher-required-to-run-py-scripts-on-Windows Pleas don't do this. It's not a nice behavior. Thanks. Andre -- https://mail.python.org/mailman/listinfo/python-list

Re: A Good Tutorial on Python Decorators

2017-06-27 Thread Andre Müller
Activate JavaScript, then you can see the content. I had the same problem. Peter Pearson schrieb am Di., 27. Juni 2017 um 18:35 Uhr: > On Tue, 27 Jun 2017 15:10:53 + (UTC), Saurabh Chaturvedi wrote: > > https://opensource.google.com/projects/py-decorators-tutorial > > "No Results found." > >

Re: why are these 2 fucking clowns in here ?

2017-06-30 Thread Andre Müller
Just don't read it. Calm down. -- https://mail.python.org/mailman/listinfo/python-list

Re: pyserial and end-of-line specification

2017-07-15 Thread Andre Müller
Random(ser), newline='yourline_ending') If it's readonly: sio = io.TextIOWrapper(io.BufferedReader(ser), newline='yourline_ending') I never tried it, but your question leads me to take a look into this cool features of the io module. Greetings Andre -- https://mail.python.org/mailman/listinfo/python-list

Re: Regular expression

2017-07-26 Thread Andre Müller
fname = 'first-324-True-rms-kjhg-Meterc639.html' # with string manipulation stem, suffix = fname.rsplit('.', 1) print(stem[-4:]) # oo-style with str manipulation import pathlib path = pathlib.Path(fname) print(path.stem[-4:]) -- https://mail.python.org/mailman/listinfo/python-list

EuroPython 2021: Talk Voting is Open

2021-05-17 Thread Marc-Andre Lemburg
Talk voting is your chance to tell us what you’d like to see at EuroPython 2021. We will leave talk voting open until: Sunday, May 23, 23:59:59 CEST In order to vote, please log in to the website and navigate to the talk voting page: * EuroPython 2021 Talk

EuroPython 2021: Session List Available

2021-05-31 Thread Marc-Andre Lemburg
Our program work group (WG) has been working hard over the last week to select sessions for EuroPython 2021, based on your talk voting and our diversity criteria. We’re now happy to announce the initial list with more than 100 sessions, brought to you by more than 100 speakers.

EuroPython 2021: Schedule published

2021-06-17 Thread Marc-Andre Lemburg
After two weeks of hard work by our program workgroup, we are very excited to announce the EuroPython 2021 schedule: * EuroPython 2021 Schedule * https://ep2021.europython.eu/schedule/ Seven full days of Python - EuroPython 2021 will

EuroPython 2021: Free tickets for Python Core Developers

2021-06-25 Thread Marc-Andre Lemburg
In 2019, we have set up the Guido van Rossum Core Developer Grant, to make it easy for Python Core Developers to attend EuroPython, but also to give something back to the core team and add a perk to make core development more attractive. If you are a core developer, please check our grant page for

EuroPython 2021: Volume Discount for Company Teams

2021-06-29 Thread Marc-Andre Lemburg
EuroPython 2021 offers special discounts on business tickets for company teams. * EuroPython Volume Discounts * https://ep2021.europython.eu/sponsor/packages/#Volume-Discount If you are going to attend the conference as a team, we offer the following volume discounts

EuroPython 2021: Trainings and Workshops

2021-07-06 Thread Marc-Andre Lemburg
Have you ever wanted to build an image search system, take a deep dive into pytest or learn about algorithmic trading? Then we have a treat for you! The EuroPython conference will start with two full training and workshop days on Monday, July 26th, and Tuesday, July 27th: * Eu

EuroPython 2021: Opening our Merchandise Shop

2021-07-08 Thread Marc-Andre Lemburg
We’re very happy to announce our merchandise shop for EuroPython 2021, with a fabulous new design for the attendee t-shirts: * EuroPython 2021 Merch Shop * https://ep2021.europython.eu/europython/europython-merchandise-shop/ You can find the shop under the "EuroPython

EuroPython 2021: Conference Organisers & Community Discounts

2021-07-16 Thread Marc-Andre Lemburg
The EuroPython Society (EPS) exists not only to run the EuroPython Conference, but also to support the wider Python community in Europe. It accomplishes this in many ways; here are two of them! * EuroPython Society supporting the community * https://blog.europython.eu/europython-202

EuroPython 2021: Keynotes and Booklet

2021-07-19 Thread Marc-Andre Lemburg
EuroPython 2021 begins next week. We are proud to present the keynote speakers and our conference booklet. Keynotes The following keynotes will take place on Wednesday, Thursday and Friday. Tickets are still available. If you want to find out more about our keynote speakers, please head

EuroPython 2021: Full-Day Workshops

2021-07-20 Thread Marc-Andre Lemburg
This year's edition of EuroPython begins with two days of training sessions as outlined in the schedule. Many of these last 3 hours, however, we would like to highlight two specific workshops available to those who want a deeper dive. They are most valuable for people new to the Python language and

EuroPython 2021: Data Science Mini-Conference

2021-07-22 Thread Marc-Andre Lemburg
It has become a tradition at EuroPython to include a special data science track. * EuroPython 2021 Data Science Mini-Conference * https://ep2021.europython.eu/events/data-science/ This year, we have expanded on the theme and included more data science related content than ever be

EuroPython Society: General Assembly 2021

2021-09-25 Thread Marc-Andre Lemburg
As last year, we are holding the General Assembly (GA) of the EuroPython Society (EPS) online for this year. General Assembly In accordance with our bylaws, we are calling for the EuroPython Society General Assembly to be held on Sunday, October 10th 2020, from 19:00 - 21:00 CEST

Re: c extension finding the module in object initialization

2021-09-27 Thread Marc-Andre Lemburg
Hi Robin, seeing that no one replied to your question, I'd suggest to ask this on the Python C-API ML: https://mail.python.org/mailman3/lists/capi-sig.python.org/ That's where the experts are, including the ones who implemented the mutli-phase logic. Cheers, -- Marc-Andre Lemburg

EuroPython 2021: Edited videos of the first day available

2021-09-27 Thread Marc-Andre Lemburg
We’re happy to release the first 42 cut videos of EuroPython 2021 covering the first day sessions of the conference. You can watch them on our YouTube channel: * EuroPython 2021 Playlist * https://www.youtube.com/playlist?list=PL8uoeex94UhHgMD9GOCbEHWku7pEPx9fW Over the next

EuroPython 2021: Edited videos of the second day available

2021-10-04 Thread Marc-Andre Lemburg
We’re happy to release another batch of 35 cut videos of EuroPython 2021 covering most of the second day sessions of the conference. Together with the first day videos, we now have 77 videos waiting for you. You can watch them on our YouTube channel: * EuroPython 2021 Playlist

<    1   2   3   >