Re: strip() method makes me confused

2020-11-07 Thread Bischoop
On 2020-11-07, Alexander Neilson wrote: > Because the strip methods argument is the set of characters to remove from > either end. So it checks from the ends character by character until it finds > a character that isn’t in the set. Then it removes everything prior to that > (or after that at e

Re: strip() method makes me confused

2020-11-07 Thread Bischoop
On 2020-11-07, Frank Millman wrote: > On 2020-11-07 1:28 PM, Frank Millman wrote: >> On 2020-11-07 1:03 PM, Bischoop wrote: >>> > [...] >>> >>> another example: >>> >>> text = "this is text, there should be not commas, but as you see there >>> are still" >>> y = txt.strip(",") >>> print(text) >>>

Re: strip() method makes me confused

2020-11-07 Thread Frank Millman
On 2020-11-07 1:28 PM, Frank Millman wrote: On 2020-11-07 1:03 PM, Bischoop wrote: [...] another example: text = "this is text, there should be not commas, but as you see there are still" y = txt.strip(",") print(text) output: this is text, there should be not commas, but as you see there

Re: strip() method makes me confused

2020-11-07 Thread Frank Millman
On 2020-11-07 1:03 PM, Bischoop wrote: According to documentation strip method removes heading and trailing characters. Both are explained in the docs - Why then: txt = ",rrttggs...,..s,bananas...s.rrr" x = txt.strip(",s.grt") print(x) output: banana "The chars argument is not a p

Re: strip() method makes me confused

2020-11-07 Thread Alexander Neilson
Because the strip methods argument is the set of characters to remove from either end. So it checks from the ends character by character until it finds a character that isn’t in the set. Then it removes everything prior to that (or after that at end of the string) and then returns the result.

strip() method makes me confused

2020-11-07 Thread Bischoop
According to documentation strip method removes heading and trailing characters. Why then: txt = ",rrttggs...,..s,bananas...s.rrr" x = txt.strip(",s.grt") print(x) output: banana another example: text = "this is text, there should be not commas, but as you see there are still" y = txt.

Confused by python gtk, gobject, gi, etc. (Ubuntu repositories)

2020-07-29 Thread Chris Green
I am trying to move some code from Python 2, gtk 2 (I think!) to Python 3. I am very confused as to what Ubuntu repository packages I need to install to provide the Python 3 modules I need. Searching in the repositories (and descriptions) for pygobject what I find is:- python-gi-dev/focal

Re: Confused about np.polyfit()

2020-07-19 Thread duncan smith
On 19/07/2020 16:11, Dino wrote: > On 7/19/2020 4:54 PM, duncan smith wrote: >> >> It depends on what you expect the result to be. There's nothing >> inherently wrong with transforming variables before using least squares >> fitting. Whether it gives you the "best" estimates for the coefficients >>

Re: Confused about np.polyfit()

2020-07-19 Thread Richard Damon
On 7/19/20 10:54 AM, duncan smith wrote: > On 19/07/2020 11:19, Dino wrote: >> Hi, I am looking at someone else's code trying to understand their use >> of numpy.polyfit. >> >> My understanding was that you can use it to fit polynomials, but >> apparently, the original author has used it for logari

Re: Confused about np.polyfit()

2020-07-19 Thread duncan smith
On 19/07/2020 11:19, Dino wrote: > > Hi, I am looking at someone else's code trying to understand their use > of numpy.polyfit. > > My understanding was that you can use it to fit polynomials, but > apparently, the original author has used it for logarithmic and > exponential curves as well this

confused by matplotlib and subplots

2020-04-01 Thread Luca
Hello Covid fighters and dodgers, I'm sort of confused by what I am seeing in a Pandas book. This works: fig = plt.figure() ax1 = fig.add_subplot(2,2,1) ax2 = fig.add_subplot(2,2,2) ax3 = fig.add_subplot(2,2,3) ax3.plot(np.random.randn(50).cumsum(), 'k--'); but also t

Re: Change in cache tag in Python 3.8 - pip confused

2019-05-07 Thread Chris Angelico
On Wed, May 8, 2019 at 8:09 AM Paul Moore wrote: > > On Tue, 7 May 2019 at 22:26, Chris Angelico wrote: > > So the next question is: Is this actually a problem? If it's something > > that can only ever happen to people who build prerelease Pythons, it's > > probably not an issue. Is there any way

Re: Change in cache tag in Python 3.8 - pip confused

2019-05-07 Thread Paul Moore
On Tue, 7 May 2019 at 22:26, Chris Angelico wrote: > So the next question is: Is this actually a problem? If it's something > that can only ever happen to people who build prerelease Pythons, it's > probably not an issue. Is there any way that a regular installation of > Python could ever change i

Re: Change in cache tag in Python 3.8 - pip confused

2019-05-07 Thread Chris Angelico
On Wed, May 8, 2019 at 7:13 AM Paul Moore wrote: > > On Tue, 7 May 2019 at 21:53, Chris Angelico wrote: > > > > I've been building Python 3.8 pre-alphas and alphas for a while now, > > and ran into a weird problem. Not sure if this is significant or not, > > and hoping to get other people's views

Re: Change in cache tag in Python 3.8 - pip confused

2019-05-07 Thread Paul Moore
On Tue, 7 May 2019 at 21:53, Chris Angelico wrote: > > I've been building Python 3.8 pre-alphas and alphas for a while now, > and ran into a weird problem. Not sure if this is significant or not, > and hoping to get other people's views. > > It seems that the value of sys.implementation.cache_tag

Change in cache tag in Python 3.8 - pip confused

2019-05-07 Thread Chris Angelico
I've been building Python 3.8 pre-alphas and alphas for a while now, and ran into a weird problem. Not sure if this is significant or not, and hoping to get other people's views. It seems that the value of sys.implementation.cache_tag changed from "cpython-38m" to just "cpython-38" at some point.

Re: Confused on git commit tree about Lib/datetime.py

2018-08-01 Thread Thomas Jollans
also part of the 2.7 branch. They are correctly reporting it. The commit is a bit weird, but the tools are faithfully reporting the weirdness. ChrisA That's not the big I'm confused about. I (like Jeffrey) would have expected git log v2.7.4 -- Lib/datetime.py to show something. But ri

Re: Confused on git commit tree about Lib/datetime.py

2018-08-01 Thread Chris Angelico
On Wed, Aug 1, 2018 at 8:40 PM, Thomas Jollans wrote: > On 01/08/18 05:16, Jeffrey Zhang wrote: >> >> I found a interesting issue when checking the Lib/datetime.py >> implementation in python3 >> >> This patch is introduced by cf86e368ebd17e10f68306ebad314eea31daaa1e [0]. >> But if you >> check th

Re: Confused on git commit tree about Lib/datetime.py

2018-08-01 Thread Thomas Jollans
On 01/08/18 05:16, Jeffrey Zhang wrote: I found a interesting issue when checking the Lib/datetime.py implementation in python3 This patch is introduced by cf86e368ebd17e10f68306ebad314eea31daaa1e [0]. But if you check the github page[0], or using git tag --contains, you will find v2.7.x include

Confused on git commit tree about Lib/datetime.py

2018-07-31 Thread Jeffrey Zhang
I found a interesting issue when checking the Lib/datetime.py implementation in python3 This patch is introduced by cf86e368ebd17e10f68306ebad314eea31daaa1e [0]. But if you check the github page[0], or using git tag --contains, you will find v2.7.x includes this commit too. $ git tag --contains c

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Tim Chase
On 2017-02-21 00:04, Peter Otten wrote: > Tim Chase wrote: >> On 2017-02-20 10:45, Peter Otten wrote: >>> value = parser.get("section-1", "option-1", fallback="default >>> value") >> >> Huh. Do you remember when this was added? > > I don't use configparser regularly, so I had to look around myse

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Peter Otten
Tim Chase wrote: > On 2017-02-20 10:45, Peter Otten wrote: >> value = parser.get("section-1", "option-1", fallback="default >> value") > > Huh. Do you remember when this was added? I see it in the 3.x docs, > but not the 2.x docs. I remember writing my own wrappers multiple > times for exactly

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Tim Chase
On 2017-02-20 10:45, Peter Otten wrote: > value = parser.get("section-1", "option-1", fallback="default > value") Huh. Do you remember when this was added? I see it in the 3.x docs, but not the 2.x docs. I remember writing my own wrappers multiple times for exactly these purposes, even to the

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Ian Pilcher
On 02/20/2017 03:45 AM, Peter Otten wrote: You can provide a default value in your code with parser = configparser.ConfigParser() parser.read(configfile) value = parser.get("section-1", "option-1", fallback="default value") Perfect. Thank you! -- =

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Ian Pilcher
On 02/20/2017 01:39 AM, Ben Finney wrote: I think you misinderstand the semantics of what ‘configparser’ expects https://docs.python.org/3/library/configparser.html#configparser-objects>: You are absolutely correct. Thank you! -- ===

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Peter Otten
Ian Pilcher wrote: > I am trying to use ConfigParser for the first time (while also writing > my first quasi-serious Python program). Assume that I want to parse a > a configuration file of the following form: > >[section-1] >option-1 = value1 >option-2 = value2 > >[section-2] >

Re: Noob confused by ConfigParser defaults

2017-02-19 Thread Ben Finney
Ian Pilcher writes: > How do a set a default for option-1 *only* in section-1? I think you misinderstand the semantics of what ‘configparser’ expects https://docs.python.org/3/library/configparser.html#configparser-objects>: Default values […] are used in interpolation if an option used is

Noob confused by ConfigParser defaults

2017-02-19 Thread Ian Pilcher
I am trying to use ConfigParser for the first time (while also writing my first quasi-serious Python program). Assume that I want to parse a a configuration file of the following form: [section-1] option-1 = value1 option-2 = value2 [section-2] option-1 = value3 option-2 = value4 H

Re: Confused with installing per-user in Windows

2016-11-09 Thread ddbug
@eryk sun: Thank you for useful reply. But note that I don't propose to touch the python interpeters (python*.exe), neither to change anything in how distutils work (about entry points). My proposal is only for the Windows-specific Py launcher. For those who runs python*.exe thru associations o

Re: Confused with installing per-user in Windows

2016-11-07 Thread eryk sun
On Mon, Nov 7, 2016 at 1:11 AM, ddbug wrote: > > In Windows, the user-local directory for scripts is %APPDATA%\Python\Scripts. > It is not in > PATH by default and finding it is hard (because Microsoft made it hidden in > their infinite > wisdom). POSIX "~/.local" is hidden as well, by conventi

Re: Confused with installing per-user in Windows

2016-11-06 Thread Ivan Pozdeev via Python-list
On 07.11.2016 4:11, ddbug wrote: Dear experts, I need to install some scripts for current user (to skip sudo, UAC popups and whatever). So I make a sdist and use python -m pip install --user This should work for either Python 2 or 3. On Linux, pip installs the scripts into ~/.local/bin

Re: Confused with installing per-user in Windows

2016-11-06 Thread ddbug
So basically I want to modify py.exe to not only detect the Python version from a script file, but also help locating the script file. -- d -- https://mail.python.org/mailman/listinfo/python-list

Confused with installing per-user in Windows

2016-11-06 Thread ddbug
Dear experts, I need to install some scripts for current user (to skip sudo, UAC popups and whatever). So I make a sdist and use python -m pip install --user This should work for either Python 2 or 3. On Linux, pip installs the scripts into ~/.local/bin ; users are instructed to add this

Re: Confused by wxpython documentation

2016-02-08 Thread cl
Ian Kelly wrote: > On Mon, Feb 8, 2016 at 8:36 AM, wrote: > > I'm playing around with some existing code that uses wxpython. I've > > been trying to understand a basic bit about the import statement and > > so went to the beginning of the wxPython on line documents. > > > > Going from the top t

Re: Confused by wxpython documentation

2016-02-08 Thread Ian Kelly
On Mon, Feb 8, 2016 at 8:36 AM, wrote: > I'm playing around with some existing code that uses wxpython. I've > been trying to understand a basic bit about the import statement and > so went to the beginning of the wxPython on line documents. > > Going from the top to the "Hello World Example" (c

Confused by wxpython documentation

2016-02-08 Thread cl
I'm playing around with some existing code that uses wxpython. I've been trying to understand a basic bit about the import statement and so went to the beginning of the wxPython on line documents. Going from the top to the "Hello World Example" (can't give URL as the URL is the same for all the d

Confused by python-dbus weird behavior

2016-01-11 Thread Travis Griggs
This may not be a great list for this question (which would be?); it’s a big group, and I’m hoping there’s some people here that cross into these same areas. I’m new to dbus, it seems it’s a sort of CORBA for the Linux world. :) Python seems to be a popular way to interact with it. I’m trying to

Re: Confused with Functions and decorators

2014-07-21 Thread Steven D'Aprano
On Mon, 21 Jul 2014 00:30:00 -0700, CHIN Dihedral wrote: > Uhn, a local object inside a function can be passed back in Python. > > Of course, a local function is treated as an object in Python,and the GC > is built-in. Sigh, the Dihedral bot is not what it used to be... -- Steven -- https://

Re: Confused with Functions and decorators

2014-07-21 Thread CHIN Dihedral
On Saturday, July 19, 2014 8:44:25 PM UTC+8, Wojciech Giel wrote: > On 19/07/14 12:40, Jerry lu wrote: > > > oh yeah i forgot about the decorators. Um say that you wanted to decorate a > > function with the outer() func you would just put @outer on top of it? And > > this is the same as passing

Re: Confused with Functions and decorators

2014-07-19 Thread Steven D'Aprano
On Sat, 19 Jul 2014 03:52:18 -0700, Jerry lu wrote: > Ok so i am trying to learn this and i do not understand some of it. I > also tried to searched the web but i couldnt find any answers. > > 1. I dont understand when i will need to use a function that returns > another function. eg >

Re: Confused with Functions and decorators

2014-07-19 Thread Jerry lu
Ok thanks so much i really want to get good. I also found this MIT open course lectures for python. Is this good to use as a source of learning? I think it would because it is MIT. -- https://mail.python.org/mailman/listinfo/python-list

Re: Confused with Functions and decorators

2014-07-19 Thread Chris Angelico
On Sun, Jul 20, 2014 at 12:24 PM, Jerry lu wrote: > ok I seem to very confused about this. Is there like a page or web page that > like completely sums this up so i can study. I am going to look up 'functions > in python'. Yep, look up stuff like that. I gave you some key

Re: Confused with Functions and decorators

2014-07-19 Thread Jerry lu
ok I seem to very confused about this. Is there like a page or web page that like completely sums this up so i can study. I am going to look up 'functions in python'. I am not sure if this is what we a talking about as a whole here but I'am sure that I'll find something

Re: Confused with Functions and decorators

2014-07-19 Thread Wojciech Giel
On 19/07/14 12:40, Jerry lu wrote: oh yeah i forgot about the decorators. Um say that you wanted to decorate a function with the outer() func you would just put @outer on top of it? And this is the same as passing another func into the outer func? yes. syntax was added because with very long f

Re: Confused with Functions and decorators

2014-07-19 Thread Wojciech Giel
On 19/07/14 11:52, Jerry lu wrote: Ok so i am trying to learn this and i do not understand some of it. I also tried to searched the web but i couldnt find any answers. 1. I dont understand when i will need to use a function that returns another function. eg def outer():

Re: Confused with Functions and decorators

2014-07-19 Thread Wojciech Giel
On 19/07/14 11:52, Jerry lu wrote: Ok so i am trying to learn this and i do not understand some of it. I also tried to searched the web but i couldnt find any answers. 1. I dont understand when i will need to use a function that returns another function. eg def outer():

Re: Confused with Functions and decorators

2014-07-19 Thread Jerry lu
Ok thanks man I have never used forums and stuff before but it is great help thank you so much. -- https://mail.python.org/mailman/listinfo/python-list

Re: Confused with Functions and decorators

2014-07-19 Thread Chris Angelico
On Sat, Jul 19, 2014 at 9:40 PM, Jerry lu wrote: > oh yeah i forgot about the decorators. Um say that you wanted to decorate a > function with the outer() func you would just put @outer on top of it? And > this is the same as passing another func into the outer func? > > and also with the first

Re: Confused with Functions and decorators

2014-07-19 Thread Jerry lu
oh yeah i forgot about the decorators. Um say that you wanted to decorate a function with the outer() func you would just put @outer on top of it? And this is the same as passing another func into the outer func? and also with the first example you say x is in the scope when is was created can

Re: Confused with Functions and decorators

2014-07-19 Thread Chris Angelico
On Sat, Jul 19, 2014 at 8:52 PM, Jerry lu wrote: > Ok so i am trying to learn this and i do not understand some of it. I also > tried to searched the web but i couldnt find any answers. > > 1. I dont understand when i will need to use a function that returns another > function. > eg >

Confused with Functions and decorators

2014-07-19 Thread Jerry lu
Ok so i am trying to learn this and i do not understand some of it. I also tried to searched the web but i couldnt find any answers. 1. I dont understand when i will need to use a function that returns another function. eg def outer(): def inner():

Re: I am confused about ' and "

2014-07-10 Thread Chris “Kwpolska” Warrick
On Jul 10, 2014 7:53 PM, "fl" wrote: > > Hi, > > It is still in the Regular expression operations concept, this link: > > has example using single quote mark: ' > > https://docs.python.org/2/library/re.html#re.split > > > While in this link: > > https://docs.python.org/3/howto/regex.html > > > It

Re: I am confused about ' and "

2014-07-10 Thread Joel Goldstick
On Thu, Jul 10, 2014 at 1:01 PM, fl wrote: > Hi, > > It is still in the Regular expression operations concept, this link: You must have missed my comment about quote and double quote. In python you can write a string using either. Just make sure if you start with double quote, you must end with

Re: I am confused about ' and "

2014-07-10 Thread Chris Angelico
On Fri, Jul 11, 2014 at 3:01 AM, fl wrote: > Please tell me because I have looked it around for one hour about it. > It's high time you started at the beginning, rather than trying to learn regexps without understanding Python. https://docs.python.org/3/tutorial/index.html Start there. You will

Re: I am confused about ' and "

2014-07-10 Thread John Gordon
In fl writes: > Please tell me because I have looked it around for one hour about it. There is no difference between ' and " when used to enclose strings, with one exception: a double-quoted string can contain single-quotes without the need to escape them with a backslash, and vice-versa. For

I am confused about ' and "

2014-07-10 Thread fl
Hi, It is still in the Regular expression operations concept, this link: has example using single quote mark: ' https://docs.python.org/2/library/re.html#re.split While in this link: https://docs.python.org/3/howto/regex.html It gives table with quote: " Regular String Raw string "ab*"

Re: confused about the different built-in functions in Python

2014-05-26 Thread Terry Reedy
On 5/26/2014 4:32 PM, Marko Rauhamaa wrote: I stand corrected. I had thought the trampoline ("bound method object") was created once and for all. Assuming that bound methods are immutable, this is an implementation detail, either way. However, it is common for a specific method to be called

Re: confused about the different built-in functions in Python

2014-05-26 Thread Steven D'Aprano
On Mon, 26 May 2014 23:58:37 +0300, Marko Rauhamaa wrote: > Marko Rauhamaa : > >> Christian Heimes : >> >>> Python creates a new bound method object every time. A bound method >>> object is a callable object that keeps a strong reference to the >>> function, class and object. The bound method obj

Re: confused about the different built-in functions in Python

2014-05-26 Thread Gregory Ewing
Marko Rauhamaa wrote: IOW, you can override a method with setattr() but you cannot delete a method with delattr(). Actually, you can -- but you need to delete it from the class, not the instance: >>> delattr(X, 'f') >>> x.f() Traceback (most recent call last): File "", line 1, in Attribute

Re: confused about the different built-in functions in Python

2014-05-26 Thread Marko Rauhamaa
Marko Rauhamaa : > Christian Heimes : > >> Python creates a new bound method object every time. A bound method >> object is a callable object that keeps a strong reference to the >> function, class and object. The bound method object adds the object as >> first argument to the function (aka 'self'

Re: confused about the different built-in functions in Python

2014-05-26 Thread Marko Rauhamaa
Christian Heimes : > Python creates a new bound method object every time. A bound method > object is a callable object that keeps a strong reference to the > function, class and object. The bound method object adds the object as > first argument to the function (aka 'self'). I stand corrected. I

Re: confused about the different built-in functions in Python

2014-05-26 Thread Christian Heimes
On 26.05.2014 21:00, Marko Rauhamaa wrote: > Terry Reedy : > >> Part of the answer is Python's history. Up to about 2.1, most built-in >> types did not have methods, though I know lists did. Ints and strings >> did not, or chr and ord might have been int.chr() and str.ord(). (The >> current string

Re: confused about the different built-in functions in Python

2014-05-26 Thread Marko Rauhamaa
Terry Reedy : > Part of the answer is Python's history. Up to about 2.1, most built-in > types did not have methods, though I know lists did. Ints and strings > did not, or chr and ord might have been int.chr() and str.ord(). (The > current string methods were originally functions in the string >

Re: confused about the different built-in functions in Python

2014-05-26 Thread Terry Reedy
On 5/26/2014 11:15 AM, Deb Wyatt wrote: On 5/25/14 7:55 PM, Deb Wyatt wrote: I am confused about how various built-in functions are called. Some are called with dot notation How do you know/remember which way to call them? It can be confusing. Generally, built-in functions (like sum

Re: confused about the different built-in functions in Python

2014-05-26 Thread Deb Wyatt
> > On 5/25/14 7:55 PM, Deb Wyatt wrote: >> I am confused about how various built-in functions are called. Some are >> called with dot notation >> >> How do you know/remember which way to call them? >> >> TIA, >> Deb in WA, USA > > It

Re: confused about the different built-in functions in Python

2014-05-25 Thread Cameron Simpson
On 25May2014 15:55, Deb Wyatt wrote: I am confused about how various built-in functions are called. Some are called with dot notation each_item.isalpha() and some are called like 'normal' sum(numlist) How do you know/remember which way to call them? Documentation. However, so

Re: confused about the different built-in functions in Python

2014-05-25 Thread Ned Batchelder
On 5/25/14 7:55 PM, Deb Wyatt wrote: I am confused about how various built-in functions are called. Some are called with dot notation each_item.isalpha() and some are called like 'normal' sum(numlist) How do you know/remember which way to call them? TIA, Deb in WA, USA

confused about the different built-in functions in Python

2014-05-25 Thread Deb Wyatt
I am confused about how various built-in functions are called.  Some are called with dot notationeach_item.isalpha()and some are called like 'normal'sum(numlist)How do you know/remember which way to call them?TIA,Deb in WA, USA Free Online Photosharing - Share your photos online

Re: the logical operation confused me

2014-04-10 Thread Denis McMahon
On Fri, 11 Apr 2014 07:02:33 +0800, length power wrote: "ok" or "not ok" > 'ok' "ok" and "not ok" > 'not ok' > why "ok" or "not ok" output "ok" , "ok" and "not ok" output "not ok" ? I believe that: [ (falsey condition) or ]* (first truthy condition) or (any condition) [ or

Re: the logical operation confused me

2014-04-10 Thread Gary Herron
On 04/10/2014 04:02 PM, length power wrote: >>> "ok" or "not ok" 'ok' >>> "ok" and "not ok" 'not ok' >>> why "ok" or "not ok" output "ok" , "ok" and "not ok" output "not ok" ? You are probably confusing yourself with the string "not ok". That string, and any other non-empty string is co

Re: the logical operation confused me

2014-04-10 Thread Terry Reedy
On 4/10/2014 7:02 PM, length power wrote: >>> "ok" or "not ok" 'ok' >>> "ok" and "not ok" 'not ok' >>> why "ok" or "not ok" output "ok" , "ok" and "not ok" output "not ok" ? This is explained in our fine manual. https://docs.python.org/2/reference/expressions.html#boolean-operations -- T

the logical operation confused me

2014-04-10 Thread length power
>>> "ok" or "not ok" 'ok' >>> "ok" and "not ok" 'not ok' >>> why "ok" or "not ok" output "ok" , "ok" and "not ok" output "not ok" ? -- https://mail.python.org/mailman/listinfo/python-list

Re: Confused about timezones

2013-10-23 Thread Ethan Furman
On 10/23/2013 12:00 PM, Skip Montanaro wrote: > --> LOCAL_TZ.localize(dt1).utcoffset() datetime.timedelta(-1, 68400) --> LOCAL_TZ.localize(dt2).utcoffset() datetime.timedelta(-1, 64800) Why is the UTC offset the same for both datetime objects despite the presence/absence of Daylight Savings?

Re: Confused about timezones

2013-10-23 Thread Skip Montanaro
LOCAL_TZ.localize(dt1).utcoffset() > datetime.timedelta(-1, 68400) LOCAL_TZ.localize(dt2).utcoffset() > datetime.timedelta(-1, 64800) > > Why is the UTC offset the same for both datetime objects despite the > presence/absence of Daylight Savings? Brain freeze! A quick glance told me they

Confused about timezones

2013-10-23 Thread Skip Montanaro
This isn't really a Python issue, though my problem solution will be implemented in Python. If I have a naive datetime object for some time in the past, it's not clear to me how the offset gets set correctly. Consider this sequence: >>> import datetime, pytz >>> LOCAL_TZ = pytz.timezone(os.environ

Confused approach to Pyinstaller

2013-06-29 Thread darpan6aya
I have a certain GUI program that I built using Python 2.7 and PyQt4. I want to convert it into a standalone windows executable. I went through the docs for Pyinstaller-2.0 and tried several times but I think that I might be on the wrong approach. Here is the structure of my Program. [Resource

Re: Confused about logger config from within Python (3)

2012-12-29 Thread Roy Smith
In article , Terry Reedy wrote: > On 12/29/2012 8:48 AM, Roy Smith wrote: > > In article <50de7a0a$0$29967$c3e8da3$54964...@news.astraweb.com>, > > Steven D'Aprano wrote: > > > >> In Python 3.2 and 3.3, the message about no handlers is not printed, > >> which is an interesting difference. (So

Re: Confused about logger config from within Python (3)

2012-12-29 Thread Terry Reedy
On 12/29/2012 8:48 AM, Roy Smith wrote: In article <50de7a0a$0$29967$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: In Python 3.2 and 3.3, the message about no handlers is not printed, which is an interesting difference. (Somebody who knows more about the logging package than I

Re: Confused about logger config from within Python (3)

2012-12-29 Thread Roy Smith
In article <50de7a0a$0$29967$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > In Python 3.2 and 3.3, the message about no handlers is not printed, > which is an interesting difference. (Somebody who knows more about the > logging package than I do might be able to state why that d

Re: Confused about logger config from within Python (3)

2012-12-28 Thread Steven D'Aprano
On Fri, 28 Dec 2012 16:41:20 -0800, andrew cooke wrote: > similarly, if i run the following, i see only "done": > > from logging import DEBUG, root, getLogger > > if __name__ == '__main__': > root.setLevel(DEBUG) > getLogger(__name__).debug("hello world") > print('done')

Re: Confused about logger config from within Python (3)

2012-12-28 Thread Steven D'Aprano
On Fri, 28 Dec 2012 11:57:29 -0800, andrew cooke wrote: > When I use a config file things seem to work (in other projects), but > for my current code I hoped to configure logging from Python. > > I distilled my problem down to the following test, which does not print > anything. Please can someo

Re: Confused about logger config from within Python (3)

2012-12-28 Thread Dave Angel
On 12/28/2012 09:29 PM, andrew cooke wrote: > On Friday, 28 December 2012 21:56:46 UTC-3, Peter Otten wrote: > > reading the damn docs you condescending *? > You've made four posts this year to this forum, in two threads, to ask for help. In that same year, Peter Otten has voluntarily helpe

Re: Confused about logger config from within Python (3)

2012-12-28 Thread andrew cooke
On Friday, 28 December 2012 21:56:46 UTC-3, Peter Otten wrote: > Other revolutionary ideas: read the docs > > ;) how do you think i knew about the root handler without reading the damn docs you condescending asshole? anywa

Re: Confused about logger config from within Python (3)

2012-12-28 Thread Peter Otten
andrew cooke wrote: > similarly, if i run the following, i see only "done": > > from logging import DEBUG, root, getLogger > > if __name__ == '__main__': > root.setLevel(DEBUG) > getLogger(__name__).debug("hello world") > print('done') You need a handler. The easiest way t

Re: Confused about logger config from within Python (3)

2012-12-28 Thread andrew cooke
similarly, if i run the following, i see only "done": from logging import DEBUG, root, getLogger if __name__ == '__main__': root.setLevel(DEBUG) getLogger(__name__).debug("hello world") print('done') -- http://mail.python.org/mailman/listinfo/python-list

Confused about logger config from within Python (3)

2012-12-28 Thread andrew cooke
When I use a config file things seem to work (in other projects), but for my current code I hoped to configure logging from Python. I distilled my problem down to the following test, which does not print anything. Please can someone explain why? I was expecting the module's logger to delegate

Re: Confused compare function :)

2012-12-08 Thread Steven D'Aprano
On Sun, 09 Dec 2012 14:22:21 +1100, Chris Angelico wrote: > On Sun, Dec 9, 2012 at 2:07 PM, Ramchandra Apte > wrote: >> Not really. I remember a bug saying that only 256 hashes were required >> of known texts and then the randomization becomes useless. > > That requires that someone be able to g

Re: Confused compare function :)

2012-12-08 Thread Chris Angelico
On Sun, Dec 9, 2012 at 2:07 PM, Ramchandra Apte wrote: > Not really. I remember a bug saying that only 256 hashes were required of > known texts and then the randomization becomes useless. That requires that someone be able to get you to hash some text and give back the hash. In any case, even i

Re: Confused compare function :)

2012-12-08 Thread Ramchandra Apte
On Thursday, 6 December 2012 17:44:17 UTC+5:30, Chris Angelico wrote: > On Thu, Dec 6, 2012 at 10:47 PM, Steven D'Aprano > > wrote: > > > Not so. Which one is faster will depend on how often you expect to fail. > > > If the keys are nearly always present, then: > > > > > > try: > > > do

Re: Confused compare function :)

2012-12-08 Thread MRAB
On 2012-12-08 07:17, Chris Angelico wrote: On Sat, Dec 8, 2012 at 6:01 PM, Terry Reedy wrote: Unfortunately, catching exceptions may be and often is as slow as the redundant check and even multiple redundant checks. It depends on how often you're going to catch and how often just flow through

Re: Confused compare function :)

2012-12-07 Thread Chris Angelico
On Sat, Dec 8, 2012 at 6:01 PM, Terry Reedy wrote: > Unfortunately, catching exceptions may be and often is as slow as the > redundant check and even multiple redundant checks. It depends on how often you're going to catch and how often just flow through. In Python, as in most other modern langua

Re: Confused compare function :)

2012-12-07 Thread Terry Reedy
On 12/7/2012 5:16 PM, Steven D'Aprano wrote: On Thu, 06 Dec 2012 23:14:17 +1100, Chris Angelico wrote: Setting up the try/except is a constant time cost, It's not just constant time, it's constant time and *cheap*. Doing nothing inside a try block takes about twice as long as doing nothing:

Re: Confused compare function :)

2012-12-07 Thread Steven D'Aprano
On Thu, 06 Dec 2012 23:14:17 +1100, Chris Angelico wrote: > Setting up the try/except is a constant time cost, It's not just constant time, it's constant time and *cheap*. Doing nothing inside a try block takes about twice as long as doing nothing: [steve@ando ~]$ python2.7 -m timeit "try: pas

Re: Confused compare function :)

2012-12-07 Thread Neil Cerutti
On 2012-12-07, Steven D'Aprano wrote: > On Thu, 06 Dec 2012 13:51:29 +, Neil Cerutti wrote: > >> On 2012-12-06, Steven D'Aprano >> wrote: >>> total = 0 >>> for s in list_of_strings: >>> try: >>> total += int(s) >>> except ValueError: >>> pass # Not a number, ignore it

Re: Confused compare function :)

2012-12-07 Thread Anatoli Hristov
>> Calling it 'found' is misleading, because it's True only if it updated. >> If it found a match but didn't update, 'found' will still be False. >> Using a loop within a loop like this could be the cause of your >> problem. It's certainly not the most efficient way of doing it. > > I will keep you

Re: Confused compare function :)

2012-12-06 Thread Steven D'Aprano
On Thu, 06 Dec 2012 13:51:29 +, Neil Cerutti wrote: > On 2012-12-06, Steven D'Aprano > wrote: >> total = 0 >> for s in list_of_strings: >> try: >> total += int(s) >> except ValueError: >> pass # Not a number, ignore it. > > If it's internal data, perhaps. Of course,

Re: Confused compare function :)

2012-12-06 Thread Rotwang
On 06/12/2012 04:32, Steven D'Aprano wrote: On Thu, 06 Dec 2012 03:22:53 +, Rotwang wrote: [...] Is there a problem with either of the above? If so, what should I do instead? They're fine. Never, ever say that people should never, ever do something. *cough* Thanks. -- I have made a

Re: Confused compare function :)

2012-12-06 Thread Rotwang
On 06/12/2012 08:49, Bruno Dupuis wrote: On Thu, Dec 06, 2012 at 04:32:34AM +, Steven D'Aprano wrote: On Thu, 06 Dec 2012 03:22:53 +, Rotwang wrote: On 06/12/2012 00:19, Bruno Dupuis wrote: [...] Another advice: never ever except XXXError: pass at least log, or count, or warn

Re: Confused compare function :)

2012-12-06 Thread Anatoli Hristov
> gmane.comp.python.general: > >> But basically, the code seems to run a pair of nested for-loops: >> >> for SKU in database: >> for SKU in csv file: >> if the two SKUs match: >> compare their prices and update the database >> > OUCH... > > I'm presuming the

Re: Confused compare function :)

2012-12-06 Thread Anatoli Hristov
Here is the product in the CSV: MONIIE2407HDS-B1;MON;II;E2407HDS-B1;E2407HDS-B1;IIYAMA LCD 24" Wide 1920x1080TN Speakers 2ms Black DVI HDMI;133;20;RECTD0.41;0,41; > [snip] > It's not saying that it's not found, it's saying that it wasn't updated > because: You are right

  1   2   3   4   5   6   >