ftputil 4.0.0 released

2020-06-13 Thread Stefan Schwarzer
ftputil 4.0.0 is now available from https://ftputil.sschwarzer.net/download and https://pypi.org/project/ftputil/ Changes since the last stable release 3.4 - Backward-incompatible changes ~ This ftputil version isn't fully

ftputil 3.4 released

2017-11-08 Thread Stefan Schwarzer
ftputil 3.4 is now available from http://ftputil.sschwarzer.net/download . Changes since version 3.3.1 --- - Several bugs were fixed [1-5]. - Added deprecation warnings for backward incompatibilities in the upcoming ftputil 4.0.0. Important note -- The

[ANN] ftputil 3.3.1 released

2016-02-19 Thread Stefan Schwarzer
ftputil 3.3.1 is now available from http://ftputil.sschwarzer.net/download . Changes since version 3.3 - - Fixed a bug where a 226 reply after a remote file close would only show up later when doing a `pwd` call on the session. [1] This resulted in an

ftputil 3.3 released

2015-12-27 Thread Stefan Schwarzer
ftputil 3.3 is now available from http://ftputil.sschwarzer.net/download and at the Python Package Index (PyPI). Changes since version 3.2 - - Added `rest` argument to `FTPHost.open` for recovery after interrupted transfers [1]. - Fixed handling of non-ASCII directory

[ANN] ftputil 3.1 released

2014-06-16 Thread Stefan Schwarzer
ftputil 3.1 is now available from http://ftputil.sschwarzer.net/download . Changes since version 3.0 - - Added support for `followlinks` parameter in `FTPHost.walk`. [1] - Trying to pickle `FTPHost` and `FTPFile` objects now raises explicit `TypeError`s to make clear

[issue21333] Document recommended exception for objects that shouldn't be pickled

2014-04-22 Thread Stefan Schwarzer
New submission from Stefan Schwarzer: I recently was confused whether to raise a `PicklingError` or `TypeError` in `__getstate__` if objects of my class can't and shouldn't be pickled. [1] Terry Reedy advised I should use `TypeError`. [2] I wonder if the `pickle` module documention should

Recommended exception for objects that can't be pickled

2014-04-21 Thread Stefan Schwarzer
Hi, Recently, I got a request [1] to support pickling of `FTPHost` instances in my `ftplib` library. I explained in the ticket why I think it's a bad idea and now want to make explicit that `FTPHost` objects can't be pickled. The usual way to do this seems to be defining a `__getstate__` method

[ANN] ftputil 3.0b released

2013-11-04 Thread Stefan Schwarzer
ftputil 3.0b is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.8 - Note: This version of ftputil is _not_ backward-compatible with earlier versions.See the links below for information on adapting existing client code. - This version

[ANN] ftputil 3.0a1 released

2013-09-29 Thread Stefan Schwarzer
ftputil 3.0a1 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.8 - Note: This version of ftputil is _not_ backward-compatible with earlier versions.See the links below for information on adapting existing client code. - This version

Re: API design for Python 2 / 3 compatibility

2013-04-14 Thread Stefan Schwarzer
Terry, Ethan: Thanks a lot for your excellent advice. :-) On 2013-04-13 19:32, Terry Jan Reedy wrote: Approach 2 matches (or should match) io.open, which became builtin open in Python 3. I would simply document that ftp_host.open mimics io.open in the same way that ftp_host.chdir, etcetera,

Re: Grammar question: Englisn and Python: qualified names

2013-04-14 Thread Stefan Schwarzer
Hi Chris, On 2013-04-14 23:50, Chris Angelico wrote: Quirky question time! When you read out a qualified name, eg collections.OrderedDict, do you read the qualifier (collections dot ordered dict), or do you elide it (ordered dict)? I ask because it makes a difference to talking about just

API design for Python 2 / 3 compatibility

2013-04-13 Thread Stefan Schwarzer
Hello, I'm currently changing the FTP client library ftputil [1] so that the same code of the library works with Python 2 (2.6 and up) and Python 3. (At the moment the code is for Python 2 only.) I've run into a API design issue where I don't know which API I should offer ftputil users under

[ANN] ftputil 2.8 released

2013-03-30 Thread Stefan Schwarzer
ftputil 2.8 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.7.1 --- - After some discussion [1] I decided to remove the auto-probing before using the `-a` option for `LIST` [2] to find hidden files and directories. The option is

[ANN] Leipzig Python User Group - Meeting, December 11 2012, 08:00 p.m.

2012-12-10 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, December 11 at 8:00 p.m. at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Our main subjects this time are concurrency and parallelism. Everybody who uses Python, plans to

[ANN] ftputil 2.7.1 released

2012-07-14 Thread Stefan Schwarzer
ftputil 2.7.1 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.7.1 --- A packaging problem was fixed. [1] What is ftputil? ftputil is a high-level FTP client library for the Python programming language. ftputil

[ANN] ftputil 2.7 released

2012-07-08 Thread Stefan Schwarzer
ftputil 2.7 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.6 - - ftputil now explicitly tries to get hidden directory and file names (names starting with a dot) from the FTP server. [1] Before, ftputil used a `LIST` command to

Re: Naming future objects and their methods

2012-04-16 Thread Stefan Schwarzer
, but in my reader I only saw one answer in the newsgroup.) Stefan Schwarzer wrote: I wrote a `Connection` class that can be found at [1]. A `Connection` object has a method `put_bytes(data)` which returns a future [2]. The data will be sent asynchronously by a thread attached to the connection object

Naming future objects and their methods

2012-04-14 Thread Stefan Schwarzer
Hello, I wrote a `Connection` class that can be found at [1]. A `Connection` object has a method `put_bytes(data)` which returns a future [2]. The data will be sent asynchronously by a thread attached to the connection object. The future object returned by `put_bytes` has a `was_sent` method

Re: Python Gotcha's?

2012-04-09 Thread Stefan Schwarzer
Hi Miki, On 2012-04-05 00:34, Miki Tebeka wrote: I'm going to give a Python Gotcha's talk at work. If you have an interesting/common Gotcha (warts/dark corners ...) please share. (Note that I want over http://wiki.python.org/moin/PythonWarts already). I gave a somewhat similar talk a

[issue1067702] urllib fails with multiple ftp transfers

2011-06-27 Thread Stefan Schwarzer
Stefan Schwarzer sschwar...@sschwarzer.net added the comment: Hi Senthil, I don't yet understand what was going on before it resulted in the traceback. I also don't understand _why_ the patch fixes _this_ bug. (That's not to say it doesn't, but I think it's not obvious either. :-) ) Were you

[issue1067702] urllib fails with multiple ftp transfers

2011-06-26 Thread Stefan Schwarzer
Stefan Schwarzer sschwar...@sschwarzer.net added the comment: I was able to get some error output with the code of the OP. However, I only saw the opposite message, such as: Retrieval of 'ftp://ftp.gnome.org/pub/debian/dists/stable/main/source/Sources.bz2' failed with error: [Errno ftp error

[issue1067702] urllib fails with multiple ftp transfers

2011-06-26 Thread Stefan Schwarzer
Stefan Schwarzer sschwar...@sschwarzer.net added the comment: I converted the script to be executable with manual intervention (see attachment). This should have been without manual intervention. :) -- ___ Python tracker rep...@bugs.python.org

[issue1067702] urllib fails with multiple ftp transfers

2011-06-26 Thread Stefan Schwarzer
Stefan Schwarzer sschwar...@sschwarzer.net added the comment: I can confirm the bug for the Python 2.7 tip (changeset b11e7bc76d07) after using the script urllibftpbug-non-interactive.py. -- ___ Python tracker rep...@bugs.python.org http

[issue1067702] urllib fails with multiple ftp transfers

2011-06-26 Thread Stefan Schwarzer
Stefan Schwarzer sschwar...@sschwarzer.net added the comment: After running the adapted test script three times for Python 3 tip (changeset c5b0585624ef), I didn't get an error message / exception. -- Added file: http://bugs.python.org/file22485/urllibftpbug-non-interactive-py3.py

[issue1067702] urllib fails with multiple ftp transfers

2011-06-26 Thread Stefan Schwarzer
Stefan Schwarzer sschwar...@sschwarzer.net added the comment: The traceback and its context for the exception raised in Python 2.7 is: ... ### 99

[issue4608] urllib.request.urlopen does not return an iterable object

2011-06-25 Thread Stefan Schwarzer
Stefan Schwarzer sschwar...@users.sourceforge.net added the comment: It turned out that although the addinfourl instance had the `__iter__` attribute in `addbase.__init__` correctly assigned, `__iter__` wasn't found by the `iter` builtin. It seems that `iter` always tries to use the `__iter__

[ANN] ftputil 2.6 released

2011-03-14 Thread Stefan Schwarzer
ftputil 2.6 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.5 - - The stat caching has been improved. There's now an auto-grow feature for `FTPHost.listdir` which in turn applies to `FTPHost.walk`. Moreover, there are several

[ANN] Leipzig Python User Group - Meeting, January 11, 2011, 08:00pm

2011-01-07 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, January, 11th, 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Food and soft drinks are provided. Please send a short confirmation mail to i...@python-academy.de,

Re: using python ftp

2010-12-30 Thread Stefan Schwarzer
Hello Matt, On 2010-12-23 01:03, Matt Funk wrote: i was wondering whether someone can point me whether the following already exists. I want to connect to a server , download various files (for whose name i want to be able to use a wildcard), and store those files in a given location on the

[ANN] Leipzig Python User Group - Meeting, December 14, 2010, 08:00pm

2010-12-12 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, December, 14th, 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Food and soft drinks are provided. Please send a short confirmation mail to i...@python-academy.de,

Re: Tools for turning Python code into XMI?

2010-11-05 Thread Stefan Schwarzer
Hi Lawrence, I missed your answer because I didn't expect someone to respond after all this time. :-) On 2010-10-30 04:07, Lawrence D'Oliveiro wrote: I'm looking for a tool which can read Python files and write a corresponding XMI file for import into UML tools. UML ... isn’t that something

Re: How do I chain methods?

2010-10-25 Thread Stefan Schwarzer
Hi Steve and others, On 2010-10-25 06:08, Steve Holden wrote: On 10/24/2010 11:42 PM, Chris Rebert wrote: On Sun, Oct 24, 2010 at 4:11 PM, James Mills prolo...@shortcircuit.net.au wrote: I don't agree but anyway... I've just not seen it commonly used amongst python programmers. If Python

[ANN] ftputil 2.5 released

2010-10-24 Thread Stefan Schwarzer
ftputil 2.5 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.4.2 --- - As announced over a year ago [1], the `xreadlines` method for FTP file objects has been removed, and exceptions can no longer be accessed via the `ftputil`

Tools for turning Python code into XMI?

2010-10-24 Thread Stefan Schwarzer
Hello, I'm looking for a tool which can read Python files and write a corresponding XMI file for import into UML tools. Ideally, the conversion tool should: - be open source or freeware - be available for Linux - be a command line tool - allow to specify exactly the Python files that should

Re: yield all entries of an iterable

2010-10-24 Thread Stefan Schwarzer
Hi Sebastian, On 2010-10-21 00:27, Sebastian wrote: Is there a simpler way to yield all elements of a sequence than this? for x in xs: yield x Can you give an example where you would need this? Can't you just iterate over the sequence? If you really need an iterator, you can use

Re: yield all entries of an iterable

2010-10-24 Thread Stefan Schwarzer
Hi Cameron, On 2010-10-25 01:08, Cameron Simpson wrote: On 24Oct2010 20:58, Stefan Schwarzer sschwar...@sschwarzer.net wrote: | On 2010-10-21 00:27, Sebastian wrote: | Is there a simpler way to yield all elements of a sequence than this? | for x in xs: | yield x | | Can you give

[ANN] Leipzig Python User Group - Meeting, October 12, 2010, 08:00pm

2010-10-09 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, October, 12th, 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Markus Zapke-Gründemann will be talking about Celery, an asynchronous task queue (not just) for

Re: About __class__ of an int literal

2010-09-28 Thread Stefan Schwarzer
Hello Alex, On 2010-09-28 11:27, AlexWalk wrote: In python 3.1.2(I'm using windows edition, 32bit), accessing __class__ of an int literal will raise a SyntaxException, while other literals will not. For example. 1.__class__ is an error, while 1.1.__class__ runs ok. I searched the python

Re: creating python daemon ?

2010-09-26 Thread Stefan Schwarzer
Hi Daniel, On 2010-09-23 07:30, vineet daniel wrote: On Sep 22, 2:20 pm, de...@web.de (Diez B. Roggisch) wrote: vineet daniel vineetdan...@gmail.com writes: On Sep 21, 9:47 pm, de...@web.de (Diez B. Roggisch) wrote: vineet daniel vineetdan...@gmail.com writes: code that I am using is as

Re: sequence multiplied by -1

2010-09-25 Thread Stefan Schwarzer
Hi, On 2010-09-25 14:11, Yingjie Lan wrote: Having more than one way of doing things sometimes is good. In my opinion this _isn't_ a situation where it's good. :) L[::-1] is only marginally longer than -1 * L I think this small gain doesn't justify violating this Python Zen rule

Re: sequence multiplied by -1

2010-09-25 Thread Stefan Schwarzer
Hi, On 2010-09-25 15:54, Yingjie Lan wrote: The first one is simpler (4 chars v.s. 9 chars). One thing is whether a certain form is shorter, another thing to take into account is how often you need the functionality. I thought it was also intuitive because if you multiply a vector by -1, you

Re: sequence multiplied by -1

2010-09-25 Thread Stefan Schwarzer
Hi Terry, On 2010-09-25 19:24, Terry Reedy wrote: On 9/25/2010 4:22 AM, Yingjie Lan wrote: There is already a builtin reversed() function whose output can be multiplied. Seemingly, it can't: $ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type help,

Design: Module interface vs. library interface

2010-09-11 Thread Stefan Schwarzer
Hello, I maintain ftputil [1], an FTP client library. Users of the library may use it like this: | import ftputil | | with ftputil.FTPHost(server, userid, password) as ftp_host: | # for example, make a remote file and read its content | with ftp_host.open(remote_name, rb) as

Re: bool constructor is inconsistent?

2010-09-10 Thread Stefan Schwarzer
Hi Neal, On 2010-09-10 20:23, Neal Becker wrote: IN [3]: bool('False') Out[3]: True If you consider strings, only an empty string has a false value. So the string 'False' which is non-empty, results in a true boolean value. For example, you can use if my_string: ... to execute

Re: Help needed - function apparently global cannot be called.

2010-09-07 Thread Stefan Schwarzer
Hi Ian, On 2010-09-07 12:18, Ian Hobson wrote: f = open('d:\logfile.txt','a') Just a note: Using a backslash in a non-raw string will get you in trouble as soon as the backslash is followed by a character which makes a special character sequence, like \n. For example, f =

Re: doctest annoyance/puzzle

2010-09-05 Thread Stefan Schwarzer
Hi Steven, On 2010-09-05 17:30, Steven D'Aprano wrote: I run the doctests with: python2.6 -m doctest examples.txt and the first example passes, but the second fails with NameError: make_spam not defined. I run my doctests by calling doctest.testfile(filename) for each file in a

Re: Is there a Python equivalent to Perl's File::Listing::parse_dir

2010-09-02 Thread Stefan Schwarzer
Hi John, On 2010-08-11 20:24, John Nagle wrote: Perl has a function which will take a remote directory page, in the form that most web sites return for a file directory, and parse it into a useful form: http://www.xav.com/perl/site/lib/File/Listing.html This is especially useful

Re: Functions continuing to ru after returning something?

2010-08-31 Thread Stefan Schwarzer
Hi, On 2010-08-31 02:05, Bradley Hintze wrote: I may be having a brain fart, but is it at all possible to have a function first return a value then continue its calculation. Like this simple example: my_var = 5 def my_function(): return my_var my_var +=1 This obviously won't

Re: Saving (unusual) linux filenames

2010-08-31 Thread Stefan Schwarzer
Hi Grant, On 2010-08-31 20:49, Grant Edwards wrote: How many filenames contain ,? CVS repository files end with ,v . However, just let's agree that nobody uses CVS anymore. :-) Not many, but the OP wants his program to be bulletproof. Can't fault him for that. What about using the csv (not

Re: Confused: Newbie Function Calls

2010-08-30 Thread Stefan Schwarzer
Hi Pinku, On 2010-08-11 21:35, Pinku Surana wrote: Even though I used the same name x for a local and global variable, they are actually completely different. When I call fun(x) it COPIES the global value of x into the local variable x in fun. [...] The global value isn't copied when calling

Re: ftplib limitations?

2010-08-28 Thread Stefan Schwarzer
Hi Lawrence, On 2010-08-28 01:49, Lawrence D'Oliveiro wrote: Now it may be that the data connection, after having started the transfer, works as it should, but the control connection times out because the duration of the transfer is too long. It might not be the fault of the FTP server. If

Re: Writing byte stream as jpeg format to disk

2010-08-26 Thread Stefan Schwarzer
Hi Navkirat, On 2010-08-26 19:22, Navkirat Singh wrote: I am programming a webserver, I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a string. I wanted to know how i could write the file (now a string) as a jpeg image on

Re: ftplib limitations?

2010-08-25 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-24 16:29, Stefan Schwarzer wrote: I experienced some problem. The server is Windows and FileZilla, the client is Win7 and Python2.6. When I got a file with size 1 303 318 662 byte, python is halt on retrbinary line everytime. So if I understand correctly

Re: ftplib limitations?

2010-08-25 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-25 09:43, durumdara wrote: I can imagine the error message (a full traceback if possible) would help to say a bit more about the cause of the problem and maybe what to do about it. This was: Filename: Repositories 20100824_101805 (Teljes).zip Size: 1530296127

Re: ftplib limitations?

2010-08-25 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-25 11:18, durumdara wrote: On aug. 25, 08:07, Stefan Schwarzer sschwar...@sschwarzer.net wrote: The file is 2 GB in size and is fully transferred, without blocking or an error message. The status message from the server is '226-File successfully transferred\n226

Re: ftplib limitations?

2010-08-24 Thread Stefan Schwarzer
Hi durumdara, On 2010-08-24 11:21, durumdara wrote: def CallBack(Data): d['size'] = d['size'] + len(Data) d['buffer'].append(Data) percent = (d['size'] / float(fsize)) * 100 percentp10 = int(percent/10) if percentp10 d['lastpercentp10']:

Re: equivalent of source file in python?

2010-08-24 Thread Stefan Schwarzer
Hi Astan, On 2010-08-24 21:18, Astan Chee wrote: I'm trying to convert my tcsh script to python and am stuck at one part, particularly the part of the script that looks like this: #!/bin/tcsh setenv LSFLOG /var/tmp/lsf_log source /etc/setup unalias cp umask 0 env ${AFLOG} What is

Re: Open a command pipe for reading

2010-08-23 Thread Stefan Schwarzer
Hi Rodrick, On 2010-08-17 18:40, Rodrick Brown wrote: I have a fairly large file 1-2GB in size that I need to process line by line but I first need to convert the file to text using a 3rd party tool that prints the records also line by line. I've tried using Popen to do this with no luck.

Re: A question to experienced Pythoneers

2010-08-20 Thread Stefan Schwarzer
Hi Lawrence, On 2010-08-20 13:11, Lawrence D'Oliveiro wrote: In message 8d1b76b7-1ba3-49c5-97cf-dc3837050...@y11g2000yqm.googlegroups.com, Rony wrote: The manager of the development has been fired, main reason (what they told me) is that they have big big troubles in keeping deadlines ! For

Re: A question to experienced Pythoneers

2010-08-20 Thread Stefan Schwarzer
Hi Rony, On 2010-08-20 10:16, Rony wrote: Here's the story : I've been hired by a company as a consultant to reorganise there development department. The actual situation is : The manager of the development has been fired, main reason (what they told me) is that they have big big troubles

Re: String substitution VS proper mysql escaping

2010-08-19 Thread Stefan Schwarzer
Hi Νίκος, On 2010-08-19 09:10, Νίκος wrote: On 18 Αύγ, 12:50, Cameron Simpson c...@zip.com.au wrote: (nikos,) is a single element tuple. [nikos] is a single element list. [nikos,] is also a single element list, just written like the tuple. It makes more sense if i: nikos is just a

Re: Call Java Code from python

2010-08-18 Thread Stefan Schwarzer
Hi Bidda, On 2010-08-18 09:19, Bidda Gowda wrote: I have a project coming up where i have to integrate our existing Python based web application with Java Programs. Basically i should be able to call Java programs which comes in the form of jars. Whats the best way to call these jars from

Re: 79 chars or more?

2010-08-18 Thread Stefan Schwarzer
Hi Lie, On 2010-08-18 12:02, Lie Ryan wrote: On 08/17/10 12:59, AK wrote: On 08/16/2010 10:42 PM, James Mills wrote: My personal opinion (despite monitors being wider) is the horizontal scrolling isn't worth it. Stick to a 80-char width. But.. why horizontal scrolling, isn't autowrap much

Re: Opposite of split

2010-08-17 Thread Stefan Schwarzer
Hi Alex, On 2010-08-16 18:44, Alex van der Spek wrote: Anybody catches any other ways to improve my program (attached), you are most welcome. Help me learn, that is one of the objectives of this newsgroup, right? Or is it all about exchanging the next to impossible solution to the never to

Re: 79 chars or more?

2010-08-17 Thread Stefan Schwarzer
Hi Neil, On 2010-08-17 14:42, Neil Cerutti wrote: On 2010-08-17, Michael Torrie torr...@gmail.com wrote: In general if I find myself consistently going longer than 75 or 80 characters, I need to refactor my code to make it more manageable. If I have to scroll up five pages to find the

Re: 79 chars or more?

2010-08-17 Thread Stefan Schwarzer
On 2010-08-17 17:44, AK wrote: On 08/17/2010 10:28 AM, Stefan Schwarzer wrote: I'd probably reformat this to self.expiration_date = translate_date( find(response, 'MPNExpirationDate').text, '%Y-%m-%d', '%m%d%Y') or even self.expiration_date

Re: 79 chars or more?

2010-08-17 Thread Stefan Schwarzer
Hi Andrei, On 2010-08-17 18:43, AK wrote: But let me ask you, would you really prefer to have: self.expiration_date = translate_date( find(response, 'MPNExpirationDate').text, '%Y-%m-%d', '%m%d%Y') (or the 4-line version of this above), even when

Re: How do I get number of files in a particular directory.

2010-08-13 Thread Stefan Schwarzer
On 2010-08-13 11:18, blur959 wrote: import os directory = raw_input(Please input file directory. \n\n) s = raw_input(Please input a name to replace. \n\n) ext = raw_input(input file ext) for files in os.listdir(directory): if ext in files: file_number = len(files)

Re: Help to convert Number to String

2010-08-13 Thread Stefan Schwarzer
Hi Vamsi, On 2010-08-13 22:50, Vamsi wrote: I am trying to count the number of lines in a file and insert into the file but getting the error message TypeError: must be string or read-only character buffer, not int, Could you please help me how to correct this? Which Python version do you

Re: __class__ of what

2010-08-12 Thread Stefan Schwarzer
Hello Jean-Michel, On 2010-08-12 16:06, Jean-Michel Pichavant wrote: Eric J. Van der Velden wrote: Should be class C: n = 0 def __init__(self): self.__class__.n+=1 C.n+=1 # equivalent to this line (I prefer this one, more readable, less refactor-friendly) I think

Re: Weird Python behaviour

2010-08-10 Thread Stefan Schwarzer
Hi, On 2010-08-10 17:01, Francesco Bochicchio wrote: There used to be a very nice (also graphic) explanationor this somewhere on the web, but my googling skills failed me this time, so instead I'll show you the concept using your own code: Probably this isn't the page you're referring to, but

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
Hi Steven, On 2010-08-09 10:21, Steven D'Aprano wrote: And that it's quite finicky about blank lines between methods and inside functions. Makes it hard to paste code directly into the interpreter. And that pasting doesn't strip out any leading prompts. It needs a good doctest mode.

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
Hi Robert, On 2010-08-09 22:23, Robert Kern wrote: On 2010-08-09 06:42 , Stefan Schwarzer wrote: Unfortunatey, when I enter In [2]: %paste at the prompt it gives me (before I pasted anything) In [2]: %paste File

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
On 2010-08-09 23:43, Stefan Schwarzer wrote: I got that traceback as soon as I typed in %paste and pressed enter, without pasting anything in the terminal. I had assumed it works like :paste in Vim, activating a I meant :set paste of course. Stefan -- http://mail.python.org/mailman/listinfo

Re: easy question on parsing python: is not None

2010-08-08 Thread Stefan Schwarzer
Hi Ben, On 2010-08-08 01:16, Ben Finney wrote: Don't use strings for such values. The data isn't going to be used, so there's no sense using a semantically rich data type like a string. Instead, use an ‘object’ instance; then, the only way to get a binding that will compare equal is to use

Re: easy question on parsing python: is not None

2010-08-07 Thread Stefan Schwarzer
Hi Steven, On 2010-08-07 00:28, Steven D'Aprano wrote: On Fri, 06 Aug 2010 15:37:04 +0200, Stefan Schwarzer wrote: Plus, I believe the == operator will check if the variables point to the same object. No, that's what `is` is for. Actually, yes, equality is implemented with a short-cut

Re: default behavior

2010-08-07 Thread Stefan Schwarzer
On 2010-07-31 05:47, Steven D'Aprano wrote: On Fri, 30 Jul 2010 08:34:52 -0400, wheres pythonmonks wrote: It does re-use the same underlying data. from collections import defaultdict as dd x = dd(list) x[1].append(1) x defaultdict(type 'list', {1: [1]}) y = dict(x) x[1].append(42)

[ANN] Leipzig Python User Group - Meeting, August 10, 2010, 08:00pm

2010-08-06 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, August, 10th, 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Markus Zapke-Gründemann will be talking about pip, distribute and virtualenv. Mike Müller will tell us

Re: easy question on parsing python: is not None

2010-08-06 Thread Stefan Schwarzer
Hi DG, On 2010-08-06 14:28, DG wrote: I've always thought of it as you don't compare strings with is, you *should* use == The reasoning is that you don't know if that string instance is the only one in memory. I've heard as an implementation detail, since strings are immutable, that Python

Re: easy question on parsing python: is not None

2010-08-06 Thread Stefan Schwarzer
Hello Peter, On 2010-08-06 19:20, Peter Pearson wrote: On Fri, 06 Aug 2010 15:37:04 +0200, Stefan Schwarzer wrote: [snip] I can imagine a case where you might want to compare a string with `is`: FORWARD = forward BACKWARD = backward ... def func(direction=FORWARD

Re: simple integer subclass

2010-08-05 Thread Stefan Schwarzer
Hi Andreas, On 2010-08-03 12:15, Andreas Pfrengle wrote: On 3 Aug., 03:22, Carl Banks pavlovevide...@gmail.com wrote: Thinking about it, it might really be dangerous to coerce always to int1, since sometimes I might want a normal int as result (I can't tell yet for sure). Yes, that way your

[ANN] Websourcebrowser 0.4a released

2010-08-04 Thread Stefan Schwarzer
Hello, I'm happy to announce the release of Websourcebrowser 0.4a. Websourcebrowser is a program intended to get a quick overview of a project's source code. The program is controlled from a web browser which displays a directory tree and a source code file side by side. The homepage of the

[ANN] Websourcebrowser 0.4a released

2010-08-04 Thread Stefan Schwarzer
Hello, I'm happy to announce the release of Websourcebrowser 0.4a. Websourcebrowser is a program intended to get a quick overview of a project's source code. The program is controlled from a web browser which displays a directory tree and a source code file side by side. The homepage of the

Re: __init__ as a lambda

2010-08-04 Thread Stefan Schwarzer
Hi Eric, On 2010-08-04 21:58, Eric J. Van der Velden wrote: class C: def __init__(self,name):self.name=name I was wondering if I could make the __init__ a lambda function, but class C: __init__=lambda self,self.name:None and then later, C('Hello') does not work; the first

[ANN] Leipzig Python User Group - Meeting, June 1, 2010, 08:00pm

2010-05-29 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, June 1, 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). This meeting is one week earlier than the usual second Tuesday of each month! Maik Derstappen will give a

Re: [ANN] Leipzig Python User Group - Meeting, June 1, 2010, 08:00pm

2010-05-29 Thread Stefan Schwarzer
Hello, On 2010-05-28 22:37, Stefan Schwarzer wrote: === Leipzig Python User Group === We will meet on Tuesday, June 1, 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). This meeting is one week earlier than the usual

[ANN] Leipzig Python User Group - Meeting, May 11, 2010, 08:00pm

2010-05-08 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, May 11, 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Julian Moritz will give a talk about CouchDB. Food and soft drinks are provided. Please send a short

[ANN] Leipzig Python User Group - Meeting, April 13, 2010, 08:00pm

2010-04-10 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, April 13, 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). We will evaluate the booth we had at the Chemnitzer Linuxtage and plan improvements for next year. Food

[ANN] Leipzig Python User Group - Meeting, December 1, 2009, 08:00pm

2009-11-29 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, December 1 at 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Food and soft drinks are provided. Please send a short confirmation mail to i...@python-academy.de, so

[ANN] ftputil 2.4.2 released

2009-11-13 Thread Stefan Schwarzer
ftputil 2.4.2 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.4.1 --- - Some FTP servers seem to have problems using *any* directory argument which contains slashes. The new default for FTP commands now is to change into the

ANN: Leipzig Python User Group - Meeting, September 8, 2009, 08:00pm

2009-09-06 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, September 8 at 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Markus Zapke-Gründemann will talk about the micro web framework Bottle. Food and soft drinks are

[ANN] Leipzig Python User Group - Meeting, August 11, 2009, 08:00pm

2009-08-08 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, August 11 at 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). We will talk about the EuroSciPy which took place at the end of July in Leipzig and was visited by

[ANN] ftputil 2.4.1 released

2009-05-10 Thread Stefan Schwarzer
ftputil 2.4.1 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.4 - Several bugs were fixed: - On Windows, some accesses to the stat cache caused it to become inconsistent, which could also trigger exceptions (report and patch by

[ANN] Leipzig Python User Group - Meeting, May 12, 2009, 08:00pm

2009-05-10 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, May 12 at 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Food and soft drinks are provided. Please send a short confirmation mail to i...@python-academy.de, so we

[ANN] ftputil 2.4 released

2009-02-15 Thread Stefan Schwarzer
ftputil 2.4 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.3 - The ``FTPHost`` class got a new method ``chmod``, similar to ``os.chmod``, to act on remote files. Thanks go to Tom Parker for the review. There's a new exception

[ANN] Leipzig Python User Group Meeting, September 09, 2008, 08:00 pm

2008-09-06 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, September 09 at 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). Food and soft drinks are provided. Please send a short confirmation mail to [EMAIL PROTECTED] , so

[ANN] ftputil 2.3 released

2008-09-06 Thread Stefan Schwarzer
ftputil 2.3 is now available from http://ftputil.sschwarzer.net/download . Changes since version 2.2.4 --- ftputil has got support for the ``with`` statement which was introduced by Python 2.5. You can now construct host and remote file objects in ``with`` statements and

[ANN] Leipzig Python User Group Meeting, August 12, 2008, 08:00 pm

2008-08-09 Thread Stefan Schwarzer
=== Leipzig Python User Group === We will meet on Tuesday, August 12 at 8:00 pm at the training center of Python Academy in Leipzig, Germany ( http://www.python-academy.com/center/find.html ). We'll have a talk about Matplotlib, a library for generating two-dimensional graphs (see

[ANN] ftputil 2.2.3 released

2007-07-22 Thread Stefan Schwarzer
license (see http://www.opensource.org/licenses/bsd-license.php ). Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.com - Softwareentwicklung für Technik und Wissenschaft http://sschwarzer.com -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software

[ANN] ftputil 2.2.3 released

2007-07-22 Thread Stefan Schwarzer
license (see http://www.opensource.org/licenses/bsd-license.php ). Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.com - Softwareentwicklung für Technik und Wissenschaft http://sschwarzer.com -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >