Q:

Parsing a string into date at the time the DST change happened

In western Europe, 2019-10-27 02:30:00 could be "two" time-events:

02:30 am before DST change at 03:00
03:30 am, which became (after DST change at 03:00) 02:30 am

How does datetime parser and pytz deal with the fact parsing this date could result into two different time-events?
import datetime, pytz
d = datetime.datetime.strptime("2019-10-27 02:30:00", '%Y-%m-%d %H:%M:%S')
d = pytz.timezone('Europe/Paris').localize(d)
print(d, d.timestamp())  

The answer is 2019-10-27 02:30:00+01:00  1572139800.0, why not 2019-10-27 02:30:00+02:00? Both could have been possible.

Remark:
import datetime
print(datetime.datetime.fromtimestamp(1572139800.0))  # 2019-10-27 02:30:00
print(datetime.datetime.fromtimestamp(1572136200.0))  # 2019-10-27 02:30:00

(these two different UTC timestamps have the same datetime in Europe/Paris timezone indeed)

A:

The direction is determined by the is_dst argument of the localize method. 

is_dst is used to determine the correct timezone in the ambiguous
  period at the end of daylight saving time.

In the example in the question, using True will give you +02:00; and False +01:00

Use is_dst=None to raise an AmbiguousTimeError for ambiguous
  times at the end of daylight saving time

If a datetime instance is naive (or don't include a timezone) using localize will apply a timezone assuming the supplied instance is in local time and apply the offset to the targetted timezone.
After using localize the datetime instance will no longer be naive and the two values will equal one another as they are technically the same time.

This question is highlighting one annoying behaviour of the datetime module, unless explicitly specified datetime instances are naive, this includes using strptime if your matching expression does not include a time offset.
By changing the example to include the optional timezone argument things become clearer:
import pytz
from datetime import datetime

tz = pytz.timezone("Europe/Paris")
print(datetime.fromtimestamp(1572139800.0, tz))  # 2019-10-27 02:30:00+01:00
print(datetime.fromtimestamp(1572136200.0, tz))  # 2019-10-27 02:30:00+02:00

With the timezone included, printing the resulting datetime instance will now include the offset to show the time is not actually the same.
I recommend using the arrow package for handling dates and times which always includes a timezone (defaults to the operating systems timezone).
References

Docs for localize method - https://github.com/stub42/pytz/blob/master/src/pytz/tzinfo.py#L258

