Re: [Tutor] There's a Programmer in Me

2013-02-27 Thread Albert-Jan Roskam
> On Tue, Feb 26, 2013 at 4:00 PM, Albert-Jan Roskam > wrote: >> >> What I like about R: if I do 'print(func)' (or fix(func)), it > prints the >> source code of the function. It would be cool if Python had something >> similar. Instead Python pri

Re: [Tutor] Problem with os.system

2013-03-01 Thread Albert-Jan Roskam
>I was using python for some application which used to create directories and >also to run some exes using the os.system command from a program.py file which >was working fine. For some reasons I got my system formatted and got the >windows 7 installed. >  >Now again I installed python and trie

Re: [Tutor] Fwd: findall() returns tuples or string?

2013-03-06 Thread Albert-Jan Roskam
>> I have some confusion regarding when findall returns a list of strings >> and when it returns a list of tuples. >> Would appreciate an explanation. > >re is not my strongest suite but I'll have a go. > >My understanding of how findall works is that it returns a list of matches. If >groups are

Re: [Tutor] BMI calc

2013-03-13 Thread Albert-Jan Roskam
>> Yes, you are right, of course. >> Thanks for reminding me that we are dealing with floats. >> I should have used approximations, with an (epsilon) error range. >> I will remember if future, I hope. > > The solution I had in mind is simpler: > > if bmi < 18.5: >     print "underweight" > elif b

[Tutor] tadaahh! But how to identify zLinux?

2013-04-01 Thread Albert-Jan Roskam
tadaah, I uploaded my first package some time ago: http://pypi.python.org/pypi/savReaderWriter Let me use this opportunity to say THANKS to all of you for all your advise! I'm still stuck with a question though. The program is supposed to work with zLinux (IBM system Z). But how do I know that t

Re: [Tutor] tadaahh! But how to identify zLinux?

2013-04-02 Thread Albert-Jan Roskam
> Subject: Re: [Tutor] tadaahh! But how to identify zLinux? > > On 02/04/13 09:00, Alan Gauld wrote: >> On 01/04/13 21:04, Albert-Jan Roskam wrote: >> >>> program is supposed to work with zLinux (IBM system Z). But how do I >>> know that this system is used

Re: [Tutor] tadaahh! But how to identify zLinux?

2013-04-02 Thread Albert-Jan Roskam
> From: eryksun > To: Albert-Jan Roskam > Cc: tutor@python.org > Sent: Tuesday, April 2, 2013 4:57 AM > Subject: Re: [Tutor] tadaahh! But how to identify zLinux? > > On Mon, Apr 1, 2013 at 6:42 PM, Steven D'Aprano > wrote: >> By the way, I don't know th

Re: [Tutor] Appending an extra column in a data file

2013-04-10 Thread Albert-Jan Roskam
> Subject: Re: [Tutor] Appending an extra column in a data file >   > The file you attached is a space-delimited text file. If you want to > add a third column with the value '1.0' on every row you can just do: > > with open('old.dat') as fin, open('new.dat', 'w') as > fout: >     for line in

Re: [Tutor] Appending an extra column in a data file

2013-04-11 Thread Albert-Jan Roskam
> Subject: Re: [Tutor] Appending an extra column in a data file > > On Wed, Apr 10, 2013 at 5:49 PM, Oscar Benjamin > wrote: >>>     fin = open('old.dat') >>>     fout = open('new.dat', 'w') >>> >>>     with fin, fout: >>>         for line in fin: >> >> This has the same problems as contextli

Re: [Tutor] Sharing Code Snippets

2013-04-11 Thread Albert-Jan Roskam
> Subject: [Tutor] Sharing Code Snippets > > Hello everyone, > > I am not sure if this has been shared on this list. However, to help > both those seeking help and those wanting to help, may I suggest that > for all of you posting your programs, how about using a service such > as GitHub's Gists

Re: [Tutor] Appending an extra column in a data file

2013-04-11 Thread Albert-Jan Roskam
>> Cool. This solves a problem it had with contextlib.nested some time ago. >> (sorry for kinda hijacking this thread, but..) >> Would it be safe (both __exit__ calls are guaranteed to be made) to use >> code like this (if it worked, that is!)? > > Partly because it doesn't work I really can't f

[Tutor] design question (Django?)

2013-04-13 Thread Albert-Jan Roskam
Hi, I am doing volunteer work for a charity. The job is to coordinate money collecting activities of people who raise money with collecting-boxes. I am involved with one postal code  4 (pc4) area (our postal codes have the format 1234 AB (postal code 6). So 'one postal code 4 area'  means [0-9]

Re: [Tutor] design question (Django?)

2013-04-13 Thread Albert-Jan Roskam
Hi Alan, Thanks for your reply! > Subject: Re: [Tutor] design question (Django?) > > Some clarification please. > >> (1) Database design. Here are the database tables I think are necessary: >> tblPostalcode: pc6, streetname, nHouseholds, isVisitable, remarks >> tblCollectorSelection: colle

Re: [Tutor] design question (Django?)

2013-04-14 Thread Albert-Jan Roskam
 > Subject: Re: [Tutor] design question (Django?) > > On 13/04/13 09:48, Albert-Jan Roskam wrote: > >> I think I have to make a diagram of this. This stuff is quite hard > > You could use a simple UML class diagram (class -> table). See the OOP topic > in my V

Re: [Tutor] design question (Django?)

2013-04-20 Thread Albert-Jan Roskam
On Sun, 14 Apr 2013, Don Jennings wrote: > > >> >> >>>On Apr 14, 2013, at 7:06 AM, Albert-Jan Roskam wrote: >>> >>> >>> >>>> >>>>> Subject: Re: [Tutor] design question (Django?) >>>> >>>> &

[Tutor] string.Template

2013-04-23 Thread Albert-Jan Roskam
Hello, Is there a better, *built-in* alternative for the code below? The recursion works, but it feels like reinventing the wheel. import string def translate(template, *args):     """Recursively $-substitute using as a replacement"""     syntax = string.Template(template).substitute(*args)  

Re: [Tutor] string.Template

2013-04-23 Thread Albert-Jan Roskam
> Subject: Re: [Tutor] string.Template > > On 24/04/13 00:14, Albert-Jan Roskam wrote: >> Hello, >> >> Is there a better, *built-in* alternative for the code below? The recursion > works, >> but it feels like reinventing the wheel. > > What m

Re: [Tutor] trouble installing library

2013-04-23 Thread Albert-Jan Roskam
ImportError: No module named virtualenv > >what happens if you cd to the directory where you untarred the file, then run >"python setup.py install"Did you download the right version (for Python3)? >Am i installing it correctly? can anyone offer any help? Im on Windows Vista, >and i have both pyt

Re: [Tutor] trouble installing library

2013-04-23 Thread Albert-Jan Roskam
Subject: Re: [Tutor] trouble installing library > >guys having got the install to work, a part of the process fails me.. the full >code instruction is: >  >$ virtualenv --no-site-packages gmapenv >$ cd gmapenv >$ ls >bin/  include/  lib/ >$ . bin/activate >  >since im on windows i used di

Re: [Tutor] trouble installing library

2013-04-24 Thread Albert-Jan Roskam
Subject: Re: [Tutor] trouble installing library > >Thanks for the help guys >  >>> Scripts\activate.bat is a relative path, assuming your current working >>> directory is that of the virtual environment. > >your suggestion work. Initially i was doing Scripts/activate or >Scripts/activate.bat. I

[Tutor] MutableString/Class variables

2013-05-09 Thread Albert-Jan Roskam
Hello, I was just playing a bit with Python and I wanted to make a mutable string, that supports item assignment. Is the way below the way to do this?  The part I am not sure about is the class variable. Maybe I should also have reimplemented __init__, then call super inside this and add an upda

Re: [Tutor] MutableString/Class variables

2013-05-09 Thread Albert-Jan Roskam
> Subject: Re: [Tutor] MutableString/Class variables > > On 05/09/2013 08:10 AM, Albert-Jan Roskam wrote: >> Hello, >> >> I was just playing a bit with Python and I wanted to make a mutable string, > that supports item assignment. Is the way below the way to

Re: [Tutor] MutableString/Class variables

2013-05-10 Thread Albert-Jan Roskam
>Subject: Re: [Tutor] MutableString/Class variables >On 05/09/2013 09:16 AM, Albert-Jan Roskam wrote: >>> On 05/09/2013 08:10 AM, Albert-Jan Roskam wrote: >>>>   Hello, >>>> >>>>   I was just playing a bit with Python and I wanted to make a mut

Re: [Tutor] PyScripter header?

2013-05-10 Thread Albert-Jan Roskam
> Sent: Wednesday, May 8, 2013 1:38 PM > Subject: Re: [Tutor] PyScripter header? > > El 08/05/13 05:10, Jim Mooney escribió: >> >> PyScripter has enough extra features, that I'll probably switch to it. >> But has anyone found any odd problems with it? Tks. >> >> Jim >> > > Given that you

Re: [Tutor] MutableString/Class variables

2013-05-10 Thread Albert-Jan Roskam
> From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Friday, May 10, 2013 1:28 PM > Subject: Re: [Tutor] MutableString/Class variables > > On 09/05/13 22:10, Albert-Jan Roskam wrote: >> Hello, >> >> I was just playing a bit with

[Tutor] why is unichr(sys.maxunicode) blank?

2013-05-17 Thread Albert-Jan Roskam
Hi, I was curious what the "high" four-byte ut8 unicode characters look like. Why does the snippet below not print anything (well, it will eventually, I think, but at that point I have lost my patience already). Puh-lease tell me there are no such things as Mongolian, Chinese backspaces and oth

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread Albert-Jan Roskam
>> I was curious what the "high" four-byte ut8 unicode characters look like. > >By the way, your sentence above reflects a misunderstanding. Unicode >characters (strictly speaking, code points) are not "bytes", four or >otherwise. They are abstract entities represented by a number between 0 an

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread Albert-Jan Roskam
- Original Message - > From: eryksun > To: tutor@python.org > Cc: > Sent: Saturday, May 18, 2013 5:28 AM > Subject: Re: [Tutor] why is unichr(sys.maxunicode) blank? > > On Fri, May 17, 2013 at 11:06 PM, Dave Angel wrote: >> One tool that can help is the name function in module unico

Re: [Tutor] use python to change the webpage content?

2013-05-18 Thread Albert-Jan Roskam
>There is a online simulator about a physic project I'm doing and I want to use >the data the simulator generates on that website. I can get data using >urllib.request and regular expression but I also want to change some of the >input values and then get different sets of data. However, if I

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread Albert-Jan Roskam
> >> East Asian languages. But later on Joel Spolsky's "standard" > page about unicode >> I read that it goes to 6 bytes. That's what I implied when I mentioned > "utf8". > > Each surrogate in a UTF-16 surrogate pair is 10 bits, for a total of > 20-bits. Thus UTF-16 sets the upper bound on

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-19 Thread Albert-Jan Roskam
- Original Message - > From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Sunday, May 19, 2013 3:34 AM > Subject: Re: [Tutor] why is unichr(sys.maxunicode) blank? > > On 19/05/13 02:45, Albert-Jan Roskam wrote about locales: > >> It is pr

Re: [Tutor] Which version of python should i use?

2013-05-20 Thread Albert-Jan Roskam
>On Mon, May 20, 2013 at 5:59 AM, Amal Thomas wrote: >> I am a beginner. I am using a unix sytem (ubuntu 12.10). Python 2.7.3  is >> installed in my system. I found out that Python has version upto 3.3.2. >> Should I update my python version? > >Ubuntu 12.10 should have 3.2.3 installed (the pyth

Re: [Tutor] Which version of python should i use?

2013-05-21 Thread Albert-Jan Roskam
> Subject: Re: [Tutor] Which version of python should i use? > > Hello Amal, > > On Mon, May 20, 2013 at 11:24 PM, Amal Thomas > wrote: >> Thank you very much..!! I am starting to learn python for my Bioinformatics >> work, so I would look for the version that has libraries helpful for me..

Re: [Tutor] still nosing around

2013-05-22 Thread Albert-Jan Roskam
  > Personally, I recommend you start with doctests rather than nose or unittest. Doctests can also be run using nose, maybe that's also an idea? Nose does doctest, unittest, and its own tests. By default, test files need to have a prefix "test_". Unless you specify this either as a comman

Re: [Tutor] trying to split or rpartition the contents of a list

2013-05-22 Thread Albert-Jan Roskam
> >forobjectinobjects:sorted(set(object.split('_',1)[0]))cmds.menuItem(label >=object,parent ="objectMenu") "sorted" returns the sorted list but you don't assign anything to it. You can either assign it to a variable, or use the .sort method instead. Also, you don't need to specify the maxspl

Re: [Tutor] try..except - what about that ton of **Error statements?

2013-05-22 Thread Albert-Jan Roskam
> Subject: Re: [Tutor] try..except - what about that ton of **Error statements? > > On 23/05/13 02:09, boB Stepp wrote: > >> I was not aware that hardware damage could be caused by poor >> programming. I am curious; can you give some examples of how this >> might occur? There used to be a p

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread Albert-Jan Roskam
> A tuple is defined by commas, depending on context. However, > parentheses are typically required because commas have low precedence. > >     >>> 1, 2 + 3, 4 >     (1, 5, 4) > >     >>> (1, 2) + (3, 4) >     (1, 2, 3, 4) > > An empty tuple is a special case: > >     >>> x = () >     >>> typ

Re: [Tutor] Fwd: Difference between types

2013-05-25 Thread Albert-Jan Roskam
> From: Dave Angel >To: tutor@python.org >Sent: Friday, May 24, 2013 9:10 PM >Subject: Re: [Tutor] Fwd: Difference between types > > >On 05/24/2013 02:53 PM, Albert-Jan Roskam wrote: >> >> >>> A tuple is defined by commas, depending on context. Howev

[Tutor] walk registry using _winreg

2013-05-29 Thread Albert-Jan Roskam
Hello, I created a program to go through the windows registry and look for a certain key ("file_locations", though in the example I am using a key that every windows user has on his/her computer). If found, I want to replace the data associated with value "temp_dir" in that key. I have chosen t

Re: [Tutor] walk registry using _winreg

2013-05-30 Thread Albert-Jan Roskam
__ >From: Dave Angel >To: tutor@python.org >Sent: Wednesday, May 29, 2013 2:11 PM >Subject: Re: [Tutor] walk registry using _winreg > > >On 05/29/2013 04:11 AM, Albert-Jan Roskam wrote: >> Hello, >> >> I created a program to g

Re: [Tutor] google spreadsheet

2013-05-30 Thread Albert-Jan Roskam
___ > From: Sumeet Singh >To: "tutor@python.org" >Sent: Thursday, May 30, 2013 6:35 PM >Subject: [Tutor] google spreadsheet > > > >Hey Hi >if possible can u guys please help me regarding accessing Google spreadsheet >with the help of python >i have gone through

Re: [Tutor] walk registry using _winreg

2013-05-30 Thread Albert-Jan Roskam
In addition to my previous reply: here's a colour-coded version of the code: http://pastebin.com/bZEezDSG ("Readability counts")   Regards, Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine,

Re: [Tutor] walk registry using _winreg

2013-05-31 Thread Albert-Jan Roskam
- Original Message - > From: eryksun > To: Albert-Jan Roskam > Cc: Dave Angel ; "tutor@python.org" > Sent: Thursday, May 30, 2013 10:05 PM > Subject: Re: [Tutor] walk registry using _winreg > > On Thu, May 30, 2013 at 10:47 AM, Albert-Jan Roskam &

[Tutor] regex grouping/capturing

2013-06-13 Thread Albert-Jan Roskam
  Hello,   I have a string of the form "required optional3 optional2 optional1 optional3" ('optional' may be any kind of string, so it's not simply 'optional\d+'. I would like to use a regex so I can distinguish groups. Desired outcome: ('required', 'optional3', 'optional2', 'optional1', 'optiona

Re: [Tutor] regex grouping/capturing

2013-06-14 Thread Albert-Jan Roskam
- Original Message - > From: Andreas Perstinger > To: tutor@python.org > Cc: > Sent: Thursday, June 13, 2013 8:09 PM > Subject: Re: [Tutor] regex grouping/capturing > > On 13.06.2013 17:09, Albert-Jan Roskam wrote: >> I have a string of the form "requir

Re: [Tutor] regex grouping/capturing

2013-06-18 Thread Albert-Jan Roskam
- Original Message - > From: Andreas Perstinger > To: "tutor@python.org" > Cc: > Sent: Friday, June 14, 2013 2:23 PM > Subject: Re: [Tutor] regex grouping/capturing > > On 14.06.2013 10:48, Albert-Jan Roskam wrote: >> I am trying to create a pygmen

Re: [Tutor] regex grouping/capturing

2013-06-18 Thread Albert-Jan Roskam
- Original Message - > From: Oscar Benjamin > To: Tutor@python.org > Cc: > Sent: Tuesday, June 18, 2013 12:42 PM > Subject: Re: [Tutor] regex grouping/capturing > > On 18 June 2013 09:27, Albert-Jan Roskam wrote: >>  from pygments.lexer impor

Re: [Tutor] appending/updating values dict key value pairs

2013-06-22 Thread Albert-Jan Roskam
> From: Sivaram Neelakantan >To: tutor@python.org >Sent: Saturday, June 22, 2013 7:52 PM >Subject: Re: [Tutor] appending/updating values dict key value pairs > > >On Sat, Jun 22 2013,Mark Lawrence wrote: > > >[snipped 7 lines] > >> b = { 'a': [4, 5]} >>

Re: [Tutor] "farkadoodle" or: unique global names, was Re: Data persistence problem

2013-06-22 Thread Albert-Jan Roskam
  > One catch with Python nested scopes is that binding a name defaults to > the local scope. You can get around this by using a mutable container, > just as was done with globals before the "global" keyword was added in > version 0.9.4 (1991). The better solution is a new keyword, but adding >

Re: [Tutor] How convert an int to a string

2013-06-22 Thread Albert-Jan Roskam
--- Original Message - > From: Jim Byrnes > To: tutor@python.org > Cc: > Sent: Saturday, June 22, 2013 11:01 PM > Subject: [Tutor] How convert an int to a string > > I need to convert a series of digits like 060713 to a string so I can > make it look like a date 06-07-13. > a = 06

Re: [Tutor] mistaken about splitting expressions over lines

2013-06-25 Thread Albert-Jan Roskam
___ >From: eryksun >To: Jim Mooney >Cc: tutor@python.org >Sent: Tuesday, June 25, 2013 2:14 PM >Subject: Re: [Tutor] mistaken about splitting expressions over lines > >    >>> a = ('this'  # this way >    ...      ' string' ' is long') # is more flexible >    >>>

Re: [Tutor] using python with photoshop

2013-08-20 Thread Albert-Jan Roskam
> From: charles le guen >To: tutor@python.org >Sent: Tuesday, August 20, 2013 9:16 PM >Subject: [Tutor] using python with photoshop > >Hi > >I'm running Windows 7 64 bit and I want to manipulate psd photoshop files >using python. > >Google searches led me to a

Re: [Tutor] spss.BasePivotTable

2013-08-27 Thread Albert-Jan Roskam
Romans ever done for us? ~~  - Original Message - > From: Albert-Jan Roskam > To: Python Mailing List > Cc: > Sent: Tuesday, August 27, 2013 3:14 PM > Subject: [Tutor] spss.BasePivotTable > > Hel

[Tutor] spss.BasePivotTable

2013-08-27 Thread Albert-Jan Roskam
Hello,   I am trying to create a BasePivot table with three columns: one for the labels, one for a a category "Before" and one for "After". The following attempt fails, but what am I doing wrong?   begin program. import spss try:     spss.StartSPSS()     #spss.Submit("get file='demo.sav'.")     s

Re: [Tutor] spss.BasePivotTable

2013-08-28 Thread Albert-Jan Roskam
From: Steven D'Aprano >To: tutor@python.org >Sent: Wednesday, August 28, 2013 4:19 AM >Subject: Re: [Tutor] spss.BasePivotTable > > >On 27/08/13 23:14, Albert-Jan Roskam wrote: >> Hello, >> >> I am trying to create a BasePivot table with three col

[Tutor] myown.getfilesystemencoding()

2013-08-30 Thread Albert-Jan Roskam
In Windows, sys.getfilesystemencoding() returns 'mbcs' (multibyte code system), which doesn't say very much imho. So I wrote the function below, which returns the codepage as reported by the windows chcp command. I noticed that the function returns 850 (codepage 850) when I run it via the comman

Re: [Tutor] myown.getfilesystemencoding()

2013-09-04 Thread Albert-Jan Roskam
- Original Message - > From: eryksun > To: Oscar Benjamin ; Albert-Jan Roskam > > Cc: Python Mailing List > Sent: Sunday, September 1, 2013 7:30 AM > Subject: Re: [Tutor] myown.getfilesystemencoding() > > On Sat, Aug 31, 2013 at 9:16 AM, Oscar Benjamin >

[Tutor] Python 2 & 3 and unittest

2013-09-04 Thread Albert-Jan Roskam
Hi, I am trying to make my app work in Python 2.7 and Python 3.3 (one codebase) and I might later also try to make it work on Python 2.6 and Python 3.2 (if I am not too fed up with it ;-). I was very happy to notice that the 'b' prefix for bytes objects is also supported for byte strings in Pyt

Re: [Tutor] Python 2 & 3 and unittest

2013-09-05 Thread Albert-Jan Roskam
- Original Message - > From: Peter Otten <__pete...@web.de> > To: tutor@python.org > Cc: > Sent: Thursday, September 5, 2013 8:29 AM > Subject: Re: [Tutor] Python 2 & 3 and unittest > > Steven D'Aprano wrote: > >> On Thu, Sep 05, 2013 at 09:11:50AM +1000, Steven D'Aprano wrote: >> >>> I

Re: [Tutor] Python 2 & 3 and unittest

2013-09-05 Thread Albert-Jan Roskam
- Original Message - > From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Thursday, September 5, 2013 1:11 AM > Subject: Re: [Tutor] Python 2 & 3 and unittest > > On Wed, Sep 04, 2013 at 06:30:12AM -0700, Albert-Jan Roskam wrote: >> Hi, >&

Re: [Tutor] Python 2 & 3 and unittest

2013-09-05 Thread Albert-Jan Roskam
Original Message - > From: Don Jennings > To: Albert-Jan Roskam > Cc: Python Mailing List > Sent: Wednesday, September 4, 2013 4:15 PM > Subject: Re: [Tutor] Python 2 & 3 and unittest > > > On Sep 4, 2013, at 9:30 AM, Albert-Jan Roskam wrote: > >

[Tutor] Polymorphic function in Python 2 & 3?

2013-09-07 Thread Albert-Jan Roskam
Hi, I have a class and I want it's initializer to be able to take both byte strings (python 3: byte objects) and unicode strings (python 3: strings). So it's foward compatible Python 2 code (or backward compatible Python 3 code, if you like). If needed, the arguments of __init__ are converted i

Re: [Tutor] How to add modules?

2013-09-19 Thread Albert-Jan Roskam
> From: eryksun >To: Naman Kothari >Cc: tutor@python.org >Sent: Thursday, September 19, 2013 2:37 PM >Subject: Re: [Tutor] How to add modules? > > >On Thu, Sep 19, 2013 at 6:05 AM, Peter Otten <__pete...@web.de> wrote: >> As I'm not a windows user have no firs

Re: [Tutor] AntiSpam measures circumventing

2013-09-23 Thread Albert-Jan Roskam
- Original Message - > From: Jugurtha Hadjar > To: tutor@python.org > Cc: > Sent: Friday, September 20, 2013 4:50 PM > Subject: [Tutor] AntiSpam measures circumventing > > Hello, > > I shared some assembly code (microcontrollers) and I had a comment wit > my e-mail address for conta

[Tutor] ImportError: No module named '_sysconfigdata_m'

2013-09-23 Thread Albert-Jan Roskam
Hi, I just wanted to type "git status" in my Linux terminal but I made a typo and I got a long Python 3.3 traceback message. Just curious: What does it mean? gigt status Traceback (most recent call last):   File "/usr/lib/python3.3/site.py", line 631, in     main()   File "/usr/lib/python3.3/si

Re: [Tutor] ImportError: No module named '_sysconfigdata_m'

2013-09-24 Thread Albert-Jan Roskam
> From: Oscar Benjamin >To: Albert-Jan Roskam >Cc: Python Mailing List >Sent: Tuesday, September 24, 2013 1:47 PM >Subject: Re: [Tutor] ImportError: No module named '_sysconfigdata_m' > > >On 23 September 2013 20:28, Albert

Re: [Tutor] ImportError: No module named '_sysconfigdata_m'

2013-09-24 Thread Albert-Jan Roskam
- Original Message - > From: Oscar Benjamin > To: Albert-Jan Roskam > Cc: Python Mailing List > Sent: Tuesday, September 24, 2013 2:33 PM > Subject: Re: [Tutor] ImportError: No module named '_sysconfigdata_m' >> I was planning to reply after I h

Re: [Tutor] ImportError: No module named '_sysconfigdata_m'

2013-09-24 Thread Albert-Jan Roskam
- Original Message - > From: eryksun > To: Albert-Jan Roskam > Cc: Python Mailing List > Sent: Tuesday, September 24, 2013 5:25 PM > Subject: Re: [Tutor] ImportError: No module named '_sysconfigdata_m' > > On Tue, Sep 24, 2013 at 8:18 AM, Albert-Jan

Re: [Tutor] How to create dictionaries loadable with import

2013-09-25 Thread Albert-Jan Roskam
- Original Message - > From: "Treder, Robert" > To: "tutor@python.org" > Cc: > Sent: Wednesday, September 25, 2013 6:09 PM > Subject: Re: [Tutor] How to create dictionaries loadable with import > >T hanks for the suggestions and sorry about the errors when I tried to >anonymize > m

Re: [Tutor] ImportError: No module named '_sysconfigdata_m'

2013-09-25 Thread Albert-Jan Roskam
- Original Message - > From: Oscar Benjamin > To: Steven D'Aprano > Cc: "Tutor@python.org" > Sent: Wednesday, September 25, 2013 11:58 AM > Subject: Re: [Tutor] ImportError: No module named '_sysconfigdata_m' > > On 25 September 2013 00:25, Steven D'Aprano > wrote: >> On Tue, Sep

[Tutor] OT: docopt

2013-09-25 Thread Albert-Jan Roskam
Hi, Docopt is an alternative to optparse and argparse. Incredibly cool, and fun (check out the youtube movie!): http://docopt.org/ Just in case you missed it (like me). Regards, Albert-Jan  ps: sorry if I posted this twice. ~

[Tutor] class decorator question

2013-10-05 Thread Albert-Jan Roskam
Hi, On http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/ I saw a very cool and useful example of a class decorator. It (re)implements __str__ and __unicode__ in case Python 2 is used. For Python 3, the decorator does nothing. I wanted to generalize this decorator so the __str__ metho

Re: [Tutor] class decorator question

2013-10-05 Thread Albert-Jan Roskam
___ > From: Steven D'Aprano >To: tutor@python.org >Sent: Saturday, October 5, 2013 3:14 PM >Subject: Re: [Tutor] class decorator question > >On Sat, Oct 05, 2013 at 05:33:46AM -0700, Albert-Jan Roskam wrote: >> Hi, >> >> On

Re: [Tutor] class decorator question

2013-10-06 Thread Albert-Jan Roskam
- Original Message - > From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Sunday, October 6, 2013 4:52 AM > Subject: Re: [Tutor] class decorator question > > On Sat, Oct 05, 2013 at 12:26:14PM -0700, Albert-Jan Roskam wrote: > >> >

Re: [Tutor] Parse text with python

2013-10-17 Thread Albert-Jan Roskam
On Thursday, October 17, 2013 9:54 PM, Danilo Chilene wrote: Hello, > >I have the text below: > >CSMP0097I 14.42.12 CPU-B SS-BSS  SSU-AA   IS-02 >  >-LAL USER CONTROL FILE- >MAXIMUM DEFINABLE USERS    - 14999 >MAXIMUM CONFIGURABLE USERS - 11790 >CURRENT NUMBER USERS -   09692 > USER FLUSH

Re: [Tutor] Reading CSV files in Pandas

2013-10-20 Thread Albert-Jan Roskam
On Sun, 10/20/13, Mark Lawrence wrote: Subject: Re: [Tutor] Reading CSV files in Pandas To: tutor@python.org Date: Sunday, October 20, 2013, 1:16 AM On 19/10/2013 23:40, Alan Gauld wrote: > This is the second time I've seen pandas mentioned recedntly I really > must go and look it up

Re: [Tutor] string list in alphabetical!

2013-10-21 Thread Albert-Jan Roskam
On Mon, 10/21/13, Lukas Nemec wrote: Subject: Re: [Tutor] string list in alphabetical! To: tutor@python.org Date: Monday, October 21, 2013, 1:21 PM On 10/21/2013 01:16 PM, Steven D'Aprano wrote: > On Sun, Oct 20, 2013 at 09:15:05PM -0500, Samm

Re: [Tutor] Beginner Question

2013-10-23 Thread Albert-Jan Roskam
On Wed, 10/23/13, Steven D'Aprano wrote: Subject: Re: [Tutor] Beginner Question To: tutor@python.org Date: Wednesday, October 23, 2013, 5:27 AM On Tue, Oct 22, 2013 at 04:25:59PM +0200, Sven Hennig wrote: >  Hello, I would like to learn a progr

[Tutor] why does platform.architecture default to sys.executable?

2013-10-26 Thread Albert-Jan Roskam
Hi, Why does the "executable" parameter default to sys.executable? Yesterday I was surprised to see platform.architecture return "32bit" on a 64-bit system, just because a 32-bit Python interpreter was installed. Wouldn't this make more sense: import sys, platform pf = sys.platform.lower()[:3

Re: [Tutor] why does platform.architecture default to sys.executable?

2013-10-26 Thread Albert-Jan Roskam
--- On Sat, 10/26/13, Amit Saha wrote: Subject: Re: [Tutor] why does platform.architecture default to sys.executable? To: "Albert-Jan Roskam" Cc: "Python Mailing List" Date: Saturday, October 26, 2013, 6:51 PM On Sun, Oct

Re: [Tutor] Graphs and Python

2013-10-28 Thread Albert-Jan Roskam
On Mon, 10/28/13, Mark Lawrence wrote: Subject: Re: [Tutor] Graphs and Python To: tutor@python.org Date: Monday, October 28, 2013, 7:38 PM On 28/10/2013 16:27, SAMADI, BEHROKH wrote: > Hi > I need to use a graph manipulation and visualization

Re: [Tutor] UnicodeDecodeError while parsing a .csv file.

2013-10-29 Thread Albert-Jan Roskam
--- On Tue, 10/29/13, eryksun wrote: Subject: Re: [Tutor] UnicodeDecodeError while parsing a .csv file. To: "Steven D'Aprano" Cc: tutor@python.org Date: Tuesday, October 29, 2013, 3:24 AM On Mon, Oct 28, 2013 at 7:49 PM, Steven D'Aprano wrote:

[Tutor] load test a web application?

2013-11-01 Thread Albert-Jan Roskam
Hi, I am looking at three Github-like programs (Stash, Gitbucket and Trac) to see if they could be used in our company. I would like to test the reliability and stability of at least one of them (I won't do any tests if some required functionality is missing). I am curious whether the program

Re: [Tutor] load test a web application?

2013-11-02 Thread Albert-Jan Roskam
--- On Fri, 11/1/13, Mark Lawrence wrote: Subject: Re: [Tutor] load test a web application? To: tutor@python.org Date: Friday, November 1, 2013, 3:05 PM On 01/11/2013 09:51, Albert-Jan Roskam wrote: > Hi, > > I am looking at three Gi

Re: [Tutor] Is there a package to "un-mangle" characters?

2013-11-22 Thread Albert-Jan Roskam
> Today I had a csv file in utf-8 encoding, but part of the accented > characters were mangled. The data were scraped from a website and it > turned out that at least some of the data were mangled on the website > already. Bits of the text were actually cp1252 (or cp850), I think, > even

Re: [Tutor] Is there a package to "un-mangle" characters?

2013-11-23 Thread Albert-Jan Roskam
On Fri, 11/22/13, Steven D'Aprano wrote: Subject: Re: [Tutor] Is there a package to "un-mangle" characters? To: tutor@python.org Date: Friday, November 22, 2013, 4:30 PM On Thu, Nov 21, 2013 at 12:04:19PM -0800, Albert-Jan Rosk

[Tutor] Is there a package to "un-mangle" characters?

2013-11-21 Thread Albert-Jan Roskam
Hi, Today I had a csv file in utf-8 encoding, but part of the accented characters were mangled. The data were scraped from a website and it turned out that at least some of the data were mangled on the website already. Bits of the text were actually cp1252 (or cp850), I think, even though the w

Re: [Tutor] Usefulness of classes and necessity of inheriting classes

2013-11-25 Thread Albert-Jan Roskam
Another case in in Network management. Network management systems use what is called a MIB. A Management Information Base. The MIB is usually defined in terms of Managed Objects(MO). There is a standard protocol (a set of methods or API) that all MOs must adhere to. Specific types of ne

[Tutor] string replacement in Python 2 and 3

2013-11-26 Thread Albert-Jan Roskam
Hi, String replacement works quite differently with bytes objects in Python 3 than with string objects in Python 2. What is the best way to make example #1 below run in Python 2 and 3? Should one really decode the bytes keys and (if applicable) the values to unicode? The code gets so bloated wi

Re: [Tutor] string replacement in Python 2 and 3

2013-11-27 Thread Albert-Jan Roskam
On Wed, 11/27/13, Steven D'Aprano wrote: Subject: Re: [Tutor] string replacement in Python 2 and 3 To: tutor@python.org Date: Wednesday, November 27, 2013, 12:36 AM On Tue, Nov 26, 2013 at 11:42:29AM -0800, Albert-Jan Roskam wrote:

[Tutor] ignoring diacritical signs

2013-12-02 Thread Albert-Jan Roskam
Hi, I created the code below because I want to compare two fields while ignoring the diacritical signs. I thought it'd be cool to overload __eq__ for this. Is this a good approach, or have I been fixated too much on using the __eq__ special method? # -*- coding: utf-8 -*- class Equalize(obj

Re: [Tutor] ignoring diacritical signs

2013-12-02 Thread Albert-Jan Roskam
On Mon, 12/2/13, Steven D'Aprano wrote: Subject: Re: [Tutor] ignoring diacritical signs To: tutor@python.org Date: Monday, December 2, 2013, 4:53 PM On Mon, Dec 02, 2013 at 06:11:04AM -0800, Albert-Jan Roskam wrote: > Hi, > > I created the code below because I want

Re: [Tutor] Question about distribute in pypi

2013-12-27 Thread Albert-Jan Roskam
Subject: Re: [Tutor] Question about distribute in pypi To: "daedae11" Cc: tutor@python.org Date: Friday, December 27, 2013, 8:19 AM On Thu, Dec 26, 2013 at 11:06 PM, daedae11 wrote: > Are distribute 0.6.49 and distribute 0.7.3 the same plugin's different > version? distribute is a

Re: [Tutor] Activating virtualenv in Windows

2014-01-07 Thread Albert-Jan Roskam
-- On Mon, Jan 6, 2014 1:01 PM CET eryksun wrote: >On Mon, Jan 6, 2014 at 5:59 AM, Rafael Knuth wrote: >> >> does anyone know how to activate virtualenv in Windows? >> Virtualevwrapper works great on Linux, maybe on Widows too: https://pypi.python.org/pypi/

Re: [Tutor] arrangement of datafile

2014-01-10 Thread Albert-Jan Roskam
Ok, it's clear already that the OP has a csv file so the following is OFF-TOPIC. I was reading Python Cookbook and I saw a recipe to read fixed width files using struct.unpack. Much shorter and faster (esp. if you use compiled structs) than indexing. I thought this is a pretty cool approach: h

[Tutor] when is "pythondontwritebytecode" useful?

2014-01-20 Thread Albert-Jan Roskam
Hi, When is setting a PYTHONDONTWRITEBYTECODE environment variable useful? Or set sys.dont_write_bytecode to True? Or start Python with the -B option? I know what it does (http://docs.python.org/2/using/cmdline.html#envvar-PYTHONDONTWRITEBYTECODE), i.e. no pyc or pyo fiules are written, but WH

Re: [Tutor] when is "pythondontwritebytecode" useful?

2014-01-21 Thread Albert-Jan Roskam
>On Mon, Jan 20, 2014 at 5:42 AM, Albert-Jan Roskam wrote: >> >> When is setting a PYTHONDONTWRITEBYTECODE environment variable useful? Or >> set sys.dont_write_bytecode to True? Or start Python with the -B option? >> I know what it does >> (http://docs.pytho

Re: [Tutor] Multi Layered Graphs

2014-01-27 Thread Albert-Jan Roskam
-- On Sun, Jan 26, 2014 11:23 PM CET Ankit Arora wrote: >I'm working on a project which involves network graphs. Is there a library >that can help me do this: > >I want to create multi-layered graphs i.e. graphs which contain a set >number of vertices but multiple 'lay

Re: [Tutor] most useful ide

2014-02-02 Thread Albert-Jan Roskam
>Subject: Re: [Tutor] most useful ide > >On 02/02/14 08:25, Ian D wrote: > >> Are there any recommendations for python ide's > >Lots depending who you ask... If you ask me: Spyder (free) or PyCharm (free for open source projects) ;-) ___ Tutor maillis

Re: [Tutor] Regular expression - I

2014-02-18 Thread Albert-Jan Roskam
_ > From: Steve Willoughby >To: Santosh Kumar >Cc: python mail list >Sent: Tuesday, February 18, 2014 7:03 PM >Subject: Re: [Tutor] Regular expression - I > > >Because the regular expression means “match an angle-bracket character, >zero or more H characters, f

<    1   2   3   4   5   6   >